helly           Thu Feb  2 22:17:42 2006 UTC

  Modified files:              (Branch: PHP_5_1)
    /php-src/ext/spl    spl_array.c 
  Log:
  - MFH Fix ArrayIterator::seek() edge cases
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.7&r2=1.71.2.8&diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.71.2.7 
php-src/ext/spl/spl_array.c:1.71.2.8
--- php-src/ext/spl/spl_array.c:1.71.2.7        Sun Jan  1 12:50:13 2006
+++ php-src/ext/spl/spl_array.c Thu Feb  2 22:17:42 2006
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: spl_array.c,v 1.71.2.7 2006/01/01 12:50:13 sniper Exp $ */
+/* $Id: spl_array.c,v 1.71.2.8 2006/02/02 22:17:42 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -999,15 +999,12 @@
 
        if (position >= 0) { /* negative values are not supported */
                zend_hash_internal_pointer_reset_ex(aht, &intern->pos);
+               result = SUCCESS;
                
                while (position-- > 0 && (result = spl_array_next(intern 
TSRMLS_CC)) == SUCCESS);
        
-               if (intern->pos && (intern->ar_flags & SPL_ARRAY_IS_REF) && 
spl_hash_verify_pos(intern TSRMLS_CC) == FAILURE) {
-                       /* fail */
-               } else {
-                       if (zend_hash_has_more_elements_ex(aht, &intern->pos) 
== SUCCESS) {
-                               return; /* ok */
-                       }
+               if (result == SUCCESS && zend_hash_has_more_elements_ex(aht, 
&intern->pos) == SUCCESS) {
+                       return; /* ok */
                }
        }
        zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Seek 
position %ld is out of range", opos);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to