comparison vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 1fec387a4317
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
57 * Note, that not all surrogate strategies support all options. For now 57 * Note, that not all surrogate strategies support all options. For now
58 * 'alt' and 'comment' are only supported by ESI. 58 * 'alt' and 'comment' are only supported by ESI.
59 * 59 *
60 * @see Symfony\Component\HttpKernel\HttpCache\SurrogateInterface 60 * @see Symfony\Component\HttpKernel\HttpCache\SurrogateInterface
61 */ 61 */
62 public function render($uri, Request $request, array $options = array()) 62 public function render($uri, Request $request, array $options = [])
63 { 63 {
64 if (!$this->surrogate || !$this->surrogate->hasSurrogateCapability($request)) { 64 if (!$this->surrogate || !$this->surrogate->hasSurrogateCapability($request)) {
65 if ($uri instanceof ControllerReference && $this->containsNonScalars($uri->attributes)) { 65 if ($uri instanceof ControllerReference && $this->containsNonScalars($uri->attributes)) {
66 @trigger_error('Passing non-scalar values as part of URI attributes to the ESI and SSI rendering strategies is deprecated since Symfony 3.1, and will be removed in 4.0. Use a different rendering strategy or pass scalar values.', E_USER_DEPRECATED); 66 @trigger_error('Passing non-scalar values as part of URI attributes to the ESI and SSI rendering strategies is deprecated since Symfony 3.1, and will be removed in 4.0. Use a different rendering strategy or pass scalar values.', E_USER_DEPRECATED);
67 } 67 }
90 } 90 }
91 91
92 // we need to sign the absolute URI, but want to return the path only. 92 // we need to sign the absolute URI, but want to return the path only.
93 $fragmentUri = $this->signer->sign($this->generateFragmentUri($uri, $request, true)); 93 $fragmentUri = $this->signer->sign($this->generateFragmentUri($uri, $request, true));
94 94
95 return substr($fragmentUri, strlen($request->getSchemeAndHttpHost())); 95 return substr($fragmentUri, \strlen($request->getSchemeAndHttpHost()));
96 } 96 }
97 97
98 private function containsNonScalars(array $values) 98 private function containsNonScalars(array $values)
99 { 99 {
100 foreach ($values as $value) { 100 foreach ($values as $value) {
101 if (is_array($value)) { 101 if (\is_array($value)) {
102 return $this->containsNonScalars($value); 102 return $this->containsNonScalars($value);
103 } elseif (!is_scalar($value) && null !== $value) { 103 } elseif (!is_scalar($value) && null !== $value) {
104 return true; 104 return true;
105 } 105 }
106 } 106 }