Closed
Description
Description
PHP reports the wrong line number in stacktrace in case of a multiline parameter list, for example:
<?php
function test()
{
myAssert( //this line is expected to be reported
false,
"message" //this line will be reported
);
}
function myAssert($a, $b)
{
if(!$a) throw new ErrorException($b);
}
test();
The following stacktrace will be reported:
0.0001 394432 1. {main}() /Users/Aleksandr.Slapoguzov/PhpstormProjects/test/test2.php:0
0.0001 394432 2. test() /Users/Aleksandr.Slapoguzov/PhpstormProjects/test/test2.php:16
0.0001 394432 3. myAssert($a = FALSE, $b = 'message') /Users/Aleksandr.Slapoguzov/PhpstormProjects/test/test2.php:7
But I expected this output instead:
0.0001 394432 1. {main}() /Users/Aleksandr.Slapoguzov/PhpstormProjects/test/test2.php:0
0.0001 394432 2. test() /Users/Aleksandr.Slapoguzov/PhpstormProjects/test/test2.php:16
0.0001 394432 3. myAssert($a = FALSE, $b = 'message') /Users/Aleksandr.Slapoguzov/PhpstormProjects/test/test2.php:5
Although the 7th line is part of the failed function call, it would be better to report the 5th line.
PHP Version
PHP 8.1.0
Operating System
MacOS