-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Bug #18469: fix Link::serialize method #20020
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #20020 +/- ##
==========================================
- Coverage 48.02% 48.02% -0.01%
==========================================
Files 445 445
Lines 43890 43889 -1
==========================================
- Hits 21078 21077 -1
Misses 22812 22812 ☔ View full report in Codecov by Sentry. |
framework/web/Link.php
Outdated
@@ -66,7 +66,11 @@ public static function serialize(array $links) | |||
$link[$i] = $l instanceof self ? array_filter((array) $l) : ['href' => $l]; | |||
} | |||
$links[$rel] = $link; | |||
} elseif (!$link instanceof self) { | |||
} | |||
if ($link instanceof self) { |
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.
Let's refactor this method to a recursive call instead.
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.
Are you referring to line 66(or maybe the whole method)?
I'd replace the second loop with this recursive call $link = self::serialize($link);
in order to remove it
It is only me, or these test do not have sense at all? :P |
Yep, I can refactor the tests to avoid confusion. |
@bizley is it fine now? |
👍 |
Hi, I applied the fix proposed above with some unit tests. Hope it helps