From 6616df4f3e971b59de38f5500181e41edffd86ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Sat, 13 Nov 2010 15:09:52 +0000 Subject: [PATCH] - Behavior when seeking past the end of file. Partially addresses bug #52335. - Expanded note on how the stream may not support seeking. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@305317 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/filesystem/functions/fseek.xml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/reference/filesystem/functions/fseek.xml b/reference/filesystem/functions/fseek.xml index 46b5454c4a..8e002eb15a 100644 --- a/reference/filesystem/functions/fseek.xml +++ b/reference/filesystem/functions/fseek.xml @@ -21,6 +21,13 @@ offset to the position specified by whence. + + In general, it is allowed to seek past the end-of-file; if data is then + written, reads in any unwritten region between the end-of-file and the + sought position will yield bytes with value 0. However, certain streams + may not support this behavior, especially when they have an underlying + fixed size storage. + @@ -67,8 +74,7 @@ &reftitle.returnvalues; - Upon success, returns 0; otherwise, returns -1. Note that seeking - past EOF is not considered an error. + Upon success, returns 0; otherwise, returns -1. @@ -109,9 +115,9 @@ fseek($fp, 0); - May not be used on file pointers returned by fopen if - they use the http:// or ftp:// - schemes. + Not all streams support seeking. For those that do not support seeking, + forward seeking from the current position is accomplished by reading + and discarding data; other forms of seeking will fail.