Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opcache do not update class constant after uopz_redefine #63

Closed
Streamlet opened this issue Aug 30, 2017 · 3 comments
Closed

opcache do not update class constant after uopz_redefine #63

Streamlet opened this issue Aug 30, 2017 · 3 comments

Comments

@Streamlet
Copy link

Streamlet commented Aug 30, 2017

see https://bugs.php.net/bug.php?id=74576

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)
@rlerdorf
Copy link
Contributor

rlerdorf commented Sep 6, 2017

Are you loading uopz before opcache as per the docs?

@krakjoe krakjoe closed this as completed Dec 16, 2018
@Streamlet
Copy link
Author

Are you loading uopz before opcache as per the docs?

yes

@krakjoe
Copy link
Owner

krakjoe commented Jan 2, 2019

This will be fixed in the next release, sorry I forgot to tag ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants