mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Tweak fix from #8359
This fixes a regression introduced in that change that we didn't previously have tests for. The issue fixed in #8359 was related to PHP7.0, whereas PHP5 didn't have an issue. Now both versions will work the same.
This commit is contained in:
parent
63de5ca4ea
commit
3ad68db5eb
2 changed files with 8 additions and 1 deletions
|
@ -448,7 +448,10 @@ class CakeRequest implements ArrayAccess {
|
|||
if (!empty($ref) && !empty($base)) {
|
||||
if ($local && strpos($ref, $base) === 0) {
|
||||
$ref = substr($ref, strlen($base));
|
||||
if (isset($ref[0]) && $ref[0] !== '/') {
|
||||
if (empty($ref)) {
|
||||
$ref = '/';
|
||||
}
|
||||
if ($ref[0] !== '/') {
|
||||
$ref = '/' . $ref;
|
||||
}
|
||||
return $ref;
|
||||
|
|
|
@ -742,6 +742,10 @@ class CakeRequestTest extends CakeTestCase {
|
|||
$result = $request->referer();
|
||||
$this->assertSame($result, '/');
|
||||
|
||||
$_SERVER['HTTP_REFERER'] = Configure::read('App.fullBaseUrl') . '/';
|
||||
$result = $request->referer(true);
|
||||
$this->assertSame($result, '/');
|
||||
|
||||
$_SERVER['HTTP_REFERER'] = Configure::read('App.fullBaseUrl') . '/some/path';
|
||||
$result = $request->referer(true);
|
||||
$this->assertSame($result, '/some/path');
|
||||
|
|
Loading…
Reference in a new issue