Commit:    0c996613c0173708381f4bfcd28d2441360bc701
Author:    Xinchen Hui <larue...@php.net>         Sat, 21 Jul 2012 22:45:16 
+0800
Parents:   a6f1533789b897d3b8930b437164e81e0a0f4c72
Branches:  PHP-5.4

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=0c996613c0173708381f4bfcd28d2441360bc701

Log:
Fixed bug #62616 (ArrayIterator::count() from IteratorIterator instance gives 
Segmentation fault)

Bugs:
https://bugs.php.net/62616

Changed paths:
  M  NEWS
  M  ext/spl/spl_iterators.c
  A  ext/spl/tests/bug62616.phpt


Diff:
diff --git a/NEWS b/NEWS
index 9cd089c..8ae6931 100644
--- a/NEWS
+++ b/NEWS
@@ -32,6 +32,8 @@ PHP                                                           
             NEWS
   . Implemented FR #55218 Get namespaces from current node. (Lonny)
 
 - SPL:
+  . Fixed bug #62616 (ArrayIterator::count() from IteratorIterator instance
+    gives Segmentation fault). (Laruence, Gustavo)
   . Fixed bug #61527 (ArrayIterator gives misleading notice on next() when 
     moved to the end). (reeze....@gmail.com)
 
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index 19a68f6..e5dc030 100755
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -1289,6 +1289,8 @@ static union _zend_function *spl_dual_it_get_method(zval 
**object_ptr, char *met
                                *object_ptr = intern->inner.zobject;
                                function_handler = 
Z_OBJ_HT_P(*object_ptr)->get_method(object_ptr, method, method_len, key 
TSRMLS_CC);
                        }
+               } else {
+                       *object_ptr = intern->inner.zobject;
                }
        }
        return function_handler;
diff --git a/ext/spl/tests/bug62616.phpt b/ext/spl/tests/bug62616.phpt
new file mode 100644
index 0000000..4e4be94
--- /dev/null
+++ b/ext/spl/tests/bug62616.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #62616 (ArrayIterator::count() from IteratorIterator instance gives 
Segmentation fault)
+--FILE--
+<?php
+$ai = new ArrayIterator(array(0,1));
+
+var_dump($ai->count());
+
+$ii = new IteratorIterator($ai);
+
+var_dump($ii->count());
+?>
+--EXPECTF--
+int(2)
+int(2)


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

Reply via email to