]> granicus.if.org Git - php/commitdiff
Fixed fixedarray iterator fetching
authorXinchen Hui <laruence@gmail.com>
Sat, 15 Mar 2014 05:18:32 +0000 (13:18 +0800)
committerXinchen Hui <laruence@gmail.com>
Sat, 15 Mar 2014 05:18:32 +0000 (13:18 +0800)
ext/spl/spl_fixedarray.c
ext/spl/tests/fixedarray_003.phpt

index 9ab803566341649edaf6f80bd2aa7701e4408b45..2a66b0fb5aeaf7457b004c813ba4aa41cc52f2fa 100644 (file)
@@ -877,7 +877,7 @@ static void spl_fixedarray_it_dtor(zend_object_iterator *iter TSRMLS_DC) /* {{{
 
 static void spl_fixedarray_it_rewind(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
 {
-       spl_fixedarray_object *object = (spl_fixedarray_object*)Z_OBJ(iter->data);
+       spl_fixedarray_object *object = Z_SPLFIXEDARRAY_P(&iter->data);
 
        if (object->flags & SPL_FIXEDARRAY_OVERLOADED_REWIND) {
                zend_user_it_rewind(iter TSRMLS_CC);
@@ -889,7 +889,7 @@ static void spl_fixedarray_it_rewind(zend_object_iterator *iter TSRMLS_DC) /* {{
 
 static int spl_fixedarray_it_valid(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
 {
-       spl_fixedarray_object *object = (spl_fixedarray_object*)Z_OBJ(iter->data);
+       spl_fixedarray_object *object = Z_SPLFIXEDARRAY_P(&iter->data);
 
        if (object->flags & SPL_FIXEDARRAY_OVERLOADED_VALID) {
                return zend_user_it_valid(iter TSRMLS_CC);
@@ -906,7 +906,7 @@ static int spl_fixedarray_it_valid(zend_object_iterator *iter TSRMLS_DC) /* {{{
 static zval *spl_fixedarray_it_get_current_data(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
 {
        zval zindex;
-       spl_fixedarray_object *object = (spl_fixedarray_object*)Z_OBJ(iter->data);
+       spl_fixedarray_object *object = Z_SPLFIXEDARRAY_P(&iter->data);
 
        if (object->flags & SPL_FIXEDARRAY_OVERLOADED_CURRENT) {
                return zend_user_it_get_current_data(iter TSRMLS_CC);
@@ -928,7 +928,7 @@ static zval *spl_fixedarray_it_get_current_data(zend_object_iterator *iter TSRML
 
 static void spl_fixedarray_it_get_current_key(zend_object_iterator *iter, zval *key TSRMLS_DC) /* {{{ */
 {
-       spl_fixedarray_object *object = (spl_fixedarray_object*)Z_OBJ(iter->data);
+       spl_fixedarray_object *object = Z_SPLFIXEDARRAY_P(&iter->data);
 
        if (object->flags & SPL_FIXEDARRAY_OVERLOADED_KEY) {
                zend_user_it_get_current_key(iter, key TSRMLS_CC);
@@ -940,7 +940,7 @@ static void spl_fixedarray_it_get_current_key(zend_object_iterator *iter, zval *
 
 static void spl_fixedarray_it_move_forward(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
 {
-       spl_fixedarray_object *object = (spl_fixedarray_object*)Z_OBJ(iter->data);
+       spl_fixedarray_object *object = Z_SPLFIXEDARRAY_P(&iter->data);
 
        if (object->flags & SPL_FIXEDARRAY_OVERLOADED_NEXT) {
                zend_user_it_move_forward(iter TSRMLS_CC);
@@ -1043,7 +1043,7 @@ zend_object_iterator_funcs spl_fixedarray_it_funcs = {
 
 zend_object_iterator *spl_fixedarray_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC) /* {{{ */
 {
-       spl_fixedarray_it      *iterator;
+       spl_fixedarray_it *iterator;
 
        if (by_ref) {
                zend_throw_exception(spl_ce_RuntimeException, "An iterator cannot be used with foreach by reference", 0 TSRMLS_CC);
index 7a01145a9c012b0905252327a6bf881b6d4cd16a..69cec7528ecc2ace92eedecfa6fb9e63f1a8bbdb 100644 (file)
@@ -4,7 +4,7 @@ SPL: FixedArray: Iterators
 <?php
 class A extends SplFixedArray {
        public $prop1 = "dummy";
-       public $prop1 = "dummy";
+       public $prop2 = "dummy";
 
     public function current() {
         echo "A::current\n";