Another patch, from http://bugs.php.net/17547 (it got wrapped as usual in the report). The gets() emulation in _php_stream_gets() didn't really work.
- Markus -- GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc Wishlist: http://guru.josefine.at/~mfischer/wishlist
Index: streams.c =================================================================== RCS file: /repository/php4/main/streams.c,v retrieving revision 1.52 diff -u -r1.52 streams.c --- streams.c 30 Apr 2002 00:22:44 -0000 1.52 +++ streams.c 1 Jun 2002 00:53:22 -0000 @@ -248,21 +248,13 @@ return NULL; } else { /* unbuffered fgets - poor performance ! */ - size_t n = 1; char *c = buf; /* TODO: look at error returns? */ - while(n < maxlen && stream->ops->read(stream, c, 1 TSRMLS_CC) > 0) { - n++; - if (*c == '\n') { - c++; - break; - } - c++; - } - *c = 0; - return buf; + while (--maxlen > 0 && stream->ops->read(stream, buf, 1 TSRMLS_CC) == +1 && *buf++ != '\n'); + *buf = '\0'; + return c == buf && maxlen > 0 ? NULL : c; } }
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php