Skip to content

Adjust filename/lineno for constant expressions #8124

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
wants to merge 2 commits into from

Conversation

iluuu1994
Copy link
Member

Closes GH-7771

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. Let me know if this approach is ok before I spend too much time on this.

@iluuu1994 iluuu1994 marked this pull request as draft February 20, 2022 11:16
@iluuu1994 iluuu1994 marked this pull request as ready for review February 20, 2022 19:34
iluuu1994 added a commit to iluuu1994/php-src that referenced this pull request Mar 4, 2022
@bwoebi
Copy link
Member

bwoebi commented Mar 8, 2022

Is there a particular reason, why you chose to explicitly provide an exception specific lineno, instead of feeding it into zend_get_executed_lineno and the file equivalents? (which exceptions read from)

@iluuu1994
Copy link
Member Author

@bwoebi What you're suggesting is returning EG(exception_filename)/EG(exception_lineno) from zend_get_executed_filename/zend_get_executed_lineno if they are set? No particular reason, I can adjust it.

@bwoebi
Copy link
Member

bwoebi commented Mar 8, 2022

essentially yes, just a more appropriate name, like EG(filename_override) EG(lineno_override) or such.

@iluuu1994
Copy link
Member Author

@bwoebi Done

Copy link
Member

@bwoebi bwoebi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect file/line blamed for errors caused by new SomeClass
3 participants