diff options
Diffstat (limited to 'Zend')
-rw-r--r-- | Zend/tests/bug68162.phpt | 14 | ||||
-rw-r--r-- | Zend/zend_vm_def.h | 6 | ||||
-rw-r--r-- | Zend/zend_vm_execute.h | 72 |
3 files changed, 53 insertions, 39 deletions
diff --git a/Zend/tests/bug68162.phpt b/Zend/tests/bug68162.phpt new file mode 100644 index 0000000000..24e412f18d --- /dev/null +++ b/Zend/tests/bug68162.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #68162: isset($$varname) always true +--FILE-- +<?php + +$name = 'var'; +var_dump(isset($$name)); +$var = 42; +var_dump(isset($$name)); + +?> +--EXPECT-- +bool(false) +bool(true) diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index e330a58d5e..4f9f520e5a 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -4855,7 +4855,6 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR) isset = 0; } } else { - HashTable *target_symbol_table; zend_free_op free_op1; zval tmp, *varname = GET_OP1_ZVAL_PTR(BP_VAR_IS); @@ -4886,8 +4885,9 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR) isset = 0; } } else { - target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); - if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) { + HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); + value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname)); + if (!value || Z_ISUNDEF_P(value)) { isset = 0; } } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index ded78a5484..7d16db6011 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -4586,7 +4586,6 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_CONST_HANDLER(ZEND_O isset = 0; } } else { - HashTable *target_symbol_table; zval tmp, *varname = opline->op1.zv; @@ -4617,8 +4616,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_CONST_HANDLER(ZEND_O isset = 0; } } else { - target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); - if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) { + HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); + value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname)); + if (!value || Z_ISUNDEF_P(value)) { isset = 0; } } @@ -7010,7 +7010,6 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPC isset = 0; } } else { - HashTable *target_symbol_table; zval tmp, *varname = opline->op1.zv; @@ -7041,8 +7040,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPC isset = 0; } } else { - target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); - if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) { + HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); + value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname)); + if (!value || Z_ISUNDEF_P(value)) { isset = 0; } } @@ -7886,7 +7886,6 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_ isset = 0; } } else { - HashTable *target_symbol_table; zval tmp, *varname = opline->op1.zv; @@ -7917,8 +7916,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_ isset = 0; } } else { - target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); - if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) { + HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); + value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname)); + if (!value || Z_ISUNDEF_P(value)) { isset = 0; } } @@ -11304,7 +11304,6 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC isset = 0; } } else { - HashTable *target_symbol_table; zend_free_op free_op1; zval tmp, *varname = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -11335,8 +11334,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC isset = 0; } } else { - target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); - if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) { + HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); + value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname)); + if (!value || Z_ISUNDEF_P(value)) { isset = 0; } } @@ -13639,7 +13639,6 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD isset = 0; } } else { - HashTable *target_symbol_table; zend_free_op free_op1; zval tmp, *varname = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -13670,8 +13669,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD isset = 0; } } else { - target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); - if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) { + HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); + value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname)); + if (!value || Z_ISUNDEF_P(value)) { isset = 0; } } @@ -14390,7 +14390,6 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OP isset = 0; } } else { - HashTable *target_symbol_table; zend_free_op free_op1; zval tmp, *varname = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -14421,8 +14420,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OP isset = 0; } } else { - target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); - if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) { + HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); + value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname)); + if (!value || Z_ISUNDEF_P(value)) { isset = 0; } } @@ -19348,7 +19348,6 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPC isset = 0; } } else { - HashTable *target_symbol_table; zend_free_op free_op1; zval tmp, *varname = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -19379,8 +19378,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPC isset = 0; } } else { - target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); - if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) { + HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); + value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname)); + if (!value || Z_ISUNDEF_P(value)) { isset = 0; } } @@ -23737,7 +23737,6 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD isset = 0; } } else { - HashTable *target_symbol_table; zend_free_op free_op1; zval tmp, *varname = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -23768,8 +23767,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD isset = 0; } } else { - target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); - if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) { + HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); + value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname)); + if (!value || Z_ISUNDEF_P(value)) { isset = 0; } } @@ -25077,7 +25077,6 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OP isset = 0; } } else { - HashTable *target_symbol_table; zend_free_op free_op1; zval tmp, *varname = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -25108,8 +25107,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OP isset = 0; } } else { - target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); - if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) { + HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); + value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname)); + if (!value || Z_ISUNDEF_P(value)) { isset = 0; } } @@ -36517,7 +36517,6 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCO isset = 0; } } else { - HashTable *target_symbol_table; zval tmp, *varname = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC); @@ -36548,8 +36547,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCO isset = 0; } } else { - target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); - if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) { + HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); + value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname)); + if (!value || Z_ISUNDEF_P(value)) { isset = 0; } } @@ -40704,7 +40704,6 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE isset = 0; } } else { - HashTable *target_symbol_table; zval tmp, *varname = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC); @@ -40735,8 +40734,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE isset = 0; } } else { - target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); - if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) { + HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); + value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname)); + if (!value || Z_ISUNDEF_P(value)) { isset = 0; } } @@ -41917,7 +41917,6 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPC isset = 0; } } else { - HashTable *target_symbol_table; zval tmp, *varname = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC); @@ -41948,8 +41947,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPC isset = 0; } } else { - target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); - if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) { + HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); + value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname)); + if (!value || Z_ISUNDEF_P(value)) { isset = 0; } } |