Skip to content

Wrong line number reported in case of a multiline parameter list #8810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
slapoguzov opened this issue Jun 17, 2022 · 1 comment
Closed

Wrong line number reported in case of a multiline parameter list #8810

slapoguzov opened this issue Jun 17, 2022 · 1 comment

Comments

@slapoguzov
Copy link

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

@iluuu1994
Copy link
Member

Has been like this for ages, so reclassifying as a feature request.

@iluuu1994 iluuu1994 self-assigned this Jun 17, 2022
iluuu1994 added a commit to iluuu1994/php-src that referenced this issue Jun 17, 2022
iluuu1994 added a commit to iluuu1994/php-src that referenced this issue Jun 17, 2022
iluuu1994 added a commit to iluuu1994/php-src that referenced this issue Jun 17, 2022
ptomulik added a commit to phptailors/phpunit-extensions that referenced this issue Nov 17, 2023
ptomulik added a commit to phptailors/phpunit-extensions that referenced this issue Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants