mirror of
https://github.com/php/php-src.git
synced 2025-08-17 14:38:49 +02:00
- Better fix for #40091
This commit is contained in:
parent
17eaaea1f7
commit
b08cfa8833
1 changed files with 6 additions and 6 deletions
|
@ -449,13 +449,13 @@ PHP_FUNCTION(spl_autoload_register)
|
||||||
efree(func_name);
|
efree(func_name);
|
||||||
|
|
||||||
if (SPL_G(autoload_functions) && zend_hash_exists(SPL_G(autoload_functions), (char*)lc_name, func_name_len+1)) {
|
if (SPL_G(autoload_functions) && zend_hash_exists(SPL_G(autoload_functions), (char*)lc_name, func_name_len+1)) {
|
||||||
goto skip;
|
goto skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj_ptr && !(alfi.func_ptr->common.fn_flags & ZEND_ACC_STATIC)) {
|
if (obj_ptr && !(alfi.func_ptr->common.fn_flags & ZEND_ACC_STATIC)) {
|
||||||
/* add object id to the hash to ensure uniqueness, for more reference look at bug #40091 */
|
/* add object id to the hash to ensure uniqueness, for more reference look at bug #40091 */
|
||||||
memcpy(lc_name + func_name_len, obj_ptr, sizeof(long));
|
memcpy(lc_name + func_name_len, &Z_OBJ_HANDLE_PP(obj_ptr), sizeof(zend_object_handle));
|
||||||
func_name_len += sizeof(long);
|
func_name_len += sizeof(zend_object_handle);
|
||||||
lc_name[func_name_len] = '\0';
|
lc_name[func_name_len] = '\0';
|
||||||
alfi.obj = *obj_ptr;
|
alfi.obj = *obj_ptr;
|
||||||
alfi.obj->refcount++;
|
alfi.obj->refcount++;
|
||||||
|
@ -528,9 +528,9 @@ PHP_FUNCTION(spl_autoload_unregister)
|
||||||
/* remove specific */
|
/* remove specific */
|
||||||
success = zend_hash_del(SPL_G(autoload_functions), func_name, func_name_len+1);
|
success = zend_hash_del(SPL_G(autoload_functions), func_name, func_name_len+1);
|
||||||
if (success != SUCCESS && obj_ptr) {
|
if (success != SUCCESS && obj_ptr) {
|
||||||
func_name = erealloc(func_name, func_name_len + 1 + sizeof(long));
|
func_name = erealloc(func_name, func_name_len + 1 + sizeof(zend_object_handle));
|
||||||
memcpy(func_name + func_name_len, obj_ptr, sizeof(long));
|
memcpy(func_name + func_name_len, &Z_OBJ_HANDLE_PP(obj_ptr), sizeof(zend_object_handle));
|
||||||
func_name_len += sizeof(long);
|
func_name_len += sizeof(zend_object_handle);
|
||||||
func_name[func_name_len] = '\0';
|
func_name[func_name_len] = '\0';
|
||||||
success = zend_hash_del(SPL_G(autoload_functions), func_name, func_name_len+1);
|
success = zend_hash_del(SPL_G(autoload_functions), func_name, func_name_len+1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue