-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpKernel] Deprecate passing objects as URI attributes to the ESI and SSI renderers #17611
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,10 @@ public function __construct(SurrogateInterface $surrogate = null, FragmentRender | |
public function render($uri, Request $request, array $options = array()) | ||
{ | ||
if (!$this->surrogate || !$this->surrogate->hasSurrogateCapability($request)) { | ||
if ($uri instanceof ControllerReference && $this->containsNonScalars($uri->attributes)) { | ||
@trigger_error('Passing objects as part of URI attributes to the ESI and SSI rendering strategies is deprecated since version 3.1, and will be removed in 4.0. Use a different rendering strategy or pass scalar values.', E_USER_DEPRECATED); | ||
} | ||
|
||
return $this->inlineStrategy->render($uri, $request, $options); | ||
} | ||
|
||
|
@@ -92,4 +96,17 @@ private function generateSignedFragmentUri($uri, Request $request) | |
|
||
return substr($fragmentUri, strlen($request->getSchemeAndHttpHost())); | ||
} | ||
|
||
private function containsNonScalars(array $values) | ||
{ | ||
foreach ($values as $value) { | ||
if (is_array($value) && $this->containsNonScalars($value)) { | ||
return true; | ||
} elseif (!is_scalar($value) && null !== $value) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @stloyd actually, the code wasn't looking deep enough. I updated the test and the condition. Now the elseif is required. |
||
return true; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
} |
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.
missing entry about the removal in the
UPGRADE-4.0.md
fileThere 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.
It's not removed yet :)