summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2007-07-25 16:34:27 +0000
committerDmitry Stogov <dmitry@php.net>2007-07-25 16:34:27 +0000
commit11c5577116e1fa0a4549b4cb3d608ab884d86502 (patch)
tree0adc32df08f8736f99a0adbdbebb4a90c78c8caa
parent7bb46902f82fc1d1235f3f3fcf98fcdcfa163bd1 (diff)
downloadphp-git-11c5577116e1fa0a4549b4cb3d608ab884d86502.tar.gz
Fixed EOF handling in case of reading from file opened in write only mode.
-rw-r--r--ext/standard/tests/file/fgets_variation1.phpt4
-rw-r--r--ext/standard/tests/file/fread_variation2.phpt2
-rw-r--r--ext/standard/tests/file/fread_variation4-win32.phpt440
-rw-r--r--ext/standard/tests/file/fread_variation4.phpt109
-rw-r--r--main/streams/plain_wrapper.c2
5 files changed, 99 insertions, 458 deletions
diff --git a/ext/standard/tests/file/fgets_variation1.phpt b/ext/standard/tests/file/fgets_variation1.phpt
index 6f66a766c3..65dae4d7bd 100644
--- a/ext/standard/tests/file/fgets_variation1.phpt
+++ b/ext/standard/tests/file/fgets_variation1.phpt
@@ -84,7 +84,7 @@ int(0)
bool(false)
bool(false)
int(0)
-bool(true)
+bool(false)
-- File opened in mode : at --
bool(true)
int(0)
@@ -150,7 +150,7 @@ int(0)
bool(false)
bool(false)
int(0)
-bool(true)
+bool(false)
-- File opened in mode : at --
bool(true)
int(0)
diff --git a/ext/standard/tests/file/fread_variation2.phpt b/ext/standard/tests/file/fread_variation2.phpt
index 46e9c7df39..d85a4487ad 100644
--- a/ext/standard/tests/file/fread_variation2.phpt
+++ b/ext/standard/tests/file/fread_variation2.phpt
@@ -652,6 +652,7 @@ bool(false)
Reading 1000 bytes from file, expecting 0 bytes ... OK
int(0)
bool(false)
+
Done
--UEXPECTF--
*** Testing fread() : usage variations ***
@@ -1202,4 +1203,5 @@ bool(false)
Reading 1000 bytes from file, expecting 0 bytes ... OK
int(0)
bool(false)
+
Done
diff --git a/ext/standard/tests/file/fread_variation4-win32.phpt b/ext/standard/tests/file/fread_variation4-win32.phpt
index bde1834483..77d733a50e 100644
--- a/ext/standard/tests/file/fread_variation4-win32.phpt
+++ b/ext/standard/tests/file/fread_variation4-win32.phpt
@@ -117,596 +117,236 @@ int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1024)
bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1024)
-bool(true)
--- File opened in mode ab --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
-bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
--- File opened in mode at --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
-bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1024)
bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1024)
-bool(true)
--- File opened in mode w --
+-- File opened in mode ab --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1024)
bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1024)
-bool(true)
--- File opened in mode wb --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
-bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
--- File opened in mode wt --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
-bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1024)
bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1024)
-bool(true)
--- File opened in mode x --
+-- File opened in mode at --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1024)
bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1024)
-bool(true)
--- File opened in mode xb --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
-bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
--- File opened in mode xt --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
-bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1024)
bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1024)
-bool(true)
-
--- Testing fread() with file having content of type text --
--- File opened in mode a --
+-- File opened in mode w --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1024)
-bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1024)
-bool(true)
--- File opened in mode ab --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
--- File opened in mode at --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1024)
-bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1024)
-bool(true)
--- File opened in mode w --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
-bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1024)
-bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1024)
-bool(true)
-- File opened in mode wb --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1024)
bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1024)
-bool(true)
--- File opened in mode wt --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
-bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
--- File opened in mode x --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
-bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1024)
bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1024)
-bool(true)
--- File opened in mode xb --
+-- File opened in mode wt --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1024)
-bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1024)
-bool(true)
--- File opened in mode xt --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
-
--- Testing fread() with file having content of type text_with_new_line --
--- File opened in mode a --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
-bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1024)
bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1024)
-bool(true)
--- File opened in mode ab --
+-- File opened in mode x --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1024)
-bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1024)
-bool(true)
--- File opened in mode at --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
--- File opened in mode w --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
-bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1024)
bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1024)
-bool(true)
--- File opened in mode wb --
+-- File opened in mode xb --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
--- File opened in mode wt --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
-bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1137)
bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1137)
-bool(true)
--- File opened in mode x --
+-- File opened in mode xt --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1024)
-bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1024)
-bool(true)
--- File opened in mode xb --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
--- File opened in mode xt --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1137)
-bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1137)
-bool(true)
-Done
---UEXPECTF--
-*** Testing fread() : usage variations ***
--- Testing fread() with file having content of type numeric --
+-- Testing fread() with file having content of type text --
-- File opened in mode a --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1024)
bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1024)
-bool(true)
--- File opened in mode ab --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
-bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
--- File opened in mode at --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1024)
-bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1024)
-bool(true)
--- File opened in mode w --
+-- File opened in mode ab --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1024)
bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1024)
-bool(true)
--- File opened in mode wb --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
-bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
--- File opened in mode wt --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
-bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1024)
bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1024)
-bool(true)
--- File opened in mode x --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
-bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1024)
-bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1024)
-bool(true)
--- File opened in mode xb --
+-- File opened in mode at --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1024)
-bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1024)
-bool(true)
--- File opened in mode xt --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
-
--- Testing fread() with file having content of type text --
--- File opened in mode a --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
-bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1024)
bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1024)
-bool(true)
--- File opened in mode ab --
+-- File opened in mode w --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1024)
-bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1024)
-bool(true)
--- File opened in mode at --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
--- File opened in mode w --
--- Reading beyond filesize, expeceted : 1024 bytes --
-int(0)
-bool(false)
-Reading 1030 bytes from file, expecting 0 bytes ... OK
-int(0)
-bool(true)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
-int(1024)
bool(false)
-Reading 10 bytes from file, expecting 0 bytes ... OK
-int(1024)
-bool(true)
-- File opened in mode wb --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode wt --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode x --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode xb --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode xt --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- Testing fread() with file having content of type text_with_new_line --
-- File opened in mode a --
@@ -715,115 +355,115 @@ int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode ab --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode at --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode w --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode wb --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode wt --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1137)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1137)
-bool(true)
+bool(false)
-- File opened in mode x --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode xb --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode xt --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1137)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1137)
-bool(true)
+bool(false)
Done \ No newline at end of file
diff --git a/ext/standard/tests/file/fread_variation4.phpt b/ext/standard/tests/file/fread_variation4.phpt
index 4521e91ccf..4b08fd7ef6 100644
--- a/ext/standard/tests/file/fread_variation4.phpt
+++ b/ext/standard/tests/file/fread_variation4.phpt
@@ -117,117 +117,117 @@ int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode ab --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode at --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode w --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode wb --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode wt --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode x --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode xb --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode xt --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- Testing fread() with file having content of type text --
-- File opened in mode a --
@@ -236,117 +236,117 @@ int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode ab --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode at --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode w --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode wb --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode wt --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode x --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode xb --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode xt --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- Testing fread() with file having content of type text_with_new_line --
-- File opened in mode a --
@@ -355,116 +355,115 @@ int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode ab --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode at --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode w --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode wb --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode wt --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode x --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode xb --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
-- File opened in mode xt --
-- Reading beyond filesize, expeceted : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ... OK
int(0)
-bool(true)
+bool(false)
-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
-bool(true)
+bool(false)
Done
---UEXPECTF-- \ No newline at end of file
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index 3fee1514ed..6611d50137 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.c
@@ -342,7 +342,7 @@ static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count TSRMLS
ret = read(data->fd, buf, count);
}
- stream->eof = (ret == 0 || (ret == (size_t)-1 && errno != EWOULDBLOCK && errno != EINTR));
+ stream->eof = (ret == 0 || (ret == (size_t)-1 && errno != EWOULDBLOCK && errno != EINTR && errno != EBADF));
} else {
#if HAVE_FLUSHIO