-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix exception raised by
php_error_docref
that hangs the process in …
…hook (#127) * Use E_CORE_WARNING for logging * Add test, fix other tests --------- Co-authored-by: Brett McBride <[email protected]>
- Loading branch information
1 parent
a113718
commit dec47b1
Showing
8 changed files
with
43 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.idea | ||
.vscode/ | ||
*.tgz | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--TEST-- | ||
Check if exceptions thrown in hooks work if custom error handler throws | ||
--DESCRIPTION-- | ||
If the extension internally logs errors/warnings in a way that set_error_handler gets invoked, then any | ||
exceptions/errors may cause the process to crash or hang if raising a throwable was not safe at that moment. | ||
--EXTENSIONS-- | ||
opentelemetry | ||
--FILE-- | ||
<?php | ||
set_error_handler(function (int $errno, string $message) { | ||
throw new \Error('Throw from error handler: ' . $message); | ||
}); | ||
function helloWorld() { | ||
throw new \Error('test'); | ||
} | ||
\OpenTelemetry\Instrumentation\hook( | ||
null, | ||
'helloWorld', | ||
pre: static function () : void { | ||
throw new \Exception('pre'); | ||
} | ||
); | ||
helloWorld(); | ||
?> | ||
--EXPECTF-- | ||
Warning: helloWorld(): OpenTelemetry: pre hook threw exception, class=null function=helloWorld message=pre in %s | ||
|
||
Fatal error: Uncaught Error: test in %s | ||
Stack trace: | ||
#0 %s: helloWorld() | ||
#1 {main} | ||
thrown in %s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters