Bug #72426 [Opn->Csd]: Function registration logic within the Zend framework should use the same case
Edit report at https://bugs.php.net/bug.php?id=72426&edit=1
ID: 72426
Updated by: krakjoe@php.net
Reported by: nathan dot justus at oracle dot com
Summary: Function registration logic within the Zend
framework should use the same case
-Status: Open
+Status: Closed
Type: Bug
Package: PHP options/info functions
Operating System: Gnu Linux
PHP Version: 5.6.22
-Assigned To:
+Assigned To: krakjoe
Block user comment: N
Private report: N
New Comment:
This is fixed in latest versions.
Previous Comments:
------------------------------------------------------------------------
[2016-06-15 21:56:20] nathan dot justus at oracle dot com
Description:
------------
prior to calling zend_hash_add, zend_register_functions translates the âkeyâ to lowercase.
Certainly there is nothing wrong with this approach, IF the corresponding code that searches for
and removes the entry from the hash table is doing the same thing; otherwise, the hash codes will
not match.
(gdb) bt
#0 _zend_hash_add_or_update (ht=0x8e827b0, arKey=0x8ef4be0 "initconnectapi",
nKeyLength=15, pData=0x5e72c94, nDataSize=144, pDest=0x5e72c90, flag=2)
at /nfs/local/src/php/php-5.3.2-1511_150610/Zend/zend_hash.c:208
#1 0x07a888fd in zend_register_functions (scope=0x0, functions=0x5db780, function_table=0x0,
type=2, tsrm_ls=0x8e41038) at /nfs/local/src/php/php-5.3.2-1511_150610/Zend/zend_API.c:1930
#2 0x07a87ad9 in zend_register_module_ex (module=0x8f24c10, tsrm_ls=0x8e41038) at
/nfs/local/src/php/php-5.3.2-
that is:
fname_len = strlen(ptr->fname);
lowercase_name = zend_str_tolower_dup(ptr->fname, fname_len);
if (zend_hash_add(target_function_table, lowercase_name, fname_len+1, &function,
sizeof(zend_function), (void**)®_function) == FAILURE) {
unload=1;
efree(lowercase_name);
break;
}
how the delete code does NOT translate the key to lowercase beforehand:
(gdb) bt
#0 zend_hash_del_key_or_index (ht=0x915b7b0, arKey=0x2d7d5a4 "initConnectAPI",
nKeyLength=15, h=0, flag=0) at /nfs/local/src/php/php-5.3.2-1511_150610/Zend/zend_hash.c:462
#1 0x0058d205 in zend_unregister_functions (functions=0x2da6780, count=-1, function_table=0x0,
tsrm_ls=0x911a038) at /nfs/local/src/php/php-5.3.2-1511_150610/Zend/zend_API.c:2091
#2 0x0058d3e4 in module_destructor (module=0x91fd9d0) at /
Either both or neither should use 'tolower.'
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72426&edit=1
Thread (2 messages)