php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72426 Function registration logic within the Zend framework should use the same case
Submitted: 2016-06-15 21:56 UTC Modified: 2021-05-22 14:54 UTC
From: nathan dot justus at oracle dot com Assigned: krakjoe (profile)
Status: Closed Package: PHP options/info functions
PHP Version: 5.6.22 OS: Gnu Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nathan dot justus at oracle dot com
New email:
PHP Version: OS:

 

 [2016-06-15 21:56 UTC] 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**)&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.'


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-05-22 14:54 UTC] krakjoe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: krakjoe
 [2021-05-22 14:54 UTC] krakjoe@php.net
This is fixed in latest versions.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 07:01:29 2024 UTC