summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2015-04-12 21:00:12 +0200
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2015-04-12 21:00:12 +0200
commite7d68e6bf1ceecdee6cb4df3f41edf6f94ad25a3 (patch)
treefff5bb4ec47e1e39ec7b7a9e211b66a34fb6dd0a
parent8779ed80dd5d6794f9d3739a2c2cf10f6b2ee767 (diff)
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
-rw-r--r--zend/executestate.h18
-rw-r--r--zend/opcodes.h2
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
/**
@@ -42,15 +49,22 @@ private:
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