Skip to content

Commit

Permalink
Remove some mentions of RECOVERABLE_ERROR in tests
Browse files Browse the repository at this point in the history
Mostly drop error handlers that are no longer necessary.
  • Loading branch information
nikic committed Nov 15, 2018
1 parent 2766a8e commit 2fac9d9
Show file tree
Hide file tree
Showing 18 changed files with 23 additions and 142 deletions.
10 changes: 0 additions & 10 deletions Zend/tests/type_declarations/scalar_none.phpt
Expand Up @@ -3,16 +3,6 @@ Scalar type missing parameters
--FILE--
<?php

$errnames = [
E_NOTICE => 'E_NOTICE',
E_WARNING => 'E_WARNING',
E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR'
];
set_error_handler(function (int $errno, string $errmsg, string $file, int $line) use ($errnames) {
echo "$errnames[$errno]: $errmsg on line $line\n";
return true;
});

$functions = [
'int' => function (int $i) { return $i; },
'float' => function (float $f) { return $f; },
Expand Down
10 changes: 0 additions & 10 deletions Zend/tests/type_declarations/scalar_null.phpt
Expand Up @@ -3,16 +3,6 @@ Scalar type nullability
--FILE--
<?php

$errnames = [
E_NOTICE => 'E_NOTICE',
E_WARNING => 'E_WARNING',
E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR'
];
set_error_handler(function (int $errno, string $errmsg, string $file, int $line) use ($errnames) {
echo "$errnames[$errno]: $errmsg on line $line\n";
return true;
});

$functions = [
'int' => function (int $i) { return $i; },
'float' => function (float $f) { return $f; },
Expand Down
1 change: 0 additions & 1 deletion Zend/tests/type_declarations/scalar_return_basic.phpt
Expand Up @@ -8,7 +8,6 @@ Return scalar type basics
$errnames = [
E_NOTICE => 'E_NOTICE',
E_WARNING => 'E_WARNING',
E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR'
];
set_error_handler(function (int $errno, string $errmsg, string $file, int $line) use ($errnames) {
echo "$errnames[$errno]: $errmsg on line $line\n";
Expand Down
Expand Up @@ -8,7 +8,6 @@ Return scalar type basics
$errnames = [
E_NOTICE => 'E_NOTICE',
E_WARNING => 'E_WARNING',
E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR'
];
set_error_handler(function (int $errno, string $errmsg, string $file, int $line) use ($errnames) {
echo "$errnames[$errno]: $errmsg on line $line\n";
Expand Down
26 changes: 8 additions & 18 deletions Zend/tests/type_declarations/scalar_strict.phpt
Expand Up @@ -6,16 +6,6 @@ Scalar type strict mode
<?php
declare(strict_types=1);

$errnames = [
E_NOTICE => 'E_NOTICE',
E_WARNING => 'E_WARNING',
E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR'
];
set_error_handler(function (int $errno, string $errmsg, string $file, int $line) use ($errnames) {
echo "$errnames[$errno]: $errmsg on line $line\n";
return true;
});

$functions = [
'int' => function (int $i) { return $i; },
'float' => function (float $f) { return $f; },
Expand Down Expand Up @@ -106,11 +96,11 @@ int(2147483647)
}
*** Caught Argument 1 passed to {closure}() must be of the type int, array given, called in %s on line %d

*** Trying object(stdClass)#6 (0) {
*** Trying object(stdClass)#5 (0) {
}
*** Caught Argument 1 passed to {closure}() must be of the type int, object given, called in %s on line %d

*** Trying object(Stringable)#7 (0) {
*** Trying object(Stringable)#6 (0) {
}
*** Caught Argument 1 passed to {closure}() must be of the type int, object given, called in %s on line %d

Expand Down Expand Up @@ -159,11 +149,11 @@ float(NAN)
}
*** Caught Argument 1 passed to {closure}() must be of the type float, array given, called in %s on line %d

*** Trying object(stdClass)#6 (0) {
*** Trying object(stdClass)#5 (0) {
}
*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d

*** Trying object(Stringable)#7 (0) {
*** Trying object(Stringable)#6 (0) {
}
*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d

Expand Down Expand Up @@ -212,11 +202,11 @@ string(0) ""
}
*** Caught Argument 1 passed to {closure}() must be of the type string, array given, called in %s on line %d

*** Trying object(stdClass)#6 (0) {
*** Trying object(stdClass)#5 (0) {
}
*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d

*** Trying object(Stringable)#7 (0) {
*** Trying object(Stringable)#6 (0) {
}
*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d

Expand Down Expand Up @@ -265,11 +255,11 @@ bool(false)
}
*** Caught Argument 1 passed to {closure}() must be of the type bool, array given, called in %s on line %d

*** Trying object(stdClass)#6 (0) {
*** Trying object(stdClass)#5 (0) {
}
*** Caught Argument 1 passed to {closure}() must be of the type bool, object given, called in %s on line %d

*** Trying object(Stringable)#7 (0) {
*** Trying object(Stringable)#6 (0) {
}
*** Caught Argument 1 passed to {closure}() must be of the type bool, object given, called in %s on line %d

Expand Down
26 changes: 8 additions & 18 deletions Zend/tests/type_declarations/scalar_strict_64bit.phpt
Expand Up @@ -6,16 +6,6 @@ Scalar type strict mode
<?php
declare(strict_types=1);

$errnames = [
E_NOTICE => 'E_NOTICE',
E_WARNING => 'E_WARNING',
E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR'
];
set_error_handler(function (int $errno, string $errmsg, string $file, int $line) use ($errnames) {
echo "$errnames[$errno]: $errmsg on line $line\n";
return true;
});

$functions = [
'int' => function (int $i) { return $i; },
'float' => function (float $f) { return $f; },
Expand Down Expand Up @@ -106,11 +96,11 @@ int(9223372036854775807)
}
*** Caught Argument 1 passed to {closure}() must be of the type int, array given, called in %s on line %d

*** Trying object(stdClass)#6 (0) {
*** Trying object(stdClass)#5 (0) {
}
*** Caught Argument 1 passed to {closure}() must be of the type int, object given, called in %s on line %d

*** Trying object(Stringable)#7 (0) {
*** Trying object(Stringable)#6 (0) {
}
*** Caught Argument 1 passed to {closure}() must be of the type int, object given, called in %s on line %d

Expand Down Expand Up @@ -159,11 +149,11 @@ float(NAN)
}
*** Caught Argument 1 passed to {closure}() must be of the type float, array given, called in %s on line %d

*** Trying object(stdClass)#6 (0) {
*** Trying object(stdClass)#5 (0) {
}
*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d

*** Trying object(Stringable)#7 (0) {
*** Trying object(Stringable)#6 (0) {
}
*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d

Expand Down Expand Up @@ -212,11 +202,11 @@ string(0) ""
}
*** Caught Argument 1 passed to {closure}() must be of the type string, array given, called in %s on line %d

*** Trying object(stdClass)#6 (0) {
*** Trying object(stdClass)#5 (0) {
}
*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d

*** Trying object(Stringable)#7 (0) {
*** Trying object(Stringable)#6 (0) {
}
*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d

Expand Down Expand Up @@ -265,11 +255,11 @@ bool(false)
}
*** Caught Argument 1 passed to {closure}() must be of the type bool, array given, called in %s on line %d

*** Trying object(stdClass)#6 (0) {
*** Trying object(stdClass)#5 (0) {
}
*** Caught Argument 1 passed to {closure}() must be of the type bool, object given, called in %s on line %d

*** Trying object(Stringable)#7 (0) {
*** Trying object(Stringable)#6 (0) {
}
*** Caught Argument 1 passed to {closure}() must be of the type bool, object given, called in %s on line %d

Expand Down
11 changes: 0 additions & 11 deletions Zend/tests/type_declarations/scalar_strict_basic.phpt
Expand Up @@ -5,17 +5,6 @@ Strict scalar type basics

declare(strict_types=1);

$errnames = [
E_NOTICE => 'E_NOTICE',
E_WARNING => 'E_WARNING',
E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR'
];

set_error_handler(function (int $errno, string $errmsg, string $file, int $line) use ($errnames) {
echo "$errnames[$errno]: $errmsg on line $line\n";
return true;
});

$functions = [
'int' => function (int $i) { return $i; },
'float' => function (float $f) { return $f; },
Expand Down
14 changes: 6 additions & 8 deletions ext/date/tests/timezone_offset_get_error.phpt
Expand Up @@ -13,14 +13,6 @@ date_default_timezone_set("GMT");
$tz = timezone_open("Europe/London");
$date = date_create("GMT");

set_error_handler('err');

function err($errno, $errstr) {
if ($errno === E_RECOVERABLE_ERROR) {
var_dump($errstr);
}
}

echo "*** Testing timezone_offset_get() : error conditions ***\n";

echo "\n-- Testing timezone_offset_get() function with zero arguments --\n";
Expand Down Expand Up @@ -99,12 +91,18 @@ try {
*** Testing timezone_offset_get() : error conditions ***

-- Testing timezone_offset_get() function with zero arguments --

Warning: timezone_offset_get() expects exactly 2 parameters, 0 given in %s on line %d
bool(false)

-- Testing timezone_offset_get() function with less than expected no. of arguments --

Warning: timezone_offset_get() expects exactly 2 parameters, 1 given in %s on line %d
bool(false)

-- Testing timezone_offset_get() function with more than expected no. of arguments --

Warning: timezone_offset_get() expects exactly 2 parameters, 3 given in %s on line %d
bool(false)

-- Testing timezone_offset_get() function with an invalid values for $object argument --
Expand Down
8 changes: 0 additions & 8 deletions ext/date/tests/timezone_offset_get_variation1.phpt
Expand Up @@ -13,14 +13,6 @@ echo "*** Testing timezone_offset_get() : usage variation - unexpected values t
//Set the default time zone
date_default_timezone_set("Europe/London");

set_error_handler('handler');

function handler($errno, $errstr) {
if ($errno === E_RECOVERABLE_ERROR) {
echo $errstr . "\n";
}
}

//get an unset variable
$unset_var = 10;
unset ($unset_var);
Expand Down
8 changes: 0 additions & 8 deletions ext/date/tests/timezone_offset_get_variation2.phpt
Expand Up @@ -13,14 +13,6 @@ echo "*** Testing timezone_offset_get() : usage variation - unexpected values t
//Set the default time zone
date_default_timezone_set("Europe/London");

set_error_handler('handler');

function handler($errno, $errstr) {
if ($errno === E_RECOVERABLE_ERROR) {
echo $errstr . "\n";
}
}

//get an unset variable
$unset_var = 10;
unset ($unset_var);
Expand Down
6 changes: 0 additions & 6 deletions ext/phar/tests/open_for_write_existing_b.phpt
Expand Up @@ -19,12 +19,6 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'files/phar_test.inc';

function err_handler($errno, $errstr, $errfile, $errline) {
echo "Recoverable fatal error: $errstr in $errfile on line $errline\n";
}

set_error_handler("err_handler", E_RECOVERABLE_ERROR);

$fp = fopen($pname . '/b/c.php', 'wb');
fwrite($fp, 'extra');
fclose($fp);
Expand Down
8 changes: 1 addition & 7 deletions ext/phar/tests/open_for_write_newfile_b.phpt
Expand Up @@ -19,12 +19,6 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'files/phar_test.inc';

function err_handler($errno, $errstr, $errfile, $errline) {
echo "Recoverable fatal error: $errstr in $errfile on line $errline\n";
}

set_error_handler("err_handler", E_RECOVERABLE_ERROR);

$fp = fopen($pname . '/b/new.php', 'wb');
fwrite($fp, 'extra');
fclose($fp);
Expand All @@ -43,7 +37,7 @@ Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_w
Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_b.php on line %d
This is b/c

Warning: include(phar://%sopen_for_write_newfile_b.phar.php/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b.phar.php" in %sopen_for_write_newfile_b.php on line 22
Warning: include(phar://%sopen_for_write_newfile_b.phar.php/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b.phar.php" in %sopen_for_write_newfile_b.php on line %d

Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_b.phar.php/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_b.php on line %d

Expand Down
6 changes: 0 additions & 6 deletions ext/phar/tests/tar/open_for_write_existing_b.phpt
Expand Up @@ -29,12 +29,6 @@ foreach ($files as $n => $file) {
$phar->stopBuffering();
ini_set('phar.readonly', 1);

function err_handler($errno, $errstr, $errfile, $errline) {
echo "Recoverable fatal error: $errstr in $errfile on line $errline\n";
}

set_error_handler("err_handler", E_RECOVERABLE_ERROR);

$fp = fopen($alias . '/b/c.php', 'wb');
fwrite($fp, 'extra');
fclose($fp);
Expand Down
6 changes: 0 additions & 6 deletions ext/phar/tests/tar/open_for_write_newfile_b.phpt
Expand Up @@ -29,12 +29,6 @@ foreach ($files as $n => $file) {
$phar->stopBuffering();
ini_set('phar.readonly', 1);

function err_handler($errno, $errstr, $errfile, $errline) {
echo "Recoverable fatal error: $errstr in $errfile on line $errline\n";
}

set_error_handler("err_handler", E_RECOVERABLE_ERROR);

$fp = fopen($alias . '/b/new.php', 'wb');
fwrite($fp, 'extra');
fclose($fp);
Expand Down
6 changes: 0 additions & 6 deletions ext/phar/tests/zip/open_for_write_existing_b.phpt
Expand Up @@ -29,12 +29,6 @@ $phar->stopBuffering();

ini_set('phar.readonly', 1);

function err_handler($errno, $errstr, $errfile, $errline) {
echo "Recoverable fatal error: $errstr in $errfile on line $errline\n";
}

set_error_handler("err_handler", E_RECOVERABLE_ERROR);

$fp = fopen($alias . '/b/c.php', 'wb');
fwrite($fp, 'extra');
fclose($fp);
Expand Down
6 changes: 0 additions & 6 deletions ext/phar/tests/zip/open_for_write_newfile_b.phpt
Expand Up @@ -29,12 +29,6 @@ $phar->stopBuffering();

ini_set('phar.readonly', 1);

function err_handler($errno, $errstr, $errfile, $errline) {
echo "Recoverable fatal error: $errstr in $errfile on line $errline\n";
}

set_error_handler("err_handler", E_RECOVERABLE_ERROR);

$fp = fopen($alias . '/b/new.php', 'wb');
fwrite($fp, 'extra');
fclose($fp);
Expand Down
7 changes: 0 additions & 7 deletions ext/standard/tests/assert/assert_error1.phpt
Expand Up @@ -12,11 +12,6 @@ function f1()
{
echo "f1 called\n";
}
function handler($errno, $errstr) {
echo "in handler()\n\n";
assert(E_RECOVERABLE_ERROR === $errno);
var_dump($errstr);
}

//Wrong number of parameters for assert_options()
assert_options(ASSERT_WARNING, 1);
Expand All @@ -30,8 +25,6 @@ var_dump($rao=assert_options("F1", "f1"));
$sa="0 != 0";
var_dump($r2 = assert($sa, "message", 1));


//Catch recoverable error with handler
var_dump($rc = assert('aa=sd+as+safsafasfaçsafçsafç'));
--EXPECTF--
Warning: assert_options() expects at most 2 parameters, 3 given in %s on line %d
Expand Down
5 changes: 0 additions & 5 deletions tests/classes/type_hinting_004.phpt
Expand Up @@ -2,11 +2,6 @@
Ensure type hints are enforced for functions invoked as callbacks.
--FILE--
<?php
set_error_handler('myErrorHandler', E_RECOVERABLE_ERROR);
function myErrorHandler($errno, $errstr, $errfile, $errline) {
echo "$errno: $errstr - $errfile($errline)\n";
return true;
}

echo "---> Type hints with callback function:\n";
class A { }
Expand Down

0 comments on commit 2fac9d9

Please sign in to comment.