helly           Mon Feb  6 01:30:26 2006 UTC

  Modified files:              
    /php-src/ext/spl    spl_array.c 
  Log:
  - Simplify
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_array.c?r1=1.92&r2=1.93&diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.92 php-src/ext/spl/spl_array.c:1.93
--- php-src/ext/spl/spl_array.c:1.92    Mon Feb  6 00:58:11 2006
+++ php-src/ext/spl/spl_array.c Mon Feb  6 01:30:26 2006
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: spl_array.c,v 1.92 2006/02/06 00:58:11 helly Exp $ */
+/* $Id: spl_array.c,v 1.93 2006/02/06 01:30:26 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -819,18 +819,6 @@
                }
                return NULL;
        }
-#if MBO_0
-       /* We enable by ref if the returned thing does. If it is an 
ArrayIterator */
-       /* or derived then it does if it's current() method is not overloaded. 
*/
-       if (by_ref && ce_it && instanceof_function(ce_it, zend_ce_iterator 
TSRMLS_CC)) {
-               if (!ce_it->iterator_funcs.zf_current) {
-                       zend_hash_find(&ce->function_table, "current", 
sizeof("current"), (void **) &ce_it->iterator_funcs.zf_current);
-               }
-               if (ce_it->iterator_funcs.zf_current->common.scope != 
spl_ce_ArrayObject) {
-                       zend_error(E_ERROR, "An iterator cannot be used with 
foreach by reference");
-               }
-       }
-#endif
 
        new_iterator = ce_it->get_iterator(ce_it, iterator, by_ref TSRMLS_CC);
        zval_ptr_dtor(&iterator);
@@ -843,16 +831,10 @@
        spl_array_it       *iterator;
        spl_array_object   *array_object = 
(spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
 
-       if (by_ref) {
-               if (!ce->iterator_funcs.zf_current) {
-                       zend_hash_find(&ce->function_table, "current", 
sizeof("current"), (void **) &ce->iterator_funcs.zf_current);
-               }
-               if (array_object->ar_flags & SPL_ARRAY_OVERLOADED_CURRENT) {
-                       zend_error(E_ERROR, "An iterator cannot be used with 
foreach by reference");
-               }
+       if (by_ref && (array_object->ar_flags & SPL_ARRAY_OVERLOADED_CURRENT)) {
+               zend_error(E_ERROR, "An iterator cannot be used with foreach by 
reference");
        }
 
-
        iterator     = emalloc(sizeof(spl_array_it));
 
        object->refcount++;

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

Reply via email to