diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/exception.cpp | 17 | ||||
-rw-r--r-- | src/function.cpp | 19 | ||||
-rw-r--r-- | src/includes.h | 4 | ||||
-rwxr-xr-x | src/libphpcpp.so | bin | 132258 -> 132736 bytes |
4 files changed, 27 insertions, 13 deletions
diff --git a/src/exception.cpp b/src/exception.cpp new file mode 100644 index 0000000..19591db --- /dev/null +++ b/src/exception.cpp @@ -0,0 +1,17 @@ +/** + * Exception.cpp + * Implementation of Php Exceptions. + * + * @author Jasper van Eck <jasper.vaneck@copernica.com> + * @copyright 2013 Copernica BV + */ + +#include "includes.h" + +/** + * Set up namespace + */ +namespace Php { + + +} diff --git a/src/function.cpp b/src/function.cpp index 9376751..fe96745 100644 --- a/src/function.cpp +++ b/src/function.cpp @@ -38,20 +38,15 @@ void invoke_function(INTERNAL_FUNCTION_PARAMETERS) Parameters params(this_ptr, ZEND_NUM_ARGS()); // the function could throw an exception - //try - //{ + try + { // get the result result = function->invoke(*PHPCPP_G(environment), params); - //} - //catch (const Php::Exception &exception) - //{ - // cout << "got exception"; - - // @todo throw the exception.... - - - - //} + } + catch (const Php::Exception &exception) + { + zend_throw_exception(zend_exception_get_default(), exception.getMessage(), 0 TSRMLS_CC); + } } /** diff --git a/src/includes.h b/src/includes.h index 87b5d64..ac99950 100644 --- a/src/includes.h +++ b/src/includes.h @@ -17,6 +17,7 @@ #include <map> #include <memory> #include <set> +#include <exception> // for debugging #include <iostream> @@ -25,7 +26,7 @@ * PHP includes */ #include <php.h> - +#include "zend_exceptions.h" /** * Macro to convert results to success status */ @@ -55,6 +56,7 @@ #include "../include/class.h" #include "../include/classinfo.h" #include "../include/extension.h" +#include "../include/exception.h" #include "../include/globals.h" /** diff --git a/src/libphpcpp.so b/src/libphpcpp.so Binary files differindex 2c5827d..8403d89 100755 --- a/src/libphpcpp.so +++ b/src/libphpcpp.so |