com php-src: Use better fix for preventing too early freeing of interned strings Works also with opcache now - just prevent zend_inter
ned_strings_restore completely - zend_interned_st rings_dtor will take care as phpdbg only ever uses one single request cycle per module cycle :
sapi/phpdbg/phpdbg.c sapi/phpdbg/phpdbg_list.c

From: Date: Thu, 06 Oct 2016 08:36:25 +0000
Subject: com php-src: Use better fix for preventing too early freeing of interned strings Works also with opcache now - just prevent zend_inter
ned_strings_restore completely - zend_interned_st rings_dtor will take care as phpdbg only ever uses one single request cycle per module cycle :
sapi/phpdbg/phpdbg.c sapi/phpdbg/phpdbg_list.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-94848@lists.php.net to get a copy of this message
Commit: c9d3b9fb475861d03e7d9b913a12527a2023e152 Author: Bob Weinand <bobwei9@hotmail.com> Thu, 6 Oct 2016 10:36:12 +0200 Parents: b2d53e47ed0a141078c41331d4c232db979be967 Branches: PHP-7.1 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c9d3b9fb475861d03e7d9b913a12527a2023e152 Log: Use better fix for preventing too early freeing of interned strings Works also with opcache now - just prevent zend_interned_strings_restore completely - zend_interned_strings_dtor will take care as phpdbg only ever uses one single request cycle per module cycle Changed paths: M sapi/phpdbg/phpdbg.c M sapi/phpdbg/phpdbg_list.c Diff: diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c index a7fda1d..bda5b56 100644 --- a/sapi/phpdbg/phpdbg.c +++ b/sapi/phpdbg/phpdbg.c @@ -797,13 +797,17 @@ static zend_module_entry sapi_phpdbg_module_entry = { STANDARD_MODULE_PROPERTIES }; +static void phpdbg_interned_strings_nothing(void) { } + static inline int php_sapi_phpdbg_module_startup(sapi_module_struct *module) /* {{{ */ { if (php_module_startup(module, &sapi_phpdbg_module_entry, 1) == FAILURE) { return FAILURE; } + /* prevent zend_interned_strings_restore from invalidating our string pointers too early (in phpdbg allocated memory only gets freed after module shutdown) */ + zend_interned_strings_restore = phpdbg_interned_strings_nothing; - phpdbg_booted=1; + phpdbg_booted = 1; return SUCCESS; } /* }}} */ diff --git a/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c index dd0187c..86a2132 100644 --- a/sapi/phpdbg/phpdbg_list.c +++ b/sapi/phpdbg/phpdbg_list.c @@ -317,17 +317,6 @@ zend_op_array *phpdbg_init_compile_file(zend_file_handle *file, int type) { dataptr = zend_hash_str_find_ptr(&PHPDBG_G(file_sources), filename, strlen(filename)); ZEND_ASSERT(dataptr != NULL); - if (op_array->vars) { - int i; - /* un-intern these strings to prevent zend_interned_strings_restore from invalidating our string pointers too early (in phpdbg allocated memory only gets freed after module shutdown) */ - for (i = 0; i < op_array->last_var; i++) { - zend_string **s = op_array->vars + i; - if (ZSTR_IS_INTERNED(*s)) { - *s = zend_string_init(ZSTR_VAL(*s), ZSTR_LEN(*s), 0); - } - } - } - dataptr->op_array = *op_array; if (dataptr->op_array.refcount) { ++*dataptr->op_array.refcount;

« previous php.cvs (#94848) next »