Bug #77704 [NEW]: constant with namespace is not fetchable
From: eglic at ziima dot cn
Operating system: Any
PHP version: 7.2.15
Package: Scripting Engine problem
Bug Type: Bug
Bug description:constant with namespace is not fetchable
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;
--
Edit bug report at https://bugs.php.net/bug.php?id=77704&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77704&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77704&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77704&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77704&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77704&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77704&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77704&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77704&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77704&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77704&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77704&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77704&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77704&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77704&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77704&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77704&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77704&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77704&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77704&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77704&r=mysqlcfg
Thread (2 messages)
- eglic at ziima dot cn