elastic / apm-agent-php

Apache License 2.0
252 stars 69 forks source link

Elastic APM PHP agent causes segmentation fault when handling errors #1077

Closed intuibase closed 10 months ago

intuibase commented 11 months ago

Describe the bug Agent crashes application when handling errors.

To Reproduce call following script:

<?php

$filename = __DIR__."/highlight_file.dat";

var_dump(highlight_file($filename));

var_dump(highlight_file('data:,<?php echo "test"; ?>'));

var_dump(highlight_file('data:,<?php echo "test ?>'));

$data = '
<?php
class test {
    public $var = 1;
    private function foo() { echo "foo"; }
    public function bar() { var_dump(test::foo()); }
}
?>';

file_put_contents($filename, $data);
var_dump(highlight_file($filename));

@unlink($filename);
echo "Done\n";
?>

Expected behavior Run without crash