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

Fix segfault by checking observer_class_lookup for NULL in observer callback #102

Merged
merged 2 commits into from
Oct 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ext/otel_observer.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,15 @@ static otel_observer *resolve_observer(zend_execute_data *execute_data) {

static zend_observer_fcall_handlers
observer_fcall_init(zend_execute_data *execute_data) {
// This means that either RINIT has not yet been called, or RSHUTDOWN has
// already been called. The former can happen if another extension that is
// loaded before this one invokes PHP functions in its RINIT. The latter
// can happen if a header callback is set or when another extension invokes
// PHP functions in their RSHUTDOWN.
if (OTEL_G(observer_class_lookup) == NULL) {
return (zend_observer_fcall_handlers){NULL, NULL};
}

if (op_array_extension == -1) {
return (zend_observer_fcall_handlers){NULL, NULL};
}
Expand Down