php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74648 zend_read_static_property returns &NULL for extending classes
Submitted: 2017-05-24 14:33 UTC Modified: 2017-05-27 09:03 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: jurigag at gmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 7.0.19 OS: Ubuntu 14.04
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jurigag at gmail dot com
New email:
PHP Version: OS:

 

 [2017-05-24 14:33 UTC] 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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-05-27 09:03 UTC] laruence@php.net
-Status: Open +Status: Not a bug
 [2017-05-27 09:03 UTC] laruence@php.net
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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 01:01:30 2024 UTC