Closed gnumoksha closed 10 months ago
Which PHP version are you running this on? Hooking internal functions (such as those provided by an extension) is only supported on PHP 8.2+.
Which PHP version are you running this on? Hooking internal functions (such as those provided by an extension) is only supported on PHP 8.2+.
8.1. I'm working on updating the version.
It worked, thank you
Is the exception catch expected to work in the post hook, @agoallikmaa?
Pre and post hooks are not expected to throw exceptions - if they do, it will be logged and discarded (as of 1.0.1beta2). If the function being hooked throws an exception, then that exception is available in the post hook.
I've tested throwing an exception in a controller, called by the hooked method, and the post hook didn't receive the exception. Instrumenting a PHP code works as expected (i.e. it receives the exception).
That should definitely work: https://github.com/open-telemetry/opentelemetry-php-instrumentation/blob/main/ext/tests/007.phpt (the exception will be the 4th parameter to the post hook).
I'm trying to create an instrumentation code for the phalcon framework, which is a PHP extension, but the hook never works.