Fix some cases of converting PHP NULL to C++ NULL

Fixes testcase overload_null for PHP 8.0
This commit is contained in:
Olly Betts 2021-04-13 15:54:25 +12:00
commit 836258b9d3
2 changed files with 9 additions and 32 deletions

View file

@ -86,14 +86,10 @@
/* Object passed by value. Convert to a pointer */
%typemap(in) SWIGTYPE ($&1_ltype tmp)
%{
if ($needNewFlow) {
$1 = *(($1_ltype *)$obj_value);
} else {
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;
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(directorout) SWIGTYPE ($&1_ltype tmp)
@ -115,35 +111,23 @@
%typemap(in) SWIGTYPE *,
SWIGTYPE []
%{
if ($needNewFlow) {
$1 = ($1_ltype) $obj_value;
} else {
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");
}
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 &,
SWIGTYPE &&
%{
if ($needNewFlow) {
$1 = ($1_ltype) $obj_value;
} else {
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");
}
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 *const& ($*ltype temp)
%{
if ($needNewFlow) {
temp = ($*1_ltype) $obj_value;
} else {
if (SWIG_ConvertPtr(&$input, (void **) &temp, $*1_descriptor, 0) < 0) {
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $*1_descriptor");
}
if (SWIG_ConvertPtr(&$input, (void **) &temp, $*1_descriptor, 0) < 0) {
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $*1_descriptor");
}
$1 = ($1_ltype)&temp;
%}