Bug #74648 [Opn->Nab]: zend_read_static_property returns &NULL for extending classes
| From: | laruence@php.net | Date: | Sat, 27 May 2017 09:03:39 +0000 |
| Subject: | Bug #74648 [Opn->Nab]: zend_read_static_property returns &NULL for extending classes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-209276@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74648&edit=1
ID: 74648
Updated by: laruence@php.net
Reported by: jurigag at gmail dot com
Summary: zend_read_static_property returns &NULL for
extending classes
-Status: Open
+Status: Not a bug
Type: Bug
Package: Scripting Engine problem
Operating System: Ubuntu 14.04
PHP Version: 7.0.19
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
you should use ZVAL_DEREF to handle that
Previous Comments:
------------------------------------------------------------------------
[2017-05-24 14:43:13] requinix@php.net
Related To: Bug #74643
------------------------------------------------------------------------
[2017-05-24 14:33:06] jurigag at gmail dot com
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 this bug report at https://bugs.php.net/bug.php?id=74648&edit=1