diff --git a/lib/Cake/Routing/Route/CakeRoute.php b/lib/Cake/Routing/Route/CakeRoute.php index 85dbb59c9..8149ce39a 100644 --- a/lib/Cake/Routing/Route/CakeRoute.php +++ b/lib/Cake/Routing/Route/CakeRoute.php @@ -470,7 +470,8 @@ class CakeRoute { //check patterns for routed params if (!empty($this->options)) { foreach ($this->options as $key => $pattern) { - if (array_key_exists($key, $url) && !preg_match('#^' . $pattern . '$#', $url[$key])) { + //Fixing deprecation notice about null $subject in PHP8.1. + if (array_key_exists($key, $url) && !preg_match('#^' . $pattern . '$#', $url[$key] ?? "")) { return false; } }