Bug #72426 [NEW]: Function registration logic within the Zend framework should use the same case

From: Date: Wed, 15 Jun 2016 21:56:23 +0000
Subject: Bug #72426 [NEW]: Function registration logic within the Zend framework should use the same case
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-201668@lists.php.net to get a copy of this message
From:             nathan dot justus at oracle dot com
Operating system: Gnu Linux
PHP version:      5.6.22
Package:          PHP options/info functions
Bug Type:         Bug
Bug description:Function registration logic within the Zend framework should use the same case

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**)&reg_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 bug report at https://bugs.php.net/bug.php?id=72426&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=72426&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=72426&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=72426&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=72426&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=72426&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=72426&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=72426&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=72426&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=72426&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=72426&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=72426&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=72426&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=72426&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72426&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=72426&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=72426&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=72426&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72426&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=72426&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=72426&r=mysqlcfg



Thread (2 messages)

« previous php.bugs (#201668) next »