diff options
Diffstat (limited to 'zend')
-rw-r--r-- | zend/opcodes.h | 3 | ||||
-rw-r--r-- | zend/origexception.h | 11 | ||||
-rw-r--r-- | zend/value.cpp | 5 |
3 files changed, 8 insertions, 11 deletions
diff --git a/zend/opcodes.h b/zend/opcodes.h index 1901f1f..0a79b97 100644 --- a/zend/opcodes.h +++ b/zend/opcodes.h @@ -93,8 +93,7 @@ public: // was an exception thrown inside the eval()'ed code? In that case we // throw a C++ new exception to give the C++ code the chance to catch it - // todo: OrigException with constructor for zend_object - // if (oldException != EG(exception) && EG(exception)) throw OrigException(EG(exception) TSRMLS_CC); + if (oldException != EG(exception) && EG(exception)) throw OrigException(EG(exception) TSRMLS_CC); // we're ready if there is no return value if (ZVAL_IS_NULL(&retval)) return nullptr; diff --git a/zend/origexception.h b/zend/origexception.h index f997608..fb873bd 100644 --- a/zend/origexception.h +++ b/zend/origexception.h @@ -16,7 +16,7 @@ namespace Php { /** * Class definition */ -class OrigException : public Value, public Exception +class OrigException : public Exception { private: /** @@ -42,10 +42,9 @@ private: public: /** * Constructor - * @param val + * @param object The object that was thrown */ - OrigException(zval *val TSRMLS_DC) : - Value(val), Exception("OrigException") + OrigException(zend_object *object) : Exception(std::string{ ZSTR_VAL(object->ce->name), ZSTR_LEN(object->ce->name) }) { #ifdef ZTS // copy tsrm_ls @@ -58,7 +57,7 @@ public: * @param exception */ OrigException(const OrigException &exception) : - Value(exception), Exception("OrigException"), _handled(exception._handled) + Exception("OrigException"), _handled(exception._handled) { #ifdef ZTS // copy tsrm_ls @@ -71,7 +70,7 @@ public: * @param exception */ OrigException(OrigException &&exception) : - Value(std::move(exception)), Exception("OrigException"), _handled(exception._handled) + Exception("OrigException"), _handled(exception._handled) { // set other exception to handled so that it wont do anything on destruction exception._handled = true; diff --git a/zend/value.cpp b/zend/value.cpp index 4aaec4c..d87e576 100644 --- a/zend/value.cpp +++ b/zend/value.cpp @@ -846,7 +846,7 @@ static Value do_exec(const zval *object, zval *method, int argc, zval *argv) TSRMLS_FETCH(); // the current exception - // zend_object *oldException = EG(exception); + zend_object *oldException = EG(exception); // call the function // we're casting the const away here, object is only const so we can call this method @@ -863,8 +863,7 @@ static Value do_exec(const zval *object, zval *method, int argc, zval *argv) { // was an exception thrown inside the function? In that case we throw a C++ new exception // to give the C++ code the chance to catch it - // @todo: make OrigException except a zend_object instance - // if (oldException != EG(exception) && EG(exception)) throw OrigException(EG(exception) TSRMLS_CC); + if (oldException != EG(exception) && EG(exception)) throw OrigException(EG(exception) TSRMLS_CC); // leap out if nothing was returned if (Z_ISUNDEF(retval)) return nullptr; |