Skip to content
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

Wrong start loc when using nullsafeoperator ?-> #1128

Open
abdul-alhasany opened this issue Jul 25, 2023 · 0 comments
Open

Wrong start loc when using nullsafeoperator ?-> #1128

abdul-alhasany opened this issue Jul 25, 2023 · 0 comments

Comments

@abdul-alhasany
Copy link

Hi
The parser seems to provide wrong start loc when using nullsafeoperator.

Example:

<?php
$test = $object?->property;

The example will give this loc:

start: {
   line: 2,
   column: 15, // should be 8
   offset: 21, // should be 14
},
end: {
   line: 2,
   column: 26,
   offset: 32
}

only start.column and start.offset provide the wrong position, the rest of the details are correct.

When removing the operator ? the position details are correct.

abdul-alhasany added a commit to kalimahapps/taqwim that referenced this issue Jul 25, 2023
The parser have an issue when using nullsafeoperator, so this commit
fixes this issue.

glayzzle/php-parser#1128
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

No branches or pull requests

1 participant