com php-src: Revert "Simplify ZEND_EXIT and count boole an values to it as exit status": NEWS UPGRA DING Zend/zend_vm_def.h Zend/zend_vm_execute.h
Zend/zend_vm_gen.php
| From: | Dmitry Stogov | Date: | Tue, 11 Aug 2015 23:58:21 +0000 |
| Subject: | com php-src: Revert "Simplify ZEND_EXIT and count boole an values to it as exit status": NEWS UPGRA DING Zend/zend_vm_def.h Zend/zend_vm_execute.h Zend/zend_vm_gen.php |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-88483@lists.php.net to get a copy of this message | ||
Commit: fef086d11326f8f3c16628e6d64ef56e26c648ec
Author: Dmitry Stogov <dmitry@zend.com> Wed, 12 Aug 2015 02:58:21 +0300
Parents: 9e290a44f142a17f7239ff21ecc61565aa7f4e68
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fef086d11326f8f3c16628e6d64ef56e26c648ec
Log:
Revert "Simplify ZEND_EXIT and count boolean values to it as exit status"
This reverts commit 7c003948c618adb2a6691f529057388f02202f09.
Changed paths:
M NEWS
M UPGRADING
M Zend/zend_vm_def.h
M Zend/zend_vm_execute.h
M Zend/zend_vm_gen.php
Diff:
diff --git a/NEWS b/NEWS
index 74ccbce..3d02db7 100644
--- a/NEWS
+++ b/NEWS
@@ -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).
diff --git a/UPGRADING b/UPGRADING
index b9b4c69..6f42065 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -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 9286f41..c968fd2 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 3f9583a..5645ed6 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 a66002c..cb4ac84 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(