diff options
author | Máté Kocsis <kocsismate@woohoolabs.com> | 2019-11-01 12:38:26 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-11-01 17:07:51 +0100 |
commit | f19950fea0ecf77a4d218075c8fcaefa3d986ac5 (patch) | |
tree | cf84f110d9f51c52be2dfec3fdee824c488d7480 /ext/standard/tests/general_functions | |
parent | 11ce4172157c3925525f598478f8252993998dff (diff) | |
download | php-git-f19950fea0ecf77a4d218075c8fcaefa3d986ac5.tar.gz |
Promote some warnings to exceptions in standard lib
Closes GH-4879.
Diffstat (limited to 'ext/standard/tests/general_functions')
-rw-r--r-- | ext/standard/tests/general_functions/putenv.phpt | 21 | ||||
-rw-r--r-- | ext/standard/tests/general_functions/sleep_error.phpt | 24 | ||||
-rw-r--r-- | ext/standard/tests/general_functions/usleep_error.phpt | 25 |
3 files changed, 25 insertions, 45 deletions
diff --git a/ext/standard/tests/general_functions/putenv.phpt b/ext/standard/tests/general_functions/putenv.phpt index ab2c1b41f7..c1f4f98eeb 100644 --- a/ext/standard/tests/general_functions/putenv.phpt +++ b/ext/standard/tests/general_functions/putenv.phpt @@ -15,8 +15,17 @@ var_dump(getenv($var_name)); var_dump(putenv($var_name)); var_dump(getenv($var_name)); -var_dump(putenv("=123")); -var_dump(putenv("")); +try { + putenv("=123"); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + putenv(""); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} echo "Done\n"; ?> @@ -28,10 +37,6 @@ bool(true) string(0) "" bool(true) bool(false) - -Warning: putenv(): Invalid parameter syntax in %s on line %d -bool(false) - -Warning: putenv(): Invalid parameter syntax in %s on line %d -bool(false) +Invalid parameter syntax +Invalid parameter syntax Done diff --git a/ext/standard/tests/general_functions/sleep_error.phpt b/ext/standard/tests/general_functions/sleep_error.phpt index 3b46a35e5d..4bf3e9fefc 100644 --- a/ext/standard/tests/general_functions/sleep_error.phpt +++ b/ext/standard/tests/general_functions/sleep_error.phpt @@ -2,25 +2,13 @@ Test sleep() function : error conditions --FILE-- <?php -/* Prototype : int sleep ( int $seconds ) - * Description: Delays the program execution for the given number of seconds . - * Source code: ext/standard/basic_functions.c - */ - set_time_limit(20); -echo "*** Testing sleep() : error conditions ***\n"; - -echo "\n-- Testing sleep() function with negative interval --\n"; -$seconds = -10; -var_dump( sleep($seconds) ); +sleep(-10); ?> -===DONE=== --EXPECTF-- -*** Testing sleep() : error conditions *** - --- Testing sleep() function with negative interval -- - -Warning: sleep(): Number of seconds must be greater than or equal to 0 in %s on line %d -bool(false) -===DONE=== +Fatal error: Uncaught ValueError: Number of seconds must be greater than or equal to 0 in %s +Stack trace: +#0 %s(%d): sleep(-10) +#1 {main} + thrown in %s on line %d diff --git a/ext/standard/tests/general_functions/usleep_error.phpt b/ext/standard/tests/general_functions/usleep_error.phpt index 283e7f30e5..25bc0b6866 100644 --- a/ext/standard/tests/general_functions/usleep_error.phpt +++ b/ext/standard/tests/general_functions/usleep_error.phpt @@ -2,26 +2,13 @@ Test usleep() function : error conditions --FILE-- <?php -/* Prototype : void usleep ( int $micro_seconds ) - * Description: Delays program execution for the given number of micro seconds. - * Source code: ext/standard/basic_functions.c - */ -set_time_limit(20); - -echo "*** Testing usleep() : error conditions ***\n"; - -echo "\n-- Testing usleep() function with negative interval --\n"; -$seconds = -10; -var_dump( usleep($seconds) ); +usleep(-10); ?> -===DONE=== --EXPECTF-- -*** Testing usleep() : error conditions *** - --- Testing usleep() function with negative interval -- - -Warning: usleep(): Number of microseconds must be greater than or equal to 0 in %s on line %d -bool(false) -===DONE=== +Fatal error: Uncaught ValueError: Number of microseconds must be greater than or equal to 0 in %s +Stack trace: +#0 %s(%d): usleep(-10) +#1 {main} + thrown in %s on line %d |