|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74643 zend_read_static_property returns &NULL for extending classes
Submitted: 2017-05-24 11:12 UTC Modified: 2017-05-24 14:43 UTC
From: jurigag at gmail dot com Assigned:
Status: Duplicate Package: Scripting Engine problem
PHP Version: 7.0.19 OS: Ubuntu 14.04
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
42 + 1 = ?
Subscribe to this entry?

 [2017-05-24 11:12 UTC] jurigag at gmail dot com
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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-05-24 11:29 UTC] jurigag at gmail dot com
zval *tmp = zend_read_static_property(ce, "someNull", sizeof("queryString")-1, (zend_bool) ZEND_FETCH_CLASS_SILENT);
 [2017-05-24 14:30 UTC] jurigag at gmail dot com
-Status: Open +Status: Closed
 [2017-05-24 14:30 UTC] jurigag at gmail dot com
I will create it again
 [2017-05-24 14:43 UTC]
-Status: Closed +Status: Duplicate
 [2017-05-24 14:43 UTC]
bug #74648
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 05 04:01:29 2024 UTC