lbarnaud                Thu Sep 11 15:32:15 2008 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/ext/spl/tests      bug46053.phpt 

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/spl    spl_directory.c 
  Log:
  MFH: Fixed #46053 (SplFileObject::seek - Endless loop)
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1224&r2=1.2027.2.547.2.1225&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1224 php-src/NEWS:1.2027.2.547.2.1225
--- php-src/NEWS:1.2027.2.547.2.1224    Thu Sep 11 15:24:11 2008
+++ php-src/NEWS        Thu Sep 11 15:32:15 2008
@@ -18,6 +18,7 @@
   (Scott)
 - Fixed a crash on invalid method in ReflectionParameter constructor.
   (Christian Seiler)
+- Fixed buf #46053 (SplFileObject::seek - Endless loop). (Arnaud)
 - Fixed bug #46051 (SplFileInfo::openFile - memory overlap). (Arnaud)
 - Fixed bug #46047 (SimpleXML converts empty nodes into object with nested 
   array). (Rob)
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.45.2.27.2.28&r2=1.45.2.27.2.29&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.28 
php-src/ext/spl/spl_directory.c:1.45.2.27.2.29
--- php-src/ext/spl/spl_directory.c:1.45.2.27.2.28      Thu Sep 11 15:24:12 2008
+++ php-src/ext/spl/spl_directory.c     Thu Sep 11 15:32:15 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: spl_directory.c,v 1.45.2.27.2.28 2008/09/11 15:24:12 lbarnaud Exp $ */
+/* $Id: spl_directory.c,v 1.45.2.27.2.29 2008/09/11 15:32:15 lbarnaud Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -2215,7 +2215,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

Reply via email to