mirror of
https://github.com/php/php-src.git
synced 2025-08-19 17:04:47 +02:00
- Fix unicode issue (our string termination test checks both ending bytes instead of just one)
This commit is contained in:
parent
4aa4a425b6
commit
7425d1a6fa
1 changed files with 6 additions and 4 deletions
|
@ -466,16 +466,18 @@ PHP_FUNCTION(spl_autoload_register)
|
||||||
/* 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 */
|
||||||
zstr lc_name;
|
zstr lc_name;
|
||||||
size_t func_name_len = Z_UNISIZE(zfunc_name);
|
size_t func_name_len = Z_UNISIZE(zfunc_name);
|
||||||
lc_name.v = Z_UNIVAL(zfunc_name).v = erealloc(Z_UNIVAL(zfunc_name).v, func_name_len + 1 + sizeof(long));
|
lc_name.v = Z_UNIVAL(zfunc_name).v = erealloc(Z_UNIVAL(zfunc_name).v, func_name_len + 2 + sizeof(zend_object_handle));
|
||||||
memcpy(lc_name.s + func_name_len, &Z_OBJ_HANDLE_PP(obj_ptr), sizeof(zend_object_handle));
|
memcpy(lc_name.s + func_name_len, &Z_OBJ_HANDLE_PP(obj_ptr), sizeof(zend_object_handle));
|
||||||
func_name_len += sizeof(zend_object_handle);
|
func_name_len += sizeof(zend_object_handle);
|
||||||
lc_name.s[func_name_len] = '\0';
|
|
||||||
alfi.obj = *obj_ptr;
|
alfi.obj = *obj_ptr;
|
||||||
alfi.obj->refcount++;
|
alfi.obj->refcount++;
|
||||||
if (Z_TYPE(zfunc_name) == IS_UNICODE) {
|
if (Z_TYPE(zfunc_name) == IS_UNICODE) {
|
||||||
Z_UNILEN(zfunc_name) = func_name_len / sizeof(UChar);
|
func_name_len /= sizeof(UChar);
|
||||||
|
Z_STRLEN(zfunc_name) = func_name_len;
|
||||||
|
lc_name.u[func_name_len] = '\0';
|
||||||
} else {
|
} else {
|
||||||
Z_UNILEN(zfunc_name) = func_name_len;
|
Z_STRLEN(zfunc_name) = func_name_len;
|
||||||
|
lc_name.s[func_name_len] = '\0';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
alfi.obj = NULL;
|
alfi.obj = NULL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue