From e7d68e6bf1ceecdee6cb4df3f41edf6f94ad25a3 Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Sun, 12 Apr 2015 21:00:12 +0200 Subject: Complete magic! The compiler somehow optimizes the ExecuteClass out when called with no parameters whatsoever, by passing an extra argument this no longer happens. This fixes the problem that we had with Php::eval(), fix issue #183 --- zend/executestate.h | 18 ++++++++++++++++-- zend/opcodes.h | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/zend/executestate.h b/zend/executestate.h index 8e33b16..d71a252 100644 --- a/zend/executestate.h +++ b/zend/executestate.h @@ -26,11 +26,18 @@ class ExecuteState private: /** * All the original settings + * @var mixed */ zend_op_array *_active_op_array; zval **_return_value_ptr_ptr; zend_op **_opline_ptr; int _interactive; + + /** + * The new value for 'no-extensions' + * @var int + */ + int _no_extensions; #ifdef ZTS /** @@ -41,16 +48,23 @@ private: #endif public: + /** + * No trivial constructor + */ + ExecuteState() = delete; + /** * Constructor + * @param no_extensions */ - ExecuteState(TSRMLS_D) + ExecuteState(int no_extensions TSRMLS_DC) { // store all the original stuff _active_op_array = EG(active_op_array); _return_value_ptr_ptr = EG(return_value_ptr_ptr); _opline_ptr = EG(opline_ptr); _interactive = CG(interactive); + _no_extensions = no_extensions; #ifdef ZTS // copy tsrm_ls param @@ -65,7 +79,7 @@ public: { // restore all settings CG(interactive) = _interactive; - EG(no_extensions) = 0; + EG(no_extensions) = _no_extensions; EG(opline_ptr) = _opline_ptr; EG(active_op_array) = _active_op_array; EG(return_value_ptr_ptr) = _return_value_ptr_ptr; diff --git a/zend/opcodes.h b/zend/opcodes.h index 7e6d1ec..4e78083 100644 --- a/zend/opcodes.h +++ b/zend/opcodes.h @@ -74,7 +74,7 @@ public: // the zend engine is probably already busy processing opcodes, so we store // the current execute state before we're going to switch the runtime to // our own set of opcodes - ExecuteState oldstate(TSRMLS_C); + ExecuteState execState(0 TSRMLS_CC); // old execute state has been saved (and will automatically be restured when // the oldstate is destructed), so we can now safely overwrite all the settings -- cgit v1.2.3