|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2019-03-06 10:32 UTC] eglic at ziima dot cn
Description:
------------
in php-7.2.15 source 'Zend/zend_constants.c':
ZEND_API int zend_register_constant(zend_constant *c)
{
...
#479 char *slash = strrchr(ZSTR_VAL(c->name), '\\');
...
#482 zend_str_tolower(ZSTR_VAL(lowercase_name), slash - ZSTR_VAL(c->name));
-----------
constant name is changed to "foo\\BAR"
but in the same file
#243 ZEND_API zval *zend_get_constant_str(const char *name, size_t name_len)
...
#250 zend_str_tolower_copy(lcname, name, name_len);
---------
use "Foo\\BAR" to find first,and try "foo\\bar" again.
both faied.
Test script:
---------------
1. REGISTER_NS_STRING_CONSTANT("Foo", "BAR", "Test", CONST_CS | CONST_PERSISTENT);
2. zval *c = zend_get_constant_str(ZEND_STRL("Foo\\BAR"));
it returns NULL;
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 09 09:00:01 2025 UTC |
> constant name is changed to "foo\\BAR" Indeed, so you should use: zval *c = zend_get_constant_str(ZEND_STRL("foo\\BAR"));