php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74576 opcache do not update class constant after uopz_redefine
Submitted: 2017-05-12 05:47 UTC Modified: 2021-07-08 12:21 UTC
From: kejinjin at gmail dot com Assigned: cmb (profile)
Status: Closed Package: PECL (PECL)
PHP Version: 7.1.4 OS: CentOS7x64
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: kejinjin at gmail dot com
New email:
PHP Version: OS:

 

 [2017-05-12 05:47 UTC] kejinjin at gmail dot com
Description:
------------
I use uopz_redefine to redefine class constants
(uopz called zend_declare_class_constant)

when opcache is enabled, I cannot get the new class constant through Foo::BAR.

Test script:
---------------
<?php

class Foo
{
	const BAR = '123';
}

var_dump(Foo::BAR);// A1: try to comment this

(function () {
	var_dump(Foo::BAR);	// B1: try to comment this
	uopz_redefine('Foo', 'BAR', '456');
	var_dump(Foo::BAR);	// B2: compare
})();

(function () {
	var_dump(Foo::BAR);	// new scope
})();

var_dump((new ReflectionClass('Foo'))->getConstant('BAR'));	// also OK

var_dump(Foo::BAR);	// A2: compare


Expected result:
----------------
'123'
'123'
'456'
'456'
'456'
'456'

Actual result:
--------------
'123'
'123'
'123' (it is '456' if line B1 is commented)
'456'
'456'
'123' (it is '456' if line A1 is commented)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-05-12 06:08 UTC] kejinjin at gmail dot com
-PHP Version: 7.1.5 +PHP Version: 7.1.4
 [2017-05-12 06:08 UTC] kejinjin at gmail dot com
PS: PHP version is 7.1.4
 [2017-10-03 16:43 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2017-10-03 16:43 UTC] cmb@php.net
Are you loading uopz *before* OPcache?
 [2017-11-05 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2017-12-13 04:04 UTC] kejinjin at gmail dot com
Are you loading uopz *before* OPcache?
==========================================
Yes, I'm sure I load uopz before OPcache.
 [2017-12-13 04:08 UTC] kejinjin at gmail dot com
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
===============================================================

When I try to change bug status to "Re-Opened", it says:
You aren't allowed to change a bug to that state.
 [2017-12-13 08:24 UTC] cmb@php.net
-Status: No Feedback +Status: Re-Opened -Assigned To: cmb +Assigned To:
 [2017-12-21 11:31 UTC] kejinjin at gmail dot com
re-open
 [2021-07-08 12:21 UTC] cmb@php.net
-Status: Re-Opened +Status: Closed -Package: opcache +Package: PECL -Assigned To: +Assigned To: cmb
 [2021-07-08 12:21 UTC] cmb@php.net
I'm reclassifying this as uopz issue.  If this still happens with
latest uopz (6.1.2) and any of the actively supported PHP
versions[1], please file a bug report at
<https://github.com/krakjoe/uopz/issues>.

[1] <https://www.php.net/supported-versions.php>
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Jul 24 21:01:24 2021 UTC