Skip to content

Commit f499613

Browse files
committed
tests: make ASAN repro use valid eval that throws
Replace the eval parse-error payload with valid PHP that throws an exception, and catch the exception at the call site. The ASAN SEGV in ddtrace backtrace collection still reproduces deterministically.
1 parent b18f218 commit f499613

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

tests/ext/sandbox/install_hook/internal_fake_closure_forced_parse_error_asan.phpt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,16 @@ $closure = (new ReflectionFunction("intval"))->getClosure();
1717
$closure,
1818
null,
1919
function () {
20-
// Force eval() error path (deterministic ASAN crash site).
21-
eval('class Broken {');
22-
23-
// Keep the hook installed; crash occurs during backtrace collection.
20+
eval('throw new \\Exception("boom");');
2421
},
2522
\DDTrace\HOOK_INSTANCE
2623
);
2724

28-
$closure(1);
25+
try {
26+
$closure(1);
27+
} catch (Throwable $e) {
28+
// ignore
29+
}
2930

3031
echo "ok\n";
3132
?>

0 commit comments

Comments
 (0)