diff options
author | Anna Filina <afilina@gmail.com> | 2021-01-13 13:41:37 +0100 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2021-01-14 23:49:26 +0100 |
commit | df30f09be5dbb9bbed10d018aa44ea38af6e6967 (patch) | |
tree | 65cbd3c792ee3d39abd551cdc95ffca9547b1b63 | |
parent | 4299e2de4207841e93d19813eabeb196a436ecc9 (diff) | |
download | php-git-df30f09be5dbb9bbed10d018aa44ea38af6e6967.tar.gz |
Add test to verify file_get_contents error with folder
Closes GH-6600.
-rw-r--r-- | ext/standard/tests/file/file_get_contents_error_folder-win.phpt | 12 | ||||
-rw-r--r-- | ext/standard/tests/file/file_get_contents_error_folder.phpt | 12 |
2 files changed, 24 insertions, 0 deletions
diff --git a/ext/standard/tests/file/file_get_contents_error_folder-win.phpt b/ext/standard/tests/file/file_get_contents_error_folder-win.phpt new file mode 100644 index 0000000000..ea3902fdbe --- /dev/null +++ b/ext/standard/tests/file/file_get_contents_error_folder-win.phpt @@ -0,0 +1,12 @@ +--TEST-- +Test file_get_contents() function : error when passing folder - on Windows +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != "WIN") { print "skip - Windows only"; } +?> +--FILE-- +<?php +file_get_contents(__DIR__); +?> +--EXPECTF-- +Warning: file_get_contents(%s): Failed to open stream: Permission denied in %s on line %d diff --git a/ext/standard/tests/file/file_get_contents_error_folder.phpt b/ext/standard/tests/file/file_get_contents_error_folder.phpt new file mode 100644 index 0000000000..32f0210d3b --- /dev/null +++ b/ext/standard/tests/file/file_get_contents_error_folder.phpt @@ -0,0 +1,12 @@ +--TEST-- +Test file_get_contents() function : error when passing folder +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) === "WIN") { print "skip - not valid for Windows"; } +?> +--FILE-- +<?php +file_get_contents(__DIR__); +?> +--EXPECTF-- +Notice: file_get_contents(): Read of %d bytes failed with errno=21 Is a directory in %s on line %d |