lbarnaud Thu Sep 11 15:31:48 2008 UTC
Added files:
/php-src/ext/spl/tests bug46053.phpt
Modified files:
/php-src/ext/spl spl_directory.c
Log:
Fixed #46053 (SplFileObject::seek - Endless loop)
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.165&r2=1.166&diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.165
php-src/ext/spl/spl_directory.c:1.166
--- php-src/ext/spl/spl_directory.c:1.165 Thu Sep 11 15:22:17 2008
+++ php-src/ext/spl/spl_directory.c Thu Sep 11 15:31:48 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_directory.c,v 1.165 2008/09/11 15:22:17 lbarnaud Exp $ */
+/* $Id: spl_directory.c,v 1.166 2008/09/11 15:31:48 lbarnaud Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -2612,7 +2612,9 @@
spl_filesystem_file_rewind(getThis(), intern TSRMLS_CC);
while(intern->u.file.current_line_num < line_pos) {
- spl_filesystem_file_read_line(getThis(), intern, 1 TSRMLS_CC);
+ if (spl_filesystem_file_read_line(getThis(), intern, 1
TSRMLS_CC) == FAILURE) {
+ break;
+ }
}
} /* }}} */
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug46053.phpt?view=markup&rev=1.1
Index: php-src/ext/spl/tests/bug46053.phpt
+++ php-src/ext/spl/tests/bug46053.phpt
--TEST--
Bug #46053 (SplFileObject::seek - Endless loop)
--FILE--
<?php
$x = new splfileobject(__FILE__);
$x->getPathName();
$x->seek(10);
$x->seek(0);
var_dump(trim($x->fgets()));
--EXPECTF--
string(%d) "<?php"
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php