mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-07 01:03:31 +02:00
issue #1845 update Smarty from 4.1.0 to 4.3.1 (compat PHP 8.2)
This commit is contained in:
@@ -23,6 +23,12 @@ class Smarty_Internal_ErrorHandler
|
||||
*/
|
||||
public $allowUndefinedArrayKeys = true;
|
||||
|
||||
/**
|
||||
* Allows {$foo->bar} where bar is not an object (e.g. null or false).
|
||||
* @var bool
|
||||
*/
|
||||
public $allowDereferencingNonObjects = true;
|
||||
|
||||
private $previousErrorHandler = null;
|
||||
|
||||
/**
|
||||
@@ -66,17 +72,28 @@ class Smarty_Internal_ErrorHandler
|
||||
*/
|
||||
public function handleError($errno, $errstr, $errfile, $errline, $errcontext = [])
|
||||
{
|
||||
if ($this->allowUndefinedVars && $errstr == 'Attempt to read property "value" on null') {
|
||||
|
||||
if ($this->allowUndefinedVars && preg_match(
|
||||
'/^(Attempt to read property "value" on null|Trying to get property (\'value\' )?of non-object)/',
|
||||
$errstr
|
||||
)) {
|
||||
return; // suppresses this error
|
||||
}
|
||||
|
||||
if ($this->allowUndefinedArrayKeys && preg_match(
|
||||
'/^(Undefined array key|Trying to access array offset on value of type null)/',
|
||||
'/^(Undefined index|Undefined array key|Trying to access array offset on value of type)/',
|
||||
$errstr
|
||||
)) {
|
||||
return; // suppresses this error
|
||||
}
|
||||
|
||||
if ($this->allowDereferencingNonObjects && preg_match(
|
||||
'/^Attempt to read property ".+?" on/',
|
||||
$errstr
|
||||
)) {
|
||||
return; // suppresses this error
|
||||
}
|
||||
|
||||
// pass all other errors through to the previous error handler or to the default PHP error handler
|
||||
return $this->previousErrorHandler ?
|
||||
call_user_func($this->previousErrorHandler, $errno, $errstr, $errfile, $errline, $errcontext) : false;
|
||||
|
||||
Reference in New Issue
Block a user