Re: referencing Superglobals with variable variables inside functions

From: Date: Thu, 03 Feb 2005 22:12:04 +0000
Subject: Re: referencing Superglobals with variable variables inside functions
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to internals+get-14598@lists.php.net to get a copy of this message
Sara Golemon wrote:
Index: Zend/zend_execute.c =================================================================== RCS file: /repository/ZendEngine2/zend_execute.c,v retrieving revision 1.692 diff -u -r1.692 zend_execute.c
--- Zend/zend_execute.c 22 Jan 2005 02:29:18 -0000      1.692
+++ Zend/zend_execute.c 31 Jan 2005 22:13:50 -0000 @@ -1001,6 +1001,10 @@ {
        switch (opline->op2.u.EA.type) {
                case ZEND_FETCH_LOCAL:
+                       if (zend_hash_exists(CG(auto_globals),
variable->value.str.val, variable->value.str.len + 1)) {
+                               /* Dynamically resolved auto global */
+                               return &EG(symbol_table);
+                       }
                        return EG(active_symbol_table);
                        break;
                case ZEND_FETCH_GLOBAL:
i must admit, that i don't know very much about the zend engine and the php core in general, but if "opline->op2.u.EA.type" "knows" if the variable is a local one, a global one or a static one, why hasn't it the value of ZEND_FETCH_GLOBAL for superglobals in the first place? Michael

« previous php.internals (#14598) next »