From 2f1f34952e9a0dfb3adcbec82ba69f4ac82b3a3d Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 30 Jan 2019 15:54:35 +0100 Subject: [PATCH] Remove $errcontext argument to error handlers I'm removing the argument entirely here, but we might want to change this to passing null or and empty array instead, if the impact of dropping it entirely turns out to be too large. This was deprecated as part of https://wiki.php.net/rfc/deprecations_php_7_2 as a doc-only deprecation. --- UPGRADING | 1 + Zend/tests/bug29890.phpt | 2 +- Zend/tests/bug29896.phpt | 4 ++-- Zend/tests/bug35017.phpt | 2 +- Zend/tests/bug41209.phpt | 2 +- Zend/tests/bug45805.phpt | 2 +- Zend/tests/bug48004.phpt | 2 +- Zend/tests/bug51394.phpt | 2 +- Zend/tests/bug60909_1.phpt | 2 +- Zend/tests/bug61767.phpt | 2 +- Zend/tests/bug64960.phpt | 2 +- Zend/tests/bug69388.phpt | 2 +- Zend/tests/bug69388_2.phpt | 2 +- Zend/tests/bug72057.phpt | 2 +- Zend/tests/bug72101.phpt | 2 +- Zend/tests/bug76025.phpt | 2 +- Zend/tests/bug76534.phpt | 2 +- Zend/tests/nowdoc_015.phpt | 2 +- Zend/zend.c | 15 ++------------- ext/iconv/tests/iconv_mime_decode.phpt | 2 +- ext/iconv/tests/iconv_mime_encode.phpt | 2 +- ext/iconv/tests/iconv_strpos.phpt | 2 +- ext/iconv/tests/iconv_strrpos.phpt | 2 +- ext/mbstring/tests/common.inc | 2 +- .../tests/mb_substitute_character_variation1.phpt | 2 +- ext/posix/tests/posix_ttyname_variation6.phpt | 2 +- ext/spl/tests/class_implements_variation1.phpt | 2 +- ext/spl/tests/class_uses_variation1.phpt | 2 +- .../array/array_diff_uassoc_variation14.phpt | 2 +- .../tests/array/array_diff_ukey_variation11.phpt | 2 +- .../array/array_intersect_uassoc_variation11.phpt | 2 +- .../array/array_intersect_ukey_variation10.phpt | 2 +- .../tests/array/array_multisort_variation1.phpt | 2 +- .../tests/array/array_multisort_variation2.phpt | 2 +- .../tests/array/array_multisort_variation3.phpt | 2 +- .../tests/array/array_multisort_variation8.phpt | 2 +- .../get_class_methods_variation_001.phpt | 2 +- .../get_parent_class_variation_002.phpt | 2 +- .../is_subclass_of_variation_001.phpt | 2 +- .../is_subclass_of_variation_004.phpt | 2 +- .../class_object/method_exists_variation_001.phpt | 2 +- .../tests/file/file_put_contents_variation2.phpt | 2 +- .../tests/file/file_put_contents_variation3.phpt | 2 +- .../general_functions/intval_variation1.phpt | 2 +- .../tests/image/getimagesize_variation2.phpt | 2 +- tests/classes/tostring_004.phpt | 2 +- tests/lang/bug25547.phpt | 2 +- 47 files changed, 49 insertions(+), 59 deletions(-) diff --git a/UPGRADING b/UPGRADING index a4b390f5f7..b7da98efea 100644 --- a/UPGRADING +++ b/UPGRADING @@ -34,6 +34,7 @@ PHP 8.0 UPGRADE NOTES interpreted as strings. . Removed ability to specify an autoloader using an __autoload() function. spl_autoload_register() should be used instead. + . Removed the $errcontext argument for custom error handlers. . Removed create_function(). Anonymous functions may be used instead. . Removed each(). foreach or ArrayIterator should be used instead. . Removed ability to unbind $this from closures that were created from a diff --git a/Zend/tests/bug29890.phpt b/Zend/tests/bug29890.phpt index 1fdcdc4291..6f1e874882 100644 --- a/Zend/tests/bug29890.phpt +++ b/Zend/tests/bug29890.phpt @@ -2,7 +2,7 @@ Bug #29890 (crash if error handler fails) --FILE-- --EXPECTF-- -#0 userErrorHandler(8, Undefined variable: b, %sbug29896.php, 11, Array ([A1] => Test1)) called at [%sbug29896.php:11] +#0 userErrorHandler(8, Undefined variable: b, %sbug29896.php, 11) called at [%sbug29896.php:11] #1 GenerateError1(Test1) called at [%sbug29896.php:16] #2 GenerateError2(Test2) called at [%sbug29896.php:19] diff --git a/Zend/tests/bug35017.phpt b/Zend/tests/bug35017.phpt index 9944df55e0..8a747be7e1 100644 --- a/Zend/tests/bug35017.phpt +++ b/Zend/tests/bug35017.phpt @@ -13,7 +13,7 @@ try { } catch(Exception $e) { echo "This Exception should be caught\n"; } -function errorHandler($errno, $errstr, $errfile, $errline, $vars) { +function errorHandler($errno, $errstr, $errfile, $errline) { throw new Exception('Some Exception'); } ?> diff --git a/Zend/tests/bug41209.phpt b/Zend/tests/bug41209.phpt index 3924f99ac8..f61df73d20 100644 --- a/Zend/tests/bug41209.phpt +++ b/Zend/tests/bug41209.phpt @@ -41,6 +41,6 @@ echo "Done\n"; --EXPECTF-- Fatal error: Uncaught ErrorException: Undefined variable: id in %s:%d Stack trace: -#0 %s(%d): env::errorHandler(8, '%s', '%s', 34, Array) +#0 %s(%d): env::errorHandler(8, '%s', '%s', 34) #1 {main} thrown in %s on line %d diff --git a/Zend/tests/bug45805.phpt b/Zend/tests/bug45805.phpt index d63e658868..86cea70373 100644 --- a/Zend/tests/bug45805.phpt +++ b/Zend/tests/bug45805.phpt @@ -38,7 +38,7 @@ $o->bar(); --EXPECTF-- Fatal error: Uncaught RuntimeException in %sbug45805.php:%d Stack trace: -#0 %sbug45805.php(%d): PHPUnit_Util_ErrorHandler::handleError(8, 'Only variables ...', '%s', %d, Array) +#0 %sbug45805.php(%d): PHPUnit_Util_ErrorHandler::handleError(8, 'Only variables ...', '%s', %d) #1 [internal function]: B->foo() #2 %sbug45805.php(%d): ReflectionMethod->invoke(Object(B)) #3 %sbug45805.php(%d): B->bar() diff --git a/Zend/tests/bug48004.phpt b/Zend/tests/bug48004.phpt index 5968876520..c8dd0b3880 100644 --- a/Zend/tests/bug48004.phpt +++ b/Zend/tests/bug48004.phpt @@ -2,7 +2,7 @@ Bug #48004 (Error handler prevents creation of default object) --FILE-- __invoke(Object(Exception)) #3 {main} diff --git a/Zend/tests/bug69388.phpt b/Zend/tests/bug69388.phpt index bf0c0a3c39..3846cca4ca 100644 --- a/Zend/tests/bug69388.phpt +++ b/Zend/tests/bug69388.phpt @@ -3,7 +3,7 @@ Bug #69388: Use after free on recursive calls to PHP compiler --FILE-- bar($a, $b, $c); --EXPECTF-- Fatal error: Uncaught Error: Class 'DoesNotExists' not found in %sbug72101.php:61 Stack trace: -#0 %sbug72101.php(8): {closure}(2, 'Parameter 1 to ...', '%s', 8, Array) +#0 %sbug72101.php(8): {closure}(2, 'Parameter 1 to ...', '%s', 8) #1 %sbug72101.php(27): PHPUnit_Framework_MockObject_Stub_ReturnCallback->invoke(Object(PHPUnit_Framework_MockObject_Invocation_Static)) #2 %sbug72101.php(19): PHPUnit_Framework_MockObject_Matcher->invoked(Object(PHPUnit_Framework_MockObject_Invocation_Static)) #3 %sbug72101.php(52): PHPUnit_Framework_MockObject_InvocationMocker->invoke(Object(PHPUnit_Framework_MockObject_Invocation_Static)) diff --git a/Zend/tests/bug76025.phpt b/Zend/tests/bug76025.phpt index 2619984d1e..c7958bd60e 100644 --- a/Zend/tests/bug76025.phpt +++ b/Zend/tests/bug76025.phpt @@ -13,6 +13,6 @@ $c = $b[$a]; --EXPECTF-- Fatal error: Uncaught Exception: blah in %sbug76025.php:%d Stack trace: -#0 %sbug76025.php(%d): handleError(8, 'Undefined varia...', '%s', %d, Array) +#0 %sbug76025.php(%d): handleError(8, 'Undefined varia...', '%s', %d) #1 {main} thrown in %sbug76025.php on line %d diff --git a/Zend/tests/bug76534.phpt b/Zend/tests/bug76534.phpt index 956a29ba2c..457d09f400 100644 --- a/Zend/tests/bug76534.phpt +++ b/Zend/tests/bug76534.phpt @@ -12,6 +12,6 @@ $y = &$x["bar"]; --EXPECTF-- Fatal error: Uncaught Exception: Illegal string offset 'bar' in %sbug76534.php:%d Stack trace: -#0 %sbug76534.php(%d): {closure}(2, 'Illegal string ...', '%s', %d, Array) +#0 %sbug76534.php(%d): {closure}(2, 'Illegal string ...', '%s', %d) #1 {main} thrown in %sbug76534.php on line %d diff --git a/Zend/tests/nowdoc_015.phpt b/Zend/tests/nowdoc_015.phpt index 9eb83bd063..56de362dd5 100644 --- a/Zend/tests/nowdoc_015.phpt +++ b/Zend/tests/nowdoc_015.phpt @@ -2,7 +2,7 @@ Test nowdoc and line numbering --FILE-- 1, 'red' => 2, 'green' => 3, 'purple' => 4); $array3 = array(1, 2, 3, 4, 5); // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { if (error_reporting() != 0) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation11.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation11.phpt index fe9a17983f..a39bac2e54 100644 --- a/ext/standard/tests/array/array_intersect_uassoc_variation11.phpt +++ b/ext/standard/tests/array/array_intersect_uassoc_variation11.phpt @@ -14,7 +14,7 @@ $array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); $array2 = array("a" => "green", "yellow", "red"); $array3 = array("a"=>"green", "brown"); // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { if (error_reporting() != 0) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; diff --git a/ext/standard/tests/array/array_intersect_ukey_variation10.phpt b/ext/standard/tests/array/array_intersect_ukey_variation10.phpt index ca70e5e78a..b5b6439be1 100644 --- a/ext/standard/tests/array/array_intersect_ukey_variation10.phpt +++ b/ext/standard/tests/array/array_intersect_ukey_variation10.phpt @@ -15,7 +15,7 @@ $array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); $array3 = array("a"=>"green", "cyan"); // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { if (error_reporting() != 0) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; diff --git a/ext/standard/tests/array/array_multisort_variation1.phpt b/ext/standard/tests/array/array_multisort_variation1.phpt index 9a33a270f1..4d7281b92b 100644 --- a/ext/standard/tests/array/array_multisort_variation1.phpt +++ b/ext/standard/tests/array/array_multisort_variation1.phpt @@ -11,7 +11,7 @@ Test array_multisort() function : usage variation echo "*** Testing array_multisort() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { if (error_reporting() != 0) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; diff --git a/ext/standard/tests/array/array_multisort_variation2.phpt b/ext/standard/tests/array/array_multisort_variation2.phpt index 8c26a8347b..994e27ecd0 100644 --- a/ext/standard/tests/array/array_multisort_variation2.phpt +++ b/ext/standard/tests/array/array_multisort_variation2.phpt @@ -11,7 +11,7 @@ Test array_multisort() function : usage variation echo "*** Testing array_multisort() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { if (error_reporting() != 0) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; diff --git a/ext/standard/tests/array/array_multisort_variation3.phpt b/ext/standard/tests/array/array_multisort_variation3.phpt index 28130e31fd..5939b7bef9 100644 --- a/ext/standard/tests/array/array_multisort_variation3.phpt +++ b/ext/standard/tests/array/array_multisort_variation3.phpt @@ -11,7 +11,7 @@ Test array_multisort() function : usage variation echo "*** Testing array_multisort() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { if (error_reporting() != 0) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; diff --git a/ext/standard/tests/array/array_multisort_variation8.phpt b/ext/standard/tests/array/array_multisort_variation8.phpt index 6d89dd0c6c..e6ff858b16 100644 --- a/ext/standard/tests/array/array_multisort_variation8.phpt +++ b/ext/standard/tests/array/array_multisort_variation8.phpt @@ -11,7 +11,7 @@ Test array_multisort() function : usage variation - test sort order of all types echo "*** Testing array_multisort() : usage variation - test sort order of all types***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { // We're testing sort order not errors so ignore. } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/class_object/get_class_methods_variation_001.phpt b/ext/standard/tests/class_object/get_class_methods_variation_001.phpt index 16a728e088..f3ab471b1f 100644 --- a/ext/standard/tests/class_object/get_class_methods_variation_001.phpt +++ b/ext/standard/tests/class_object/get_class_methods_variation_001.phpt @@ -9,7 +9,7 @@ Test get_class_methods() function : usage variations - unexpected types */ -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/class_object/get_parent_class_variation_002.phpt b/ext/standard/tests/class_object/get_parent_class_variation_002.phpt index 8dde525ae8..d331e9a0d1 100644 --- a/ext/standard/tests/class_object/get_parent_class_variation_002.phpt +++ b/ext/standard/tests/class_object/get_parent_class_variation_002.phpt @@ -12,7 +12,7 @@ spl_autoload_register(function ($className) { echo "In autoload($className)\n"; }); -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt index d65bfcbc26..e545616667 100644 --- a/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt +++ b/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt @@ -12,7 +12,7 @@ spl_autoload_register(function ($className) { echo "In autoload($className)\n"; }); -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt index 0a4c575258..3e5447308b 100644 --- a/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt +++ b/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt @@ -12,7 +12,7 @@ spl_autoload_register(function ($className) { echo "In autoload($className)\n"; }); -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/class_object/method_exists_variation_001.phpt b/ext/standard/tests/class_object/method_exists_variation_001.phpt index 4accebe20a..93497c34b1 100644 --- a/ext/standard/tests/class_object/method_exists_variation_001.phpt +++ b/ext/standard/tests/class_object/method_exists_variation_001.phpt @@ -12,7 +12,7 @@ spl_autoload_register(function ($className) { echo "In autoload($className)\n"; }); -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/file/file_put_contents_variation2.phpt b/ext/standard/tests/file/file_put_contents_variation2.phpt index ae56486d5f..1bf30340e4 100644 --- a/ext/standard/tests/file/file_put_contents_variation2.phpt +++ b/ext/standard/tests/file/file_put_contents_variation2.phpt @@ -13,7 +13,7 @@ Dave Kelsey echo "*** Testing file_put_contents() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { if (error_reporting() != 0) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; diff --git a/ext/standard/tests/file/file_put_contents_variation3.phpt b/ext/standard/tests/file/file_put_contents_variation3.phpt index 74130007a7..aaf18c0776 100644 --- a/ext/standard/tests/file/file_put_contents_variation3.phpt +++ b/ext/standard/tests/file/file_put_contents_variation3.phpt @@ -13,7 +13,7 @@ Dave Kelsey echo "*** Testing file_put_contents() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { if (error_reporting() != 0) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; diff --git a/ext/standard/tests/general_functions/intval_variation1.phpt b/ext/standard/tests/general_functions/intval_variation1.phpt index e76d7083d4..086161de6c 100644 --- a/ext/standard/tests/general_functions/intval_variation1.phpt +++ b/ext/standard/tests/general_functions/intval_variation1.phpt @@ -11,7 +11,7 @@ Test intval() function : usage variation echo "*** Testing intval() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { if (error_reporting() != 0) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; diff --git a/ext/standard/tests/image/getimagesize_variation2.phpt b/ext/standard/tests/image/getimagesize_variation2.phpt index eec2301c40..1bb515fe24 100644 --- a/ext/standard/tests/image/getimagesize_variation2.phpt +++ b/ext/standard/tests/image/getimagesize_variation2.phpt @@ -8,7 +8,7 @@ Test getimagesize() function : usage variations - unexpected type for arg 2 * Alias to functions: */ -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } set_error_handler('test_error_handler'); diff --git a/tests/classes/tostring_004.phpt b/tests/classes/tostring_004.phpt index 907f7bc306..6029938f32 100644 --- a/tests/classes/tostring_004.phpt +++ b/tests/classes/tostring_004.phpt @@ -2,7 +2,7 @@ Object to string conversion: error cases and behaviour variations. --FILE--