diff --git a/src/Http/ServerRequest.php b/src/Http/ServerRequest.php index 175d353193c..a3e4c9f330e 100644 --- a/src/Http/ServerRequest.php +++ b/src/Http/ServerRequest.php @@ -196,7 +196,7 @@ class ServerRequest implements ArrayAccess, ServerRequestInterface * * @var array */ - protected $emulatedAttributes = ['session', 'webroot', 'base', 'params']; + protected $emulatedAttributes = ['session', 'webroot', 'base', 'params', 'here']; /** * Array of Psr\Http\Message\UploadedFileInterface objects. diff --git a/tests/TestCase/Http/ServerRequestTest.php b/tests/TestCase/Http/ServerRequestTest.php index d33da3fd686..8c073b1a57b 100644 --- a/tests/TestCase/Http/ServerRequestTest.php +++ b/tests/TestCase/Http/ServerRequestTest.php @@ -3590,6 +3590,7 @@ public function testGetAttributesCompatibility($prop) 'controller' => 'Articles', 'action' => 'index' ], + 'url' => '/articles/view', 'base' => '/cakeapp', 'webroot' => '/cakeapp/' ]); @@ -3597,6 +3598,7 @@ public function testGetAttributesCompatibility($prop) if ($prop === 'session') { $this->assertSame($request->getSession(), $request->getAttribute($prop)); } else { + $this->assertNotEmpty($request->getAttribute($prop)); $this->assertSame($request->{$prop}, $request->getAttribute($prop)); } }); @@ -3733,6 +3735,7 @@ public function testGetEnv() public function emulatedPropertyProvider() { return [ + ['here'], ['params'], ['base'], ['webroot'],