lbarnaud Tue Nov 11 00:40:05 2008 UTC
Added files:
/php-src/ext/standard/tests/file bug45585.phpt
Modified files:
/php-src/ext/standard file.c
Log:
Fixed bug #45585 (fread() return value for EOF inconsistent
between PHP 5 and 6)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.530&r2=1.531&diff_format=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.530 php-src/ext/standard/file.c:1.531
--- php-src/ext/standard/file.c:1.530 Tue Oct 21 22:06:48 2008
+++ php-src/ext/standard/file.c Tue Nov 11 00:40:04 2008
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.530 2008/10/21 22:06:48 lbarnaud Exp $ */
+/* $Id: file.c,v 1.531 2008/11/11 00:40:04 lbarnaud Exp $ */
/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
@@ -1984,19 +1984,11 @@
int buflen = len;
UChar *buf = php_stream_read_unicode_chars(stream, &buflen);
- if (!buf) {
- RETURN_FALSE;
- }
-
RETURN_UNICODEL(buf, buflen, 0);
} else { /* IS_STRING */
char *buf = emalloc(len + 1);
int buflen = php_stream_read(stream, buf, len);
- if (!buflen) {
- efree(buf);
- RETURN_FALSE;
- }
buf[buflen] = 0;
RETURN_STRINGL(buf, buflen, 0);
}
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/bug45585.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/file/bug45585.phpt
+++ php-src/ext/standard/tests/file/bug45585.phpt
--TEST--
Bug #45585 (fread() return value for EOF inconsistent between PHP 5 and 6)
--FILE--
<?php
$fd = fopen("php://temp","w+");
fwrite($fd, b"foo");
fseek($fd, 0, SEEK_SET);
var_dump($fd, fread($fd, 3), fread($fd, 3));
fclose($fd);
?>
--EXPECTF--
resource(%d) of type (stream)
string(3) "foo"
string(0) ""
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php