]> granicus.if.org Git - php/commitdiff
Add const modifier for zend_extension members
authorcodinghuang <2812240764@qq.com>
Fri, 27 Nov 2020 12:29:59 +0000 (20:29 +0800)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 1 Dec 2020 09:40:26 +0000 (10:40 +0100)
Closes GH-6462.

Zend/zend_extensions.h
sapi/phpdbg/phpdbg_prompt.c

index 3f330d2a2c406bca939465ae7e8f80ad5ce96b00..49ce1155484908f3ef8affe2da207ad96174a42c 100644 (file)
@@ -75,11 +75,11 @@ typedef size_t (*op_array_persist_calc_func_t)(zend_op_array *op_array);
 typedef size_t (*op_array_persist_func_t)(zend_op_array *op_array, void *mem);
 
 struct _zend_extension {
-       char *name;
-       char *version;
-       char *author;
-       char *URL;
-       char *copyright;
+       const char *name;
+       const char *version;
+       const char *author;
+       const char *URL;
+       const char *copyright;
 
        startup_func_t startup;
        shutdown_func_t shutdown;
index 39ef7d8768263e9561f2e51276c8cf6f207343ac..58a54a5a55432f998f2140f82d42e41af6b4ccf5 100644 (file)
@@ -1227,7 +1227,7 @@ static void add_zendext_info(zend_extension *ext) /* {{{ */ {
 /* }}} */
 
 #ifdef HAVE_LIBDL
-PHPDBG_API const char *phpdbg_load_module_or_extension(char **path, char **name) /* {{{ */ {
+PHPDBG_API const char *phpdbg_load_module_or_extension(char **path, const char **name) /* {{{ */ {
        DL_HANDLE handle;
        char *extension_dir;
 
@@ -1325,7 +1325,7 @@ PHPDBG_API const char *phpdbg_load_module_or_extension(char **path, char **name)
                }
 
                module_entry = get_module();
-               *name = (char *) module_entry->name;
+               *name = module_entry->name;
 
                if (strcmp(ZEND_EXTENSION_BUILD_ID, module_entry->build_id)) {
                        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 @@ quit:
 
 PHPDBG_COMMAND(dl) /* {{{ */
 {
-       const char *type;
-       char *name, *path;
+       const char *type, *name;
+       char *path;
 
        if (!param || param->type == EMPTY_PARAM) {
                phpdbg_notice("dl", "extensiontype=\"Zend extension\"", "Zend extensions");
@@ -1388,7 +1388,6 @@ PHPDBG_COMMAND(dl) /* {{{ */
                        phpdbg_activate_err_buf(1);
                        if ((type = phpdbg_load_module_or_extension(&path, &name)) == NULL) {
                                phpdbg_error("dl", "path=\"%s\" %b", "Could not load %s, not found or invalid zend extension / module: %b", path);
-                               efree(name);
                        } else {
                                phpdbg_notice("dl", "extensiontype=\"%s\" name=\"%s\" path=\"%s\"", "Successfully loaded the %s %s at path %s", type, name, path);
                        }