Bug #74648 [NEW]: zend_read_static_property returns &NULL for extending classes
| From: | jurigag at gmail dot com | Date: | Wed, 24 May 2017 14:33:06 +0000 |
| Subject: | Bug #74648 [NEW]: zend_read_static_property returns &NULL for extending classes | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-209253@lists.php.net to get a copy of this message | ||
From: jurigag at gmail dot com
Operating system: Ubuntu 14.04
PHP version: 7.0.19
Package: Scripting Engine problem
Bug Type: Bug
Bug description:zend_read_static_property returns &NULL for extending classes
Description:
------------
When extending internal class which has defined static property with
null value and accessing this static property in C code using
zend_read_static_property there is value returned as &NULL in C code
causing some comparisons to fail. Though value in php code of this
static property is correctly returned as NULL.
This also happens for php 7.1 as well.
Test script:
---------------
In class init:
zend_declare_property_null(test3_test_ce, "someNull",
sizeof("someNull")-1, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC TSRMLS_CC);
Access and dump it somewhere(in method for example, keep in mind you
must extends class in php first):
zval *tmp = zend_read_static_property(ce, "someNull",
sizeof("queryString")-1, (zend_bool) ZEND_FETCH_CLASS_SILENT); // here
will be returned &NULL
php_var_dump(tmp, 1); // var dumps &NULL
if (Z_TYPE_P(tmp) == IS_NULL) // false
--
Edit bug report at https://bugs.php.net/bug.php?id=74648&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74648&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74648&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74648&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74648&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74648&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74648&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74648&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74648&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74648&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74648&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74648&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74648&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74648&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74648&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74648&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74648&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74648&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74648&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74648&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74648&r=mysqlcfg