Error handlers' $context should be optional as it's deprecated

This commit is contained in:
Nicolas Grekas 2017-12-28 18:49:57 +01:00
parent 8a1a9f94d6
commit f4fcbcd3da
4 changed files with 4 additions and 4 deletions

View File

@ -82,7 +82,7 @@ class ResourceCheckerConfigCache implements ConfigCacheInterface
$time = filemtime($this->file);
$signalingException = new \UnexpectedValueException();
$prevUnserializeHandler = ini_set('unserialize_callback_func', '');
$prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context) use (&$prevErrorHandler, $signalingException) {
$prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = array()) use (&$prevErrorHandler, $signalingException) {
if (E_WARNING === $type && 'Class __PHP_Incomplete_Class has no unserializer' === $msg) {
throw $signalingException;
}

View File

@ -221,7 +221,7 @@ class NativeSessionStorage implements SessionStorageInterface
public function save()
{
// Register custom error handler to catch a possible failure warning during session write
set_error_handler(function ($errno, $errstr, $errfile, $errline, $errcontext) {
set_error_handler(function ($errno, $errstr, $errfile, $errline, $errcontext = array()) {
throw new ContextErrorException($errstr, $errno, E_WARNING, $errfile, $errline, $errcontext);
}, E_WARNING);

View File

@ -245,7 +245,7 @@ class PropertyAccessor implements PropertyAccessorInterface
/**
* @internal
*/
public static function handleError($type, $message, $file, $line, $context)
public static function handleError($type, $message, $file, $line, $context = array())
{
if (E_RECOVERABLE_ERROR === $type) {
self::throwInvalidArgumentException($message, debug_backtrace(false), 1);

View File

@ -195,7 +195,7 @@ abstract class AbstractCloner implements ClonerInterface
*/
public function cloneVar($var, $filter = 0)
{
$this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context) {
$this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = array()) {
if (E_RECOVERABLE_ERROR === $type || E_USER_ERROR === $type) {
// Cloner never dies
throw new \ErrorException($msg, 0, $type, $file, $line);