minor #25619 Error handlers' $context should be optional as it's deprecated (nicolas-grekas)
This PR was merged into the 3.3 branch.
Discussion
----------
Error handlers' $context should be optional as it's deprecated
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Commits
-------
f4fcbcd
Error handlers' $context should be optional as it's deprecated
This commit is contained in:
commit
205e8ee3d4
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user