-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix GH-13712: Segmentation fault for enabled observers when calling trait method of internal trait when opcache is loaded #13735
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--TEST-- | ||
GH-13712 (Segmentation fault for enabled observers when calling trait method of internal trait when opcache is loaded) | ||
--EXTENSIONS-- | ||
opcache | ||
zend_test | ||
--INI-- | ||
zend_test.observer.enabled=1 | ||
opcache.enable=1 | ||
opcache.enable_cli=1 | ||
--FILE-- | ||
<?php | ||
class Foo { | ||
use _ZendTestTrait; | ||
} | ||
|
||
$f = new Foo(); | ||
var_dump($f->testMethod()); | ||
?> | ||
--EXPECTF-- | ||
<!-- init '%s' --> | ||
<!-- init Foo::testMethod() --> | ||
<!-- init var_dump() --> | ||
bool(true) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -726,7 +726,7 @@ static void zend_persist_class_method(zval *zv, zend_class_entry *ce) | |
} | ||
// Real dynamically created internal functions like enum methods must have their own run_time_cache pointer. They're always on the same scope as their defining class. | ||
// However, copies - as caused by inheritance of internal methods - must retain the original run_time_cache pointer, shared with the source function. | ||
if (!op_array->scope || op_array->scope == ce) { | ||
if (!op_array->scope || (op_array->scope == ce && !(op_array->fn_flags & ZEND_ACC_TRAIT_CLONE))) { | ||
ZEND_MAP_PTR_NEW(op_array->run_time_cache); | ||
Comment on lines
-729
to
730
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Internal functions use the run time cache to cache installed observers. |
||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks right.