dmitry                                   Wed, 09 Dec 2009 10:50:10 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=291915

Log:
Fixed wrong result of empty($_GET) in case of uninitialized $_GET

Changed paths:
    U   php/php-src/trunk/Zend/zend_vm_def.h
    U   php/php-src/trunk/Zend/zend_vm_execute.h

Modified: php/php-src/trunk/Zend/zend_vm_def.h
===================================================================
--- php/php-src/trunk/Zend/zend_vm_def.h        2009-12-09 10:39:42 UTC (rev 
291914)
+++ php/php-src/trunk/Zend/zend_vm_def.h        2009-12-09 10:50:10 UTC (rev 
291915)
@@ -4047,9 +4047,24 @@
                                isset = 0;
                        }
                } else {
-                       target_symbol_table = 
zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC);
-                       if (zend_u_hash_find(target_symbol_table, 
Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1, (void **) 
&value) == FAILURE) {
-                               isset = 0;
+                       if (opline->op2.u.EA.type == ZEND_FETCH_AUTO_GLOBAL) {
+                               if (CG(auto_globals_cache)[opline->op2.u.var]) {
+                                       value = 
CG(auto_globals_cache)[opline->op2.u.var];
+                               } else {
+                                       zend_auto_global *auto_global = NULL;
+
+                                       
zend_u_is_auto_global_ex(Z_TYPE_P(varname), Z_UNIVAL_P(varname), 
Z_UNILEN_P(varname), 1, &auto_global TSRMLS_CC);
+                                       if (zend_u_hash_find(&EG(symbol_table), 
Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1, (void **) 
&value) == FAILURE) {
+                                               isset = 0;
+                                       } else if (auto_global && 
(!auto_global->armed || !auto_global->runtime)) {
+                                               
CG(auto_globals_cache)[opline->op2.u.var] = value;
+                                       }
+                               }
+                       } else {
+                               target_symbol_table = 
zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC);
+                               if (zend_u_hash_find(target_symbol_table, 
Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1, (void **) 
&value) == FAILURE) {
+                                       isset = 0;
+                               }
                        }
                }


Modified: php/php-src/trunk/Zend/zend_vm_execute.h
===================================================================
--- php/php-src/trunk/Zend/zend_vm_execute.h    2009-12-09 10:39:42 UTC (rev 
291914)
+++ php/php-src/trunk/Zend/zend_vm_execute.h    2009-12-09 10:50:10 UTC (rev 
291915)
@@ -2304,9 +2304,24 @@
                                isset = 0;
                        }
                } else {
-                       target_symbol_table = 
zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC);
-                       if (zend_u_hash_find(target_symbol_table, 
Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1, (void **) 
&value) == FAILURE) {
-                               isset = 0;
+                       if (opline->op2.u.EA.type == ZEND_FETCH_AUTO_GLOBAL) {
+                               if (CG(auto_globals_cache)[opline->op2.u.var]) {
+                                       value = 
CG(auto_globals_cache)[opline->op2.u.var];
+                               } else {
+                                       zend_auto_global *auto_global = NULL;
+
+                                       
zend_u_is_auto_global_ex(Z_TYPE_P(varname), Z_UNIVAL_P(varname), 
Z_UNILEN_P(varname), 1, &auto_global TSRMLS_CC);
+                                       if (zend_u_hash_find(&EG(symbol_table), 
Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1, (void **) 
&value) == FAILURE) {
+                                               isset = 0;
+                                       } else if (auto_global && 
(!auto_global->armed || !auto_global->runtime)) {
+                                               
CG(auto_globals_cache)[opline->op2.u.var] = value;
+                                       }
+                               }
+                       } else {
+                               target_symbol_table = 
zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC);
+                               if (zend_u_hash_find(target_symbol_table, 
Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1, (void **) 
&value) == FAILURE) {
+                                       isset = 0;
+                               }
                        }
                }

@@ -5729,9 +5744,24 @@
                                isset = 0;
                        }
                } else {
-                       target_symbol_table = 
zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC);
-                       if (zend_u_hash_find(target_symbol_table, 
Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1, (void **) 
&value) == FAILURE) {
-                               isset = 0;
+                       if (opline->op2.u.EA.type == ZEND_FETCH_AUTO_GLOBAL) {
+                               if (CG(auto_globals_cache)[opline->op2.u.var]) {
+                                       value = 
CG(auto_globals_cache)[opline->op2.u.var];
+                               } else {
+                                       zend_auto_global *auto_global = NULL;
+
+                                       
zend_u_is_auto_global_ex(Z_TYPE_P(varname), Z_UNIVAL_P(varname), 
Z_UNILEN_P(varname), 1, &auto_global TSRMLS_CC);
+                                       if (zend_u_hash_find(&EG(symbol_table), 
Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1, (void **) 
&value) == FAILURE) {
+                                               isset = 0;
+                                       } else if (auto_global && 
(!auto_global->armed || !auto_global->runtime)) {
+                                               
CG(auto_globals_cache)[opline->op2.u.var] = value;
+                                       }
+                               }
+                       } else {
+                               target_symbol_table = 
zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC);
+                               if (zend_u_hash_find(target_symbol_table, 
Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1, (void **) 
&value) == FAILURE) {
+                                       isset = 0;
+                               }
                        }
                }

@@ -9386,9 +9416,24 @@
                                isset = 0;
                        }
                } else {
-                       target_symbol_table = 
zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC);
-                       if (zend_u_hash_find(target_symbol_table, 
Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1, (void **) 
&value) == FAILURE) {
-                               isset = 0;
+                       if (opline->op2.u.EA.type == ZEND_FETCH_AUTO_GLOBAL) {
+                               if (CG(auto_globals_cache)[opline->op2.u.var]) {
+                                       value = 
CG(auto_globals_cache)[opline->op2.u.var];
+                               } else {
+                                       zend_auto_global *auto_global = NULL;
+
+                                       
zend_u_is_auto_global_ex(Z_TYPE_P(varname), Z_UNIVAL_P(varname), 
Z_UNILEN_P(varname), 1, &auto_global TSRMLS_CC);
+                                       if (zend_u_hash_find(&EG(symbol_table), 
Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1, (void **) 
&value) == FAILURE) {
+                                               isset = 0;
+                                       } else if (auto_global && 
(!auto_global->armed || !auto_global->runtime)) {
+                                               
CG(auto_globals_cache)[opline->op2.u.var] = value;
+                                       }
+                               }
+                       } else {
+                               target_symbol_table = 
zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC);
+                               if (zend_u_hash_find(target_symbol_table, 
Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1, (void **) 
&value) == FAILURE) {
+                                       isset = 0;
+                               }
                        }
                }

@@ -23770,9 +23815,24 @@
                                isset = 0;
                        }
                } else {
-                       target_symbol_table = 
zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC);
-                       if (zend_u_hash_find(target_symbol_table, 
Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1, (void **) 
&value) == FAILURE) {
-                               isset = 0;
+                       if (opline->op2.u.EA.type == ZEND_FETCH_AUTO_GLOBAL) {
+                               if (CG(auto_globals_cache)[opline->op2.u.var]) {
+                                       value = 
CG(auto_globals_cache)[opline->op2.u.var];
+                               } else {
+                                       zend_auto_global *auto_global = NULL;
+
+                                       
zend_u_is_auto_global_ex(Z_TYPE_P(varname), Z_UNIVAL_P(varname), 
Z_UNILEN_P(varname), 1, &auto_global TSRMLS_CC);
+                                       if (zend_u_hash_find(&EG(symbol_table), 
Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1, (void **) 
&value) == FAILURE) {
+                                               isset = 0;
+                                       } else if (auto_global && 
(!auto_global->armed || !auto_global->runtime)) {
+                                               
CG(auto_globals_cache)[opline->op2.u.var] = value;
+                                       }
+                               }
+                       } else {
+                               target_symbol_table = 
zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC);
+                               if (zend_u_hash_find(target_symbol_table, 
Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1, (void **) 
&value) == FAILURE) {
+                                       isset = 0;
+                               }
                        }
                }


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

Reply via email to