Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Routing] fix conflict with param named class in attribute#40244
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
[Routing] fix conflict with param named class in attribute#40244
Uh oh!
There was an error while loading.Please reload this page.
Conversation
carsonbot commentedFeb 18, 2021
Hey! I see that this is your first PR. That is great! Welcome! Symfony has acontribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
nicolas-grekas commentedFeb 18, 2021
Can you please rebase+retarget on 5.2 if that's really the target? |
9d6129b to0c77083Comparenlhommet commentedFeb 18, 2021
Sorry it's my first PR, can you tell me how to correct my PR to be on 5.2? |
0c77083 to197843dComparenicolas-grekas commentedFeb 18, 2021
I force-pushed on your fork. |
derrabus commentedFeb 18, 2021
Are we sure that 4.4 is not affected? |
197843d toa6b2aaaComparenicolas-grekas commentedFeb 19, 2021
(now targetting 4.4) |
nlhommet commentedFeb 19, 2021
Tx for the help. |
nlhommet commentedFeb 19, 2021
I need to understand why it does not work in PHP7.1 on multiline Attributes |
src/Symfony/Component/Routing/Tests/Fixtures/Attributes/FooAttributes.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
nlhommet commentedFeb 19, 2021
I think there are tests that can only be done in PHP8. is not recognized as a valid instruction in PHP7.X. With |
nicolas-grekas commentedFeb 19, 2021
correct. You can add the |
derrabus commentedFeb 21, 2021
Thank you for working on this. However, I'm not convinced that bracket counting is the way we should fix this. We already have a piece of code in that file that handles incorrect diff --git a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php--- a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php(revision eeed8c8e847b81ea5d16685395e85a1df9077449)+++ b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php(date 1613917175487)@@ -100,20 +100,8 @@ $nsTokens[T_NAME_QUALIFIED] = true; }- $openBrackets = 0; for ($i = 0; isset($tokens[$i]); ++$i) { $token = $tokens[$i];- if (80000 <= \PHP_VERSION_ID) {- if (\T_ATTRIBUTE === ($token[0] ?? 0) || ($openBrackets > 0 && '[' === $token)) {- ++$openBrackets;- }- if ($openBrackets > 0 && ']' === $token) {- --$openBrackets;- }- if ($openBrackets > 0) {- continue;- }- } if (!isset($token[1])) { continue;@@ -146,6 +134,15 @@ break; } }+ for ($j = $i + 1; isset($tokens[$j]); ++$j) {+ if (':' === $tokens[$j]) {+ $skipClassToken = true;+ break;+ }+ if (!\in_array($tokens[$j][0], [\T_WHITESPACE, \T_DOC_COMMENT, \T_COMMENT])) {+ break;+ }+ } if (!$skipClassToken) { $class = true; |
nlhommet commentedFeb 22, 2021
With this test I check if the Normally it shouldn't have side effects |
derrabus left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Please make fabbot happy. Apart from that, I think we're good. Thank you for working on this issue.
c6432c8 to27e6348Compare27e6348 to27bba68Comparenicolas-grekas commentedFeb 22, 2021
Thank you@nlhommet. |
Uh oh!
There was an error while loading.Please reload this page.
Fix conflict with AnnotationFileLoader and class PHP8 Attribute with param named "class"