[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /main/streams streams.c
lbarnaudThu Mar 19 17:56:02 2009 UTC Modified files: (Branch: PHP_5_2) /php-src/main/streams streams.c /php-srcNEWS Log: MFH: Better fix for #44607. Fixes #47487 (php_stream_fill_read_buffer() performance degraded after fix of bug 44607). http://cvs.php.net/viewvc.cgi/php-src/main/streams/streams.c?r1=1.82.2.6.2.33r2=1.82.2.6.2.34diff_format=u Index: php-src/main/streams/streams.c diff -u php-src/main/streams/streams.c:1.82.2.6.2.33 php-src/main/streams/streams.c:1.82.2.6.2.34 --- php-src/main/streams/streams.c:1.82.2.6.2.33Thu Jan 8 19:21:25 2009 +++ php-src/main/streams/streams.c Thu Mar 19 17:56:00 2009 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: streams.c,v 1.82.2.6.2.33 2009/01/08 19:21:25 felipe Exp $ */ +/* $Id: streams.c,v 1.82.2.6.2.34 2009/03/19 17:56:00 lbarnaud Exp $ */ #define _GNU_SOURCE #include php.h @@ -531,16 +531,16 @@ efree(chunk_buf); } else { - /* reduce buffer memory consumption if possible, to avoid a realloc */ - if (stream-readbuf stream-readbuflen - stream-writepos stream-chunk_size) { - memmove(stream-readbuf, stream-readbuf + stream-readpos, stream-readbuflen - stream-readpos); - stream-writepos -= stream-readpos; - stream-readpos = 0; - } /* is there enough data in the buffer ? */ - while (stream-writepos - stream-readpos (off_t)size) { + if (stream-writepos - stream-readpos (off_t)size) { size_t justread = 0; - size_t toread; + + /* reduce buffer memory consumption if possible, to avoid a realloc */ + if (stream-readbuf stream-readbuflen - stream-writepos stream-chunk_size) { + memmove(stream-readbuf, stream-readbuf + stream-readpos, stream-readbuflen - stream-readpos); + stream-writepos -= stream-readpos; + stream-readpos = 0; + } /* grow the buffer if required * TODO: this can fail for persistent streams */ @@ -550,17 +550,13 @@ stream-is_persistent); } - toread = stream-readbuflen - stream-writepos; justread = stream-ops-read(stream, stream-readbuf + stream-writepos, - toread + stream-readbuflen - stream-writepos TSRMLS_CC); if (justread != (size_t)-1) { stream-writepos += justread; } - if (stream-eof || justread != toread) { - break; - } } } } @@ -859,10 +855,25 @@ PHPAPI char *php_stream_get_record(php_stream *stream, size_t maxlen, size_t *returned_len, char *delim, size_t delim_len TSRMLS_DC) { char *e, *buf; - size_t toread; + size_t toread, len; int skip = 0; - php_stream_fill_read_buffer(stream, maxlen TSRMLS_CC); + len = stream-writepos - stream-readpos; + + while (len maxlen) { + + size_t just_read; + toread = MIN(maxlen - len, stream-chunk_size); + + php_stream_fill_read_buffer(stream, len + toread TSRMLS_CC); + + just_read = (stream-writepos - stream-readpos) - len; + len += just_read; + + if (just_read toread) { + break; + } + } if (delim_len == 0 || !delim) { toread = maxlen; http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1444r2=1.2027.2.547.2.1445diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1444 php-src/NEWS:1.2027.2.547.2.1445 --- php-src/NEWS:1.2027.2.547.2.1444Wed Mar 18 13:11:30 2009 +++ php-src/NEWSThu Mar 19 17:56:01 2009 @@ -16,6 +16,8 @@ - Fixed bug #47598 (FILTER_VALIDATE_EMAIL is locale aware). (Ilia) - Fixed bug #47546 (Default value for limit parameter in explode is 0, not -1). (Kalle) +- Fixed bug #47487 (performance degraded when reading large chunks after fix of + bug #44607). (Arnaud) - Fixed bug #47435 (FILTER_FLAG_NO_PRIV_RANGE does not work with ipv6 addresses in the filter extension). (Ilia) - Fixed bug #47430 (Errors after writing to nodeValue parameter of an absent -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /main/streams streams.c
felipe Thu Jan 8 19:21:26 2009 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/main/streams streams.c Log: MFH: - Fixed bug #47037 (No error when using fopen with emty string) Patch by Cristian Rodriguez R. http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1384r2=1.2027.2.547.2.1385diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1384 php-src/NEWS:1.2027.2.547.2.1385 --- php-src/NEWS:1.2027.2.547.2.1384Thu Jan 8 17:28:08 2009 +++ php-src/NEWSThu Jan 8 19:21:25 2009 @@ -14,6 +14,8 @@ (Fixes CVE-2008-5498) (Scott) - Fixed a segfault when malformed string is passed to json_decode(). (Scott) +- Fixed bug #47037 (No error when using fopen with emty string). + (Cristian Rodriguez R.) - Fixed bug #47035 (dns_get_record returns a garbage byte at the end of a TXT record). (Felipe) - Fixed bug #47027 (var_export doesn't show numeric indices on ArrayObject). http://cvs.php.net/viewvc.cgi/php-src/main/streams/streams.c?r1=1.82.2.6.2.32r2=1.82.2.6.2.33diff_format=u Index: php-src/main/streams/streams.c diff -u php-src/main/streams/streams.c:1.82.2.6.2.32 php-src/main/streams/streams.c:1.82.2.6.2.33 --- php-src/main/streams/streams.c:1.82.2.6.2.32Wed Dec 31 11:17:48 2008 +++ php-src/main/streams/streams.c Thu Jan 8 19:21:25 2009 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: streams.c,v 1.82.2.6.2.32 2008/12/31 11:17:48 sebastian Exp $ */ +/* $Id: streams.c,v 1.82.2.6.2.33 2009/01/08 19:21:25 felipe Exp $ */ #define _GNU_SOURCE #include php.h @@ -1763,6 +1763,7 @@ } if (!path || !*path) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Filename cannot be empty); return NULL; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /main/streams streams.c xp_socket.c
dsp Wed Aug 27 07:48:37 2008 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/main/streams streams.c xp_socket.c Log: MFH: Fixed bug #43782 (feof() does not detect timeout on socket) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1206r2=1.2027.2.547.2.1207diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1206 php-src/NEWS:1.2027.2.547.2.1207 --- php-src/NEWS:1.2027.2.547.2.1206Fri Aug 22 01:06:54 2008 +++ php-src/NEWSWed Aug 27 07:48:36 2008 @@ -86,6 +86,7 @@ - Fixed bug #43993 (mb_substr_count() behaves differently to substr_count() with overlapping needles). (Moriyoshi) - Fixed bug #43941 (json_encode silently cuts non-UTF8 strings). (Stas) +- Fixed bug #43782 (feof() does not detect timeout on socket). (David Soria Parra) - Fixed bug #42737 (preg_split('//u') triggers a E_NOTICE with newlines). (Nuno) - Fixed bug #42604 (make test fails with --with-config-file-scan-dir=path). http://cvs.php.net/viewvc.cgi/php-src/main/streams/streams.c?r1=1.82.2.6.2.24r2=1.82.2.6.2.25diff_format=u Index: php-src/main/streams/streams.c diff -u php-src/main/streams/streams.c:1.82.2.6.2.24 php-src/main/streams/streams.c:1.82.2.6.2.25 --- php-src/main/streams/streams.c:1.82.2.6.2.24Tue Jul 15 16:10:32 2008 +++ php-src/main/streams/streams.c Wed Aug 27 07:48:37 2008 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: streams.c,v 1.82.2.6.2.24 2008/07/15 16:10:32 jani Exp $ */ +/* $Id: streams.c,v 1.82.2.6.2.25 2008/08/27 07:48:37 dsp Exp $ */ #define _GNU_SOURCE #include php.h @@ -633,7 +633,7 @@ /* use the configured timeout when checking eof */ if (!stream-eof PHP_STREAM_OPTION_RETURN_ERR == php_stream_set_option(stream, PHP_STREAM_OPTION_CHECK_LIVENESS, - 0, NULL)) { + -1, NULL)) { stream-eof = 1; } http://cvs.php.net/viewvc.cgi/php-src/main/streams/xp_socket.c?r1=1.33.2.2.2.10r2=1.33.2.2.2.11diff_format=u Index: php-src/main/streams/xp_socket.c diff -u php-src/main/streams/xp_socket.c:1.33.2.2.2.10 php-src/main/streams/xp_socket.c:1.33.2.2.2.11 --- php-src/main/streams/xp_socket.c:1.33.2.2.2.10 Wed Jul 16 14:10:50 2008 +++ php-src/main/streams/xp_socket.cWed Aug 27 07:48:37 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_socket.c,v 1.33.2.2.2.10 2008/07/16 14:10:50 jani Exp $ */ +/* $Id: xp_socket.c,v 1.33.2.2.2.11 2008/08/27 07:48:37 dsp Exp $ */ #include php.h #include ext/standard/file.h @@ -280,8 +280,12 @@ if (sock-socket == -1) { alive = 0; - } else if (php_pollfd_for(sock-socket, PHP_POLLREADABLE|POLLPRI, tv) 0) { - if (0 == recv(sock-socket, buf, sizeof(buf), MSG_PEEK) php_socket_errno() != EAGAIN) { + } else { + if (php_pollfd_for(sock-socket, PHP_POLLREADABLE|POLLPRI, tv) 0) { + if (0 == recv(sock-socket, buf, sizeof(buf), MSG_PEEK) php_socket_errno() != EAGAIN) { + alive = 0; + } + } else { alive = 0; } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /main/streams streams.c
tony2001Sat Dec 29 10:52:51 2007 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/main/streams streams.c Log: correct fix for bug #43522 http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1042r2=1.2027.2.547.2.1043diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1042 php-src/NEWS:1.2027.2.547.2.1043 --- php-src/NEWS:1.2027.2.547.2.1042Fri Dec 28 13:38:19 2007 +++ php-src/NEWSSat Dec 29 10:52:51 2007 @@ -14,7 +14,7 @@ function). (Ilia) - Fixed bug #43533 (escapeshellarg('') returns null). (Ilia) - Fixed bug #43522 (stream_get_line() eats additional characters). (Felipe, - Ilia) + Ilia, Tony) - Fixed bug #43495 (array_merge_recursive() crashes with recursive arrays). (Ilia) - Fixed bug #43493 (pdo_pgsql does not send username on connect when password http://cvs.php.net/viewvc.cgi/php-src/main/streams/streams.c?r1=1.82.2.6.2.19r2=1.82.2.6.2.20diff_format=u Index: php-src/main/streams/streams.c diff -u php-src/main/streams/streams.c:1.82.2.6.2.19 php-src/main/streams/streams.c:1.82.2.6.2.20 --- php-src/main/streams/streams.c:1.82.2.6.2.19Mon Dec 10 14:18:02 2007 +++ php-src/main/streams/streams.c Sat Dec 29 10:52:51 2007 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: streams.c,v 1.82.2.6.2.19 2007/12/10 14:18:02 iliaa Exp $ */ +/* $Id: streams.c,v 1.82.2.6.2.20 2007/12/29 10:52:51 tony2001 Exp $ */ #define _GNU_SOURCE #include php.h @@ -855,10 +855,17 @@ if (delim_len == 0 || !delim) { toread = maxlen; } else { + size_t seek_len; + + seek_len = stream-writepos - stream-readpos; + if (seek_len maxlen) { + seek_len = maxlen; + } + if (delim_len == 1) { - e = memchr(stream-readbuf + stream-readpos, *delim, maxlen); + e = memchr(stream-readbuf + stream-readpos, *delim, seek_len); } else { - e = php_memnstr(stream-readbuf + stream-readpos, delim, delim_len, (stream-readbuf + stream-readpos + maxlen)); + e = php_memnstr(stream-readbuf + stream-readpos, delim, delim_len, (stream-readbuf + stream-readpos + seek_len)); } if (!e) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /main/streams streams.c
iliaa Wed Aug 8 02:16:41 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/main/streams streams.c /php-srcNEWS Log: Fixed bug #42237 (stream_copy_to_stream returns invalid values for mmaped streams). http://cvs.php.net/viewvc.cgi/php-src/main/streams/streams.c?r1=1.82.2.6.2.16r2=1.82.2.6.2.17diff_format=u Index: php-src/main/streams/streams.c diff -u php-src/main/streams/streams.c:1.82.2.6.2.16 php-src/main/streams/streams.c:1.82.2.6.2.17 --- php-src/main/streams/streams.c:1.82.2.6.2.16Wed Jul 11 14:33:30 2007 +++ php-src/main/streams/streams.c Wed Aug 8 02:16:41 2007 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: streams.c,v 1.82.2.6.2.16 2007/07/11 14:33:30 dmitry Exp $ */ +/* $Id: streams.c,v 1.82.2.6.2.17 2007/08/08 02:16:41 iliaa Exp $ */ #define _GNU_SOURCE #include php.h @@ -1313,11 +1313,11 @@ p = php_stream_mmap_range(src, php_stream_tell(src), maxlen, PHP_STREAM_MAP_MODE_SHARED_READONLY, mapped); if (p) { - haveread = php_stream_write(dest, p, mapped); + size_t written = php_stream_write(dest, p, mapped); php_stream_mmap_unmap(src); - return mapped; + return written; } } http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.882r2=1.2027.2.547.2.883diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.882 php-src/NEWS:1.2027.2.547.2.883 --- php-src/NEWS:1.2027.2.547.2.882 Mon Aug 6 19:40:21 2007 +++ php-src/NEWSWed Aug 8 02:16:41 2007 @@ -1,6 +1,8 @@ PHPNEWS ||| ?? Aug 2007, PHP 5.2.4 +- Fixed bug #42237 (stream_copy_to_stream returns invalid values for mmaped + streams). (andrew dot minerd at sellingsource dot com, Ilia) - Fixed bug #4 (possible buffer overflow in php_openssl_make_REQ). (Pierre) - Fixed bug #42208 (substr_replace() crashes when the same array is passed more than once). (crrodriguez at suse dot de, Ilia) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /main/streams streams.c
iliaa Sun Sep 3 16:32:27 2006 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/main/streams streams.c Log: Fixed bug #38661 (mixed-case URL breaks url-wrappers). http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.231r2=1.2027.2.547.2.232diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.231 php-src/NEWS:1.2027.2.547.2.232 --- php-src/NEWS:1.2027.2.547.2.231 Sun Sep 3 15:49:49 2006 +++ php-src/NEWSSun Sep 3 16:32:27 2006 @@ -1,6 +1,8 @@ PHPNEWS ||| ?? Sep 2006, PHP 5.2.0RC4 +- Fixed bug #38661 (mixed-case URL breaks url-wrappers). (Ilia) + 31 Aug 2006, PHP 5.2.0RC3 - Updated PCRE to version 6.7. (Ilia) http://cvs.php.net/viewvc.cgi/php-src/main/streams/streams.c?r1=1.82.2.6.2.4r2=1.82.2.6.2.5diff_format=u Index: php-src/main/streams/streams.c diff -u php-src/main/streams/streams.c:1.82.2.6.2.4 php-src/main/streams/streams.c:1.82.2.6.2.5 --- php-src/main/streams/streams.c:1.82.2.6.2.4 Thu Jul 13 12:00:17 2006 +++ php-src/main/streams/streams.c Sun Sep 3 16:32:27 2006 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: streams.c,v 1.82.2.6.2.4 2006/07/13 12:00:17 tony2001 Exp $ */ +/* $Id: streams.c,v 1.82.2.6.2.5 2006/09/03 16:32:27 iliaa Exp $ */ #define _GNU_SOURCE #include php.h @@ -1526,18 +1526,24 @@ } if (protocol) { - if (FAILURE == zend_hash_find(wrapper_hash, (char*)protocol, n, (void**)wrapperpp)){ - char wrapper_name[32]; - - if (n = sizeof(wrapper_name)) - n = sizeof(wrapper_name) - 1; - PHP_STRLCPY(wrapper_name, protocol, sizeof(wrapper_name), n); + if (FAILURE == zend_hash_find(wrapper_hash, (char*)protocol, n, (void**)wrapperpp)) { + char *tmp = estrndup(protocol, n); + php_strtolower(tmp, n); + if (FAILURE == zend_hash_find(wrapper_hash, (char*)tmp, n, (void**)wrapperpp)) { + char wrapper_name[32]; + + efree(tmp); + if (n = sizeof(wrapper_name)) { + n = sizeof(wrapper_name) - 1; + } + PHP_STRLCPY(wrapper_name, protocol, sizeof(wrapper_name), n); - php_error_docref(NULL TSRMLS_CC, E_NOTICE, Unable to find the wrapper \%s\ - did you forget to enable it when you configured PHP?, - wrapper_name); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, Unable to find the wrapper \%s\ - did you forget to enable it when you configured PHP?, wrapper_name); - wrapperpp = NULL; - protocol = NULL; + wrapperpp = NULL; + protocol = NULL; + } + efree(tmp); } } /* TODO: curl based streams probably support file:// properly */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php