verify exists index 0 in $ref

exemple

i have to get the referrer url from any page if exists

```
class AppController extends Controller {
......
    public function beforeRender() {
        parent::beforeRender();
        $this->params['referer'] = $this->referer(null, true);
    }
..........
}
```
This commit is contained in:
phlyper 2016-02-26 22:39:48 +01:00
parent 1709f54e38
commit 7b9ff1c11b

View file

@ -448,7 +448,7 @@ class CakeRequest implements ArrayAccess {
if (!empty($ref) && !empty($base)) {
if ($local && strpos($ref, $base) === 0) {
$ref = substr($ref, strlen($base));
if ($ref[0] !== '/') {
if (isset($ref[0]) && $ref[0] !== '/') {
$ref = '/' . $ref;
}
return $ref;