Skip to content

Commit 3c6ab4b

Browse files
huanghantaonikic
authored andcommitted
Add const modifier for zend_extension members
Closes GH-6462.
1 parent c034f20 commit 3c6ab4b

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

Zend/zend_extensions.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ typedef size_t (*op_array_persist_calc_func_t)(zend_op_array *op_array);
7575
typedef size_t (*op_array_persist_func_t)(zend_op_array *op_array, void *mem);
7676

7777
struct _zend_extension {
78-
char *name;
79-
char *version;
80-
char *author;
81-
char *URL;
82-
char *copyright;
78+
const char *name;
79+
const char *version;
80+
const char *author;
81+
const char *URL;
82+
const char *copyright;
8383

8484
startup_func_t startup;
8585
shutdown_func_t shutdown;

sapi/phpdbg/phpdbg_prompt.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,7 @@ static void add_zendext_info(zend_extension *ext) /* {{{ */ {
12271227
/* }}} */
12281228

12291229
#ifdef HAVE_LIBDL
1230-
PHPDBG_API const char *phpdbg_load_module_or_extension(char **path, char **name) /* {{{ */ {
1230+
PHPDBG_API const char *phpdbg_load_module_or_extension(char **path, const char **name) /* {{{ */ {
12311231
DL_HANDLE handle;
12321232
char *extension_dir;
12331233

@@ -1325,7 +1325,7 @@ PHPDBG_API const char *phpdbg_load_module_or_extension(char **path, char **name)
13251325
}
13261326

13271327
module_entry = get_module();
1328-
*name = (char *) module_entry->name;
1328+
*name = module_entry->name;
13291329

13301330
if (strcmp(ZEND_EXTENSION_BUILD_ID, module_entry->build_id)) {
13311331
phpdbg_error("dl", "type=\"wrongbuild\" module=\"%s\" buildneeded=\"%s\" buildinstalled=\"%s\"", "%s was built with configuration %s, whereas running engine is %s", module_entry->name, module_entry->build_id, ZEND_EXTENSION_BUILD_ID);
@@ -1371,8 +1371,8 @@ PHPDBG_API const char *phpdbg_load_module_or_extension(char **path, char **name)
13711371

13721372
PHPDBG_COMMAND(dl) /* {{{ */
13731373
{
1374-
const char *type;
1375-
char *name, *path;
1374+
const char *type, *name;
1375+
char *path;
13761376

13771377
if (!param || param->type == EMPTY_PARAM) {
13781378
phpdbg_notice("dl", "extensiontype=\"Zend extension\"", "Zend extensions");
@@ -1388,7 +1388,6 @@ PHPDBG_COMMAND(dl) /* {{{ */
13881388
phpdbg_activate_err_buf(1);
13891389
if ((type = phpdbg_load_module_or_extension(&path, &name)) == NULL) {
13901390
phpdbg_error("dl", "path=\"%s\" %b", "Could not load %s, not found or invalid zend extension / module: %b", path);
1391-
efree(name);
13921391
} else {
13931392
phpdbg_notice("dl", "extensiontype=\"%s\" name=\"%s\" path=\"%s\"", "Successfully loaded the %s %s at path %s", type, name, path);
13941393
}

0 commit comments

Comments
 (0)