From b97af6c1c02525aa5525a80b2d6b627aa212673b Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Fri, 23 Sep 2005 09:38:37 +0000 Subject: [PATCH] MF5.1: - store current value of error_reporting only if it's not stored yet - reset old_error_reporting to NULL only it points to the tmp_var at current opline --- Zend/zend_vm_def.h | 14 +++++++++----- Zend/zend_vm_execute.h | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index bdf22f717e..7b51bf9833 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -3586,10 +3586,12 @@ ZEND_VM_HANDLER(79, ZEND_EXIT, CONST|TMP|VAR|UNUSED|CV, ANY) ZEND_VM_HANDLER(57, ZEND_BEGIN_SILENCE, ANY, ANY) { zend_op *opline = EX(opline); - - EX_T(opline->result.u.var).tmp_var.value.lval = EG(error_reporting); - EX_T(opline->result.u.var).tmp_var.type = IS_LONG; /* shouldn't be necessary */ - EX(old_error_reporting) = &EX_T(opline->result.u.var).tmp_var; + + if (EX(old_error_reporting) == NULL) { + EX_T(opline->result.u.var).tmp_var.value.lval = EG(error_reporting); + EX_T(opline->result.u.var).tmp_var.type = IS_LONG; /* shouldn't be necessary */ + EX(old_error_reporting) = &EX_T(opline->result.u.var).tmp_var; + } if (EG(error_reporting)) { zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); @@ -3615,7 +3617,9 @@ ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY) zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); zendi_zval_dtor(restored_error_reporting); } - EX(old_error_reporting) = NULL; + if (EX(old_error_reporting) == &EX_T(opline->op1.u.var).tmp_var) { + EX(old_error_reporting) = NULL; + } ZEND_VM_NEXT_OPCODE(); } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 7db81b0d53..1e4e82bf77 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -437,10 +437,12 @@ static int ZEND_NEW_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) static int ZEND_BEGIN_SILENCE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - - EX_T(opline->result.u.var).tmp_var.value.lval = EG(error_reporting); - EX_T(opline->result.u.var).tmp_var.type = IS_LONG; /* shouldn't be necessary */ - EX(old_error_reporting) = &EX_T(opline->result.u.var).tmp_var; + + if (EX(old_error_reporting) == NULL) { + EX_T(opline->result.u.var).tmp_var.value.lval = EG(error_reporting); + EX_T(opline->result.u.var).tmp_var.type = IS_LONG; /* shouldn't be necessary */ + EX(old_error_reporting) = &EX_T(opline->result.u.var).tmp_var; + } if (EG(error_reporting)) { zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); @@ -4793,7 +4795,9 @@ static int ZEND_END_SILENCE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); zendi_zval_dtor(restored_error_reporting); } - EX(old_error_reporting) = NULL; + if (EX(old_error_reporting) == &EX_T(opline->op1.u.var).tmp_var) { + EX(old_error_reporting) = NULL; + } ZEND_VM_NEXT_OPCODE(); } -- 2.50.1