diff --git a/lib/Cake/Model/ModelValidator.php b/lib/Cake/Model/ModelValidator.php index 24a453b53..17f402649 100644 --- a/lib/Cake/Model/ModelValidator.php +++ b/lib/Cake/Model/ModelValidator.php @@ -31,6 +31,7 @@ * @package Cake.Model * @link https://book.cakephp.org/2.0/en/data-validation.html */ +#[\AllowDynamicProperties] class ModelValidator implements ArrayAccess, IteratorAggregate, Countable { /** diff --git a/lib/Cake/Network/Http/HttpSocket.php b/lib/Cake/Network/Http/HttpSocket.php index 624b97a25..a02d71db5 100644 --- a/lib/Cake/Network/Http/HttpSocket.php +++ b/lib/Cake/Network/Http/HttpSocket.php @@ -720,7 +720,7 @@ protected function _buildUri($uri = array(), $uriTemplate = '%scheme://%user:%pa return false; } - $uri['path'] = preg_replace('/^\//', null, $uri['path']); + $uri['path'] = preg_replace('/^\//', '', $uri['path']); $uri['query'] = http_build_query($uri['query'], '', '&'); $uri['query'] = rtrim($uri['query'], '='); $stripIfEmpty = array( @@ -732,16 +732,16 @@ protected function _buildUri($uri = array(), $uriTemplate = '%scheme://%user:%pa foreach ($stripIfEmpty as $key => $strip) { if (empty($uri[$key])) { - $uriTemplate = str_replace($strip, null, $uriTemplate); + $uriTemplate = str_replace($strip, '', $uriTemplate); } } $defaultPorts = array('http' => 80, 'https' => 443); if (array_key_exists($uri['scheme'], $defaultPorts) && $defaultPorts[$uri['scheme']] == $uri['port']) { - $uriTemplate = str_replace(':%port', null, $uriTemplate); + $uriTemplate = str_replace(':%port', '', $uriTemplate); } foreach ($uri as $property => $value) { - $uriTemplate = str_replace('%' . $property, $value, $uriTemplate); + $uriTemplate = str_replace('%' . $property, (string)$value, $uriTemplate); } if ($uriTemplate === '/*') { diff --git a/lib/Cake/Routing/Route/CakeRoute.php b/lib/Cake/Routing/Route/CakeRoute.php index 8149ce39a..0ac38d2bf 100644 --- a/lib/Cake/Routing/Route/CakeRoute.php +++ b/lib/Cake/Routing/Route/CakeRoute.php @@ -498,7 +498,7 @@ protected function _writeUrl($params) { } if (is_array($params['pass'])) { - $params['pass'] = implode('/', array_map('rawurlencode', $params['pass'])); + $params['pass'] = implode('/', array_map(fn($param) => rawurlencode((string)$param), $params['pass'])); } $namedConfig = Router::namedConfig();