[php-src] Issue #7771: Incorrect file/line blamed for errors caused by `new SomeClass`
| From: | iluuu1994 | Date: | Sat, 05 Feb 2022 12:13:54 +0000 |
| Subject: | [php-src] Issue #7771: Incorrect file/line blamed for errors caused by `new SomeClass` | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-239498@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7771
Comment Author: iluuu1994
I created a small POC here. https://github.com/php/php-src/compare/master...iluuu1994:gh-7771?expand=1
The approach in the PR is to simply replace filename/lineno in the exception, similar to
ErrorException. Since there are tons paths for throwing errors in constant expressions
I avoided passing the name/lineno by storing it in the execution globals.
Unfortunately the lineno in the AST somewhere. I'm still trying to figure out why. Let me know
if this approach is ok before I spend too much time on this.