Don't special case NULL in the REF in typemap
PHP doesn't accept literal NULL for a parameter passed by reference; passing a variable with a value of NULL is just like passing a variable with a different value - we get a PHP reference to the variable, not NULL.
This commit is contained in:
parent
b1923af3ee
commit
26f218327b
1 changed files with 4 additions and 8 deletions
|
|
@ -2,15 +2,11 @@
|
|||
%typemap(in, byref=1) TYPE *REF ($*1_ltype tmp),
|
||||
TYPE &REF ($*1_ltype tmp)
|
||||
%{
|
||||
/* First Check for SWIG wrapped type */
|
||||
if (Z_ISNULL($input)) {
|
||||
$1 = 0;
|
||||
} else if (Z_ISREF($input)) {
|
||||
/* Not swig wrapped type, so we check if it's a PHP reference type */
|
||||
CONVERT_IN(tmp, $*1_ltype, $input);
|
||||
$1 = &tmp;
|
||||
if (Z_ISREF($input)) {
|
||||
CONVERT_IN(tmp, $*1_ltype, $input);
|
||||
$1 = &tmp;
|
||||
} else {
|
||||
SWIG_PHP_Error(E_ERROR, SWIG_PHP_Arg_Error_Msg($argnum, Expected a reference));
|
||||
SWIG_PHP_Error(E_ERROR, SWIG_PHP_Arg_Error_Msg($argnum, Expected a reference));
|
||||
}
|
||||
%}
|
||||
%typemap(argout) TYPE *REF,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue