[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).
This commit is contained in:
Olly Betts 2014-09-11 13:09:08 -03:00
commit e12322df86
4 changed files with 80 additions and 6 deletions

View file

@ -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 *,