-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
calling die or exit directly lead to segfault (#55)
* calling die or exit directly lead to segfault * pre hook not needed
- Loading branch information
Showing
2 changed files
with
43 additions
and
2 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
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,39 @@ | ||
--TEST-- | ||
Check if calling die or exit will finish gracefully | ||
--EXTENSIONS-- | ||
opentelemetry | ||
--FILE-- | ||
|
||
<?php | ||
|
||
use function OpenTelemetry\Instrumentation\hook; | ||
|
||
class TestClass { | ||
public static function countFunction(): void | ||
{ | ||
for ($i = 1; $i <= 300; $i++) { | ||
if ($i === 200) { | ||
die('exit!'); | ||
} | ||
} | ||
} | ||
} | ||
|
||
hook( | ||
'TestClass', | ||
'countFunction', | ||
null, | ||
post: static function ($object, array $params, mixed $ret, ?\Throwable $exception ) {} | ||
); | ||
|
||
try{ | ||
TestClass::countFunction(); | ||
} | ||
catch(Exception) {} | ||
// Comment out line below and revert fix in order to trigger segfault | ||
// reproduction frequency depends on platform | ||
catch(TypeError) {} | ||
?> | ||
|
||
--EXPECT-- | ||
exit! |