Don't segfault if PHP Null is passed where a C++ reference is wanted.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9094 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2006-05-07 01:10:31 +00:00
commit ee62933ea5
2 changed files with 20 additions and 8 deletions

View file

@ -1,6 +1,10 @@
Version 1.3.30 (in progress)
============================
05/07/2006: olly
[php] Don't segfault if PHP Null is passed where a C++ reference
is wanted.
05/05/2006: olly
[php] Fix wrappers generated for global 'char' variables to not
include a terminating zero in the PHP string.

View file

@ -76,21 +76,29 @@
/* Object passed by value. Convert to a pointer */
%typemap(in) SWIGTYPE ($&1_ltype tmp)
{
if(SWIG_ConvertPtr(*$input, (void **) &tmp, $&1_descriptor, 0) < 0) {
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");
}
$1 = *tmp;
}
%typemap(in) SWIGTYPE *,
SWIGTYPE [],
SWIGTYPE &
SWIGTYPE []
{
/* typemap(in) SWIGTYPE * */
/* typemap(in) SWIGTYPE * or SWIGTYPE [] */
if(SWIG_ConvertPtr(*$input, (void **) &$1, $1_descriptor, 0) < 0) {
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor");
}
}
%typemap(in) SWIGTYPE &
{
/* typemap(in) SWIGTYPE & */
if(SWIG_ConvertPtr(*$input, (void **) &$1, $1_descriptor, 0) < 0 || $1 == NULL) {
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor");
}
}
%typemap(in) SWIGTYPE *DISOWN
{
/* typemap(in) SWIGTYPE *DISOWN */