Bug #74643 [NEW]: zend_read_static_property returns &NULL for extending classes
| From: | jurigag at gmail dot com | Date: | Wed, 24 May 2017 11:12:20 +0000 |
| Subject: | Bug #74643 [NEW]: zend_read_static_property returns &NULL for extending classes | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-209243@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, sizeof("someNull")-1,
ZEND_ACC_PUBLIC|ZEND_ACC_STATIC TSRMLS_CC);
Access and dump it somwhere(keep in mind you must extends class in php
first):
zval *tmp = zend_read_static_property(ce, sizeof("someNull")-1, len,
(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=74643&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74643&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74643&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74643&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74643&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74643&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74643&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74643&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74643&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74643&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74643&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74643&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74643&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74643&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74643&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74643&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74643&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74643&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74643&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74643&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74643&r=mysqlcfg