Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 148 Revision 991
Zeile 21... Zeile 21...
21
     * Allows {$foo.bar} where bar is unset and {$foo.bar1.bar2} where either bar1 or bar2 is unset.
21
     * Allows {$foo.bar} where bar is unset and {$foo.bar1.bar2} where either bar1 or bar2 is unset.
22
     * @var bool
22
     * @var bool
23
     */
23
     */
24
    public $allowUndefinedArrayKeys = true;
24
    public $allowUndefinedArrayKeys = true;
Zeile -... Zeile 25...
-
 
25
 
-
 
26
    /**
-
 
27
     * Allows {$foo->bar} where bar is not an object (e.g. null or false).
-
 
28
     * @var bool
-
 
29
     */
-
 
30
    public $allowDereferencingNonObjects = true;
25
 
31
 
Zeile 26... Zeile 32...
26
    private $previousErrorHandler = null;
32
    private $previousErrorHandler = null;
27
 
33
 
28
    /**
34
    /**
Zeile 64... Zeile 70...
64
     *
70
     *
65
     * @return bool
71
     * @return bool
66
     */
72
     */
67
    public function handleError($errno, $errstr, $errfile, $errline, $errcontext = [])
73
    public function handleError($errno, $errstr, $errfile, $errline, $errcontext = [])
68
    {
74
    {
-
 
75
 
69
        if ($this->allowUndefinedVars && $errstr == 'Attempt to read property "value" on null') {
76
        if ($this->allowUndefinedVars && preg_match(
-
 
77
                '/^(Attempt to read property "value" on null|Trying to get property (\'value\' )?of non-object)/',
-
 
78
                $errstr
-
 
79
            )) {
70
            return; // suppresses this error
80
            return; // suppresses this error
71
        }
81
        }
Zeile 72... Zeile 82...
72
 
82
 
73
        if ($this->allowUndefinedArrayKeys && preg_match(
83
        if ($this->allowUndefinedArrayKeys && preg_match(
74
            '/^(Undefined array key|Trying to access array offset on value of type null)/',
84
            '/^(Undefined index|Undefined array key|Trying to access array offset on value of type)/',
75
            $errstr
85
            $errstr
76
        )) {
86
        )) {
77
            return; // suppresses this error
87
            return; // suppresses this error
Zeile -... Zeile 88...
-
 
88
        }
-
 
89
 
-
 
90
        if ($this->allowDereferencingNonObjects && preg_match(
-
 
91
                '/^Attempt to read property ".+?" on/',
-
 
92
                $errstr
-
 
93
            )) {
-
 
94
            return; // suppresses this error
78
        }
95
        }
79
 
96
 
80
        // pass all other errors through to the previous error handler or to the default PHP error handler
97
        // pass all other errors through to the previous error handler or to the default PHP error handler
81
        return $this->previousErrorHandler ?
98
        return $this->previousErrorHandler ?
82
            call_user_func($this->previousErrorHandler, $errno, $errstr, $errfile, $errline, $errcontext) : false;
99
            call_user_func($this->previousErrorHandler, $errno, $errstr, $errfile, $errline, $errcontext) : false;