PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
← All changes | vendor_prefixed/guzzlehttp/psr7/src/Query.php +18 -2 27.6 → trunk View file →
@@ -90,9 +90,9 @@
90 90 foreach ($params as $k => $v) {
91 91 $k = $encoder((string) $k);
92 92 if (!\is_array($v)) {
93 93 $qs .= $k;
94 - $v = \is_bool($v) ? $castBool($v) : $v;
94 + $v = \is_bool($v) ? $castBool($v) : self::normalizeNonFiniteFloat($v);
95 95 if ($v !== null) {
96 96 $qs .= '=' . $encoder((string) $v);
97 97 }
98 98 $qs .= '&';
@@ -98,9 +98,9 @@
98 98 $qs .= '&';
99 99 } else {
100 100 foreach ($v as $vv) {
101 101 $qs .= $k;
102 - $vv = \is_bool($vv) ? $castBool($vv) : $vv;
102 + $vv = \is_bool($vv) ? $castBool($vv) : self::normalizeNonFiniteFloat($vv);
103 103 if ($vv !== null) {
104 104 $qs .= '=' . $encoder((string) $vv);
105 105 }
106 106 $qs .= '&';
@@ -107,6 +107,22 @@
107 107 }
108 108 }
109 109 }
110 110 return $qs ? (string) \substr($qs, 0, -1) : '';
111 + }
112 + /**
113 + * Converts non-finite floats to the strings PHP coerces them to, as
114 + * implicit coercion of NAN emits a warning on PHP 8.5.
115 + *
116 + * @param mixed $value
117 + *
118 + * @return mixed
119 + */
120 + private static function normalizeNonFiniteFloat($value)
121 + {
122 + if (\is_float($value) && !\is_finite($value)) {
123 + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/psr7', '2.12', 'Passing a non-finite float to Query::build() is deprecated; guzzlehttp/psr7 3.0 rejects non-finite floats.');
124 + return \is_nan($value) ? 'NAN' : ($value > 0 ? 'INF' : '-INF');
125 + }
126 + return $value;
111 127 }
112 128 }