]> granicus.if.org Git - php/commitdiff
- Fixed bug #27923. foreach() without a key should not check if the key
authorAndi Gutmans <andi@php.net>
Fri, 23 Apr 2004 21:53:46 +0000 (21:53 +0000)
committerAndi Gutmans <andi@php.net>
Fri, 23 Apr 2004 21:53:46 +0000 (21:53 +0000)
- is a reference (Adam)

Zend/zend_compile.c

index c7d12b1cbb68b2151743449ae79d05185741dd50..23bb96b1e1de4e9cc7d2e745d7ed502cd51227c6 100644 (file)
@@ -3333,7 +3333,7 @@ void zend_do_foreach_cont(znode *value, znode *key, znode *as_token, znode *fore
                value = tmp;
        }
 
-       if (key->u.EA.type & ZEND_PARSED_REFERENCE_VARIABLE) {
+       if ((key->op_type != IS_UNUSED) && (key->u.EA.type & ZEND_PARSED_REFERENCE_VARIABLE)) {
                zend_error(E_COMPILE_ERROR, "Key element cannot be a reference");
        }