summaryrefslogtreecommitdiff
path: root/ext/standard/tests/file/file_get_contents_error.phpt
diff options
context:
space:
mode:
authorMáté Kocsis <kocsismate@woohoolabs.com>2019-11-20 02:29:18 +0100
committerMáté Kocsis <kocsismate@woohoolabs.com>2019-12-05 08:32:29 +0100
commit5898e8ef3c1bfb2aaa040bc9b86c6c402015865d (patch)
tree02e56372c3acfdd9d4ab240b8b78e20e15d4949d /ext/standard/tests/file/file_get_contents_error.phpt
parentad4d6634f49bfb6ce382e9b9a3d50492d41687ea (diff)
downloadphp-git-5898e8ef3c1bfb2aaa040bc9b86c6c402015865d.tar.gz
Promote warning to exception in file_get_contents() function
Diffstat (limited to 'ext/standard/tests/file/file_get_contents_error.phpt')
-rw-r--r--ext/standard/tests/file/file_get_contents_error.phpt11
1 files changed, 7 insertions, 4 deletions
diff --git a/ext/standard/tests/file/file_get_contents_error.phpt b/ext/standard/tests/file/file_get_contents_error.phpt
index 9757b3be2a..8304105ccc 100644
--- a/ext/standard/tests/file/file_get_contents_error.phpt
+++ b/ext/standard/tests/file/file_get_contents_error.phpt
@@ -20,8 +20,12 @@ print( file_get_contents("/no/such/file/or/dir") );
create_files($file_path, 1, "text", 0755, 100, "w", "file", 1, "byte");
$file_handle = fopen($file_path."/file_put_contents_error.tmp", "w");
-echo "\n-- Testing for invalid negative maxlen values --";
-var_dump( file_get_contents($file_path."/file1.tmp", FALSE, $file_handle, 0, -5) );
+echo "\n-- Testing for invalid negative maxlen values --\n";
+try {
+ file_get_contents($file_path."/file1.tmp", FALSE, $file_handle, 0, -5);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
delete_files($file_path, 1);
fclose($file_handle);
@@ -47,7 +51,6 @@ if(file_exists($file_path."/file_put_contents1.tmp")) {
Warning: file_get_contents(/no/such/file/or/dir): failed to open stream: No such file or directory in %s on line %d
-- Testing for invalid negative maxlen values --
-Warning: file_get_contents(): length must be greater than or equal to zero in %s on line %d
-bool(false)
+Length must be greater than or equal to zero
*** Done ***