From e12322df865a17cc794b5cd4e9743f105b5a38bd Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Thu, 11 Sep 2014 13:09:08 -0300 Subject: [PHP] Fix throwing a PHP exception through C++ from a subclassed director method - PHP NULL gets returned by the subclassed method in this case, so the directorout typemap needs to allow that (at least if an exception is active). --- Lib/php/php.swg | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Lib/php/php.swg') diff --git a/Lib/php/php.swg b/Lib/php/php.swg index afa047ef6..8b5fb7be3 100644 --- a/Lib/php/php.swg +++ b/Lib/php/php.swg @@ -93,10 +93,12 @@ %typemap(directorout) SWIGTYPE ($&1_ltype tmp) { - if(SWIG_ConvertPtr($input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) { - SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor"); + /* If exit was via exception, PHP NULL is returned so skip the conversion. */ + if (!EG(exception)) { + if(SWIG_ConvertPtr($input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) + SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor"); + $result = *tmp; } - $result = *tmp; } %typemap(in) SWIGTYPE *, -- cgit v1.2.1