lbarnaud Thu Sep 11 15:31:58 2008 UTC
Added files: (Branch: PHP_5_3)
/php-src/ext/spl/tests bug46053.phpt
Modified files:
/php-src/ext/spl spl_directory.c
Log:
MFH: Fixed #46053 (SplFileObject::seek - Endless loop)
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.45.2.27.2.23.2.30&r2=1.45.2.27.2.23.2.31&diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.30
php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.31
--- php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.30 Thu Sep 11 15:22:48 2008
+++ php-src/ext/spl/spl_directory.c Thu Sep 11 15:31:58 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.30 2008/09/11 15:22:48 lbarnaud Exp
$ */
+/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.31 2008/09/11 15:31:58 lbarnaud Exp
$ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -2469,7 +2469,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