felipe          Sat Feb  9 19:46:49 2008 UTC

  Modified files:              
    /php-src/ext/standard       file.c 
  Log:
  Fixed bugs:
  - #42036      fgetc() sets end of the file flag when reading on write only 
file
  - #42037      fgetc() retuns one char when fails to read on php6
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.507&r2=1.508&diff_format=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.507 php-src/ext/standard/file.c:1.508
--- php-src/ext/standard/file.c:1.507   Wed Feb  6 02:56:49 2008
+++ php-src/ext/standard/file.c Sat Feb  9 19:46:49 2008
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: file.c,v 1.507 2008/02/06 02:56:49 felipe Exp $ */
+/* $Id: file.c,v 1.508 2008/02/09 19:46:49 felipe Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -1181,14 +1181,16 @@
                int buflen = 1;
                UChar *buf = php_stream_read_unicode_chars(stream, &buflen);
 
-               if (!buf) {
+               if (!buf || !buflen) {
                        RETURN_FALSE;
                }
                RETURN_UNICODEL(buf, buflen, 0);
        } else { /* IS_STRING */
                char buf[2];
 
-               buf[0] = php_stream_getc(stream);
+               if ((buf[0] = php_stream_getc(stream)) == EOF) {
+                       RETURN_FALSE;
+               }
                buf[1] = 0;
                RETURN_STRINGL(buf, 1, 1);
        }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to