summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Filina <afilina@gmail.com>2021-01-13 13:41:37 +0100
committerChristoph M. Becker <cmbecker69@gmx.de>2021-01-14 23:49:26 +0100
commitdf30f09be5dbb9bbed10d018aa44ea38af6e6967 (patch)
tree65cbd3c792ee3d39abd551cdc95ffca9547b1b63
parent4299e2de4207841e93d19813eabeb196a436ecc9 (diff)
downloadphp-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.phpt12
-rw-r--r--ext/standard/tests/file/file_get_contents_error_folder.phpt12
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