pollita Thu Dec 7 09:51:36 2006 UTC Modified files: /php-src/ext/standard file.c Log: Change fgets() behavior back to BC version http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.472&r2=1.473&diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.472 php-src/ext/standard/file.c:1.473 --- php-src/ext/standard/file.c:1.472 Tue Dec 5 13:45:49 2006 +++ php-src/ext/standard/file.c Thu Dec 7 09:51:36 2006 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: file.c,v 1.472 2006/12/05 13:45:49 tony2001 Exp $ */ +/* $Id: file.c,v 1.473 2006/12/07 09:51:36 pollita Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -1114,7 +1114,7 @@ } /* }}} */ -/* {{{ proto string fgets(resource fp[, int length]) U +/* {{{ proto string fgets(resource fp[, int lengthish]) U Get a line from file pointer */ PHPAPI PHP_FUNCTION(fgets) { @@ -1131,6 +1131,11 @@ php_stream_from_zval(stream, &zstream); + if (length > 0) { + /* For BC reasons, fgets() should only return length-1 bytes. */ + length--; + } + buf.v = php_stream_get_line_ex(stream, stream->readbuf_type, NULL_ZSTR, 0, length, &retlen); if (!buf.v) { RETURN_FALSE;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php