diff --git a/src/Http/ServerRequest.php b/src/Http/ServerRequest.php index a3e4c9f330e..481ce967944 100644 --- a/src/Http/ServerRequest.php +++ b/src/Http/ServerRequest.php @@ -112,7 +112,7 @@ class ServerRequest implements ArrayAccess, ServerRequestInterface * The full address to the current request * * @var string - * @deprecated 3.4.0 This public property will be removed in 4.0.0. Use getUri()->getPath() instead. + * @deprecated 3.4.0 This public property will be removed in 4.0.0. Use getAttribute('here') or getUri()->getPath() instead. */ protected $here; @@ -2150,7 +2150,7 @@ public function getAttribute($name, $default = null) /** * Get all the attributes in the request. * - * This will include the params, webroot, and base attributes that CakePHP + * This will include the params, webroot, base, and here attributes that CakePHP * provides. * * @return array @@ -2160,7 +2160,8 @@ public function getAttributes() $emulated = [ 'params' => $this->params, 'webroot' => $this->webroot, - 'base' => $this->base + 'base' => $this->base, + 'here' => $this->here ]; return $this->attributes + $emulated; diff --git a/tests/TestCase/Http/ServerRequestTest.php b/tests/TestCase/Http/ServerRequestTest.php index 8c073b1a57b..d968e27dee2 100644 --- a/tests/TestCase/Http/ServerRequestTest.php +++ b/tests/TestCase/Http/ServerRequestTest.php @@ -3630,7 +3630,8 @@ public function testGetAttributes() 'pass' => [], ], 'webroot' => '', - 'base' => '' + 'base' => '', + 'here' => '/' ]; $this->assertEquals($expected, $new->getAttributes()); }