You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@TimWolla That's to some degree expected behaviour, because without opcache the scope is changed on first usage of the closure. With opcache the scope is immutable.
And Closures have to allocate a different run_time_cache (which also causes an observer initialization).
There's no guarantee that observer is only initialized once for a given set of opcodes. The guarantee is once per run_time_cache.
For this specific case, we can however do if ((op_array->fn_flags & ZEND_ACC_STATIC) == 0) op_array->scope = CG(active_class_entry); for Closures in compiler - I think.
For this specific case, we can however do if ((op_array->fn_flags & ZEND_ACC_STATIC) == 0) op_array->scope = CG(active_class_entry); for Closures in compiler - I think.
Why limit it to non-static closures? static closures also have a scope and are affected by this issue. They just don't have $this, but can access private members of the surrounding class.
Description
The following test:
passes for:
but fails when
opcache.enable_cli=1
:with the following output:
PHP Version
Operating System
No response
The text was updated successfully, but these errors were encountered: