pollita Fri Mar 24 21:37:42 2006 UTC Modified files: /php-src/ext/standard streamsfuncs.c Log: Fix stream_get_line(): Checking type isn't nearly as important as checking nullness... http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/streamsfuncs.c?r1=1.69&r2=1.70&diff_format=u Index: php-src/ext/standard/streamsfuncs.c diff -u php-src/ext/standard/streamsfuncs.c:1.69 php-src/ext/standard/streamsfuncs.c:1.70 --- php-src/ext/standard/streamsfuncs.c:1.69 Fri Mar 24 19:22:24 2006 +++ php-src/ext/standard/streamsfuncs.c Fri Mar 24 21:37:42 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: streamsfuncs.c,v 1.69 2006/03/24 19:22:24 pollita Exp $ */ +/* $Id: streamsfuncs.c,v 1.70 2006/03/24 21:37:42 pollita Exp $ */ #include "php.h" #include "php_globals.h" @@ -1259,14 +1259,18 @@ if (php_stream_reads_unicode(stream)) { UChar *buf; + UChar *d = NULL; + int dlen = 0; - if (Z_TYPE_PP(delim) != IS_UNICODE) { + if (delim) { convert_to_unicode_ex(delim); + d = Z_USTRVAL_PP(delim); + dlen = Z_USTRLEN_PP(delim); } /* maxchars == maxlength will prevent the otherwise generous maxlen == max_length * 2 from allocating beyond what's requested */ - buf = php_stream_get_record_unicode(stream, max_length * 2, max_length, &buf_size, Z_USTRVAL_PP(delim), Z_USTRLEN_PP(delim) TSRMLS_CC); + buf = php_stream_get_record_unicode(stream, max_length * 2, max_length, &buf_size, d, dlen TSRMLS_CC); if (!buf) { RETURN_FALSE; } @@ -1274,12 +1278,16 @@ RETURN_UNICODEL(buf, buf_size, 0); } else { char *buf; + char *d = NULL; + int dlen = 0; - if (Z_TYPE_PP(delim) != IS_STRING) { + if (delim) { convert_to_string_ex(delim); + d = Z_STRVAL_PP(delim); + dlen = Z_STRLEN_PP(delim); } - buf = php_stream_get_record(stream, max_length, &buf_size, Z_STRVAL_PP(delim), Z_STRLEN_PP(delim) TSRMLS_CC); + buf = php_stream_get_record(stream, max_length, &buf_size, d, dlen TSRMLS_CC); if (!buf) { RETURN_FALSE; }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php