diff options
author | Dmitry Stogov <dmitry@zend.com> | 2015-08-12 02:58:21 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2015-08-12 02:58:21 +0300 |
commit | fef086d11326f8f3c16628e6d64ef56e26c648ec (patch) | |
tree | c0e3914d1cdb72b73897fb900952b4d23b95d7ae | |
parent | 9e290a44f142a17f7239ff21ecc61565aa7f4e68 (diff) | |
download | php-git-fef086d11326f8f3c16628e6d64ef56e26c648ec.tar.gz |
Revert "Simplify ZEND_EXIT and count boolean values to it as exit status"
This reverts commit 7c003948c618adb2a6691f529057388f02202f09.
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | UPGRADING | 1 | ||||
-rw-r--r-- | Zend/zend_vm_def.h | 27 | ||||
-rw-r--r-- | Zend/zend_vm_execute.h | 96 | ||||
-rw-r--r-- | Zend/zend_vm_gen.php | 4 |
5 files changed, 76 insertions, 54 deletions
@@ -13,8 +13,6 @@ PHP NEWS . Fixed bug #70198 (Checking liveness does not work as expected). (Shafreeck Sea, Anatol Belski) . Fixed bug #70241 (Skipped assertions affect Generator returns). (Bob) - . exit() and die() interpret all scalars except strings as exit_status now. - (Bob) - CLI server: . Fixed bug #66606 (Sets HTTP_CONTENT_TYPE but not CONTENT_TYPE). @@ -425,7 +425,6 @@ Other language changes . Removed support for #-style comments in ini files. Use ;-style comments instead. . $HTTP_RAW_POST_DATA is no longer available. Use the php://input stream instead. - . exit() and die() interpret all scalars except strings as exit_status now. Standard library changes ======================== diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 9286f41ca7..c968fd2907 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -6637,17 +6637,22 @@ ZEND_VM_HANDLER(79, ZEND_EXIT, CONST|TMPVAR|UNUSED|CV, ANY) SAVE_OPLINE(); if (OP1_TYPE != IS_UNUSED) { zend_free_op free_op1; - zval *ptr = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R); - - if (Z_TYPE_P(ptr) == IS_LONG) { - EG(exit_status) = Z_LVAL_P(ptr); - } else if (Z_TYPE_P(ptr) == IS_TRUE || Z_TYPE_P(ptr) == IS_FALSE || Z_TYPE_P(ptr) == IS_NULL) { - EG(exit_status) = Z_TYPE_P(ptr) == IS_TRUE; - } else if (Z_TYPE_P(ptr) == IS_DOUBLE) { - EG(exit_status) = (int) Z_DVAL_P(ptr); - } else { - zend_print_variable(ptr); - } + zval *ptr = GET_OP1_ZVAL_PTR(BP_VAR_R); + + do { + if (Z_TYPE_P(ptr) == IS_LONG) { + EG(exit_status) = Z_LVAL_P(ptr); + } else { + if ((OP1_TYPE & (IS_VAR|IS_CV)) && Z_ISREF_P(ptr)) { + ptr = Z_REFVAL_P(ptr); + if (Z_TYPE_P(ptr) == IS_LONG) { + EG(exit_status) = Z_LVAL_P(ptr); + break; + } + } + zend_print_variable(ptr); + } + } while (0); FREE_OP1(); } zend_bailout(); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 3f9583a642..5645ed625a 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -3966,15 +3966,20 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_EXIT_SPEC_CONST_HANDLER(ZEND_O zval *ptr = EX_CONSTANT(opline->op1); - if (Z_TYPE_P(ptr) == IS_LONG) { - EG(exit_status) = Z_LVAL_P(ptr); - } else if (Z_TYPE_P(ptr) == IS_TRUE || Z_TYPE_P(ptr) == IS_FALSE || Z_TYPE_P(ptr) == IS_NULL) { - EG(exit_status) = Z_TYPE_P(ptr) == IS_TRUE; - } else if (Z_TYPE_P(ptr) == IS_DOUBLE) { - EG(exit_status) = (int) Z_DVAL_P(ptr); - } else { - zend_print_variable(ptr); - } + do { + if (Z_TYPE_P(ptr) == IS_LONG) { + EG(exit_status) = Z_LVAL_P(ptr); + } else { + if ((IS_CONST & (IS_VAR|IS_CV)) && Z_ISREF_P(ptr)) { + ptr = Z_REFVAL_P(ptr); + if (Z_TYPE_P(ptr) == IS_LONG) { + EG(exit_status) = Z_LVAL_P(ptr); + break; + } + } + zend_print_variable(ptr); + } + } while (0); } zend_bailout(); @@ -22766,15 +22771,20 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_EXIT_SPEC_UNUSED_HANDLER(ZEND_ zval *ptr = NULL; - if (Z_TYPE_P(ptr) == IS_LONG) { - EG(exit_status) = Z_LVAL_P(ptr); - } else if (Z_TYPE_P(ptr) == IS_TRUE || Z_TYPE_P(ptr) == IS_FALSE || Z_TYPE_P(ptr) == IS_NULL) { - EG(exit_status) = Z_TYPE_P(ptr) == IS_TRUE; - } else if (Z_TYPE_P(ptr) == IS_DOUBLE) { - EG(exit_status) = (int) Z_DVAL_P(ptr); - } else { - zend_print_variable(ptr); - } + do { + if (Z_TYPE_P(ptr) == IS_LONG) { + EG(exit_status) = Z_LVAL_P(ptr); + } else { + if ((IS_UNUSED & (IS_VAR|IS_CV)) && Z_ISREF_P(ptr)) { + ptr = Z_REFVAL_P(ptr); + if (Z_TYPE_P(ptr) == IS_LONG) { + EG(exit_status) = Z_LVAL_P(ptr); + break; + } + } + zend_print_variable(ptr); + } + } while (0); } zend_bailout(); @@ -29355,17 +29365,22 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_EXIT_SPEC_CV_HANDLER(ZEND_OPCO SAVE_OPLINE(); if (IS_CV != IS_UNUSED) { - zval *ptr = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var); + zval *ptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var); - if (Z_TYPE_P(ptr) == IS_LONG) { - EG(exit_status) = Z_LVAL_P(ptr); - } else if (Z_TYPE_P(ptr) == IS_TRUE || Z_TYPE_P(ptr) == IS_FALSE || Z_TYPE_P(ptr) == IS_NULL) { - EG(exit_status) = Z_TYPE_P(ptr) == IS_TRUE; - } else if (Z_TYPE_P(ptr) == IS_DOUBLE) { - EG(exit_status) = (int) Z_DVAL_P(ptr); - } else { - zend_print_variable(ptr); - } + do { + if (Z_TYPE_P(ptr) == IS_LONG) { + EG(exit_status) = Z_LVAL_P(ptr); + } else { + if ((IS_CV & (IS_VAR|IS_CV)) && Z_ISREF_P(ptr)) { + ptr = Z_REFVAL_P(ptr); + if (Z_TYPE_P(ptr) == IS_LONG) { + EG(exit_status) = Z_LVAL_P(ptr); + break; + } + } + zend_print_variable(ptr); + } + } while (0); } zend_bailout(); @@ -40492,17 +40507,22 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_EXIT_SPEC_TMPVAR_HANDLER(ZEND_ SAVE_OPLINE(); if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) { zend_free_op free_op1; - zval *ptr = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1); + zval *ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1); - if (Z_TYPE_P(ptr) == IS_LONG) { - EG(exit_status) = Z_LVAL_P(ptr); - } else if (Z_TYPE_P(ptr) == IS_TRUE || Z_TYPE_P(ptr) == IS_FALSE || Z_TYPE_P(ptr) == IS_NULL) { - EG(exit_status) = Z_TYPE_P(ptr) == IS_TRUE; - } else if (Z_TYPE_P(ptr) == IS_DOUBLE) { - EG(exit_status) = (int) Z_DVAL_P(ptr); - } else { - zend_print_variable(ptr); - } + do { + if (Z_TYPE_P(ptr) == IS_LONG) { + EG(exit_status) = Z_LVAL_P(ptr); + } else { + if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && Z_ISREF_P(ptr)) { + ptr = Z_REFVAL_P(ptr); + if (Z_TYPE_P(ptr) == IS_LONG) { + EG(exit_status) = Z_LVAL_P(ptr); + break; + } + } + zend_print_variable(ptr); + } + } while (0); zval_ptr_dtor_nogc(free_op1); } zend_bailout(); diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php index a66002c1aa..cb4ac8433b 100644 --- a/Zend/zend_vm_gen.php +++ b/Zend/zend_vm_gen.php @@ -186,7 +186,7 @@ $op1_get_zval_ptr_deref = array( "CONST" => "EX_CONSTANT(opline->op1)", "UNUSED" => "NULL", "CV" => "_get_zval_ptr_cv_deref_\\1(execute_data, opline->op1.var)", - "TMPVAR" => "_get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1)", + "TMPVAR" => "???", ); $op2_get_zval_ptr_deref = array( @@ -196,7 +196,7 @@ $op2_get_zval_ptr_deref = array( "CONST" => "EX_CONSTANT(opline->op2)", "UNUSED" => "NULL", "CV" => "_get_zval_ptr_cv_deref_\\1(execute_data, opline->op2.var)", - "TMPVAR" => "_get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2)", + "TMPVAR" => "???", ); $op1_get_zval_ptr_undef = array( |