[PHP5] Change the default input typemap for char * to turn PHP

Null into C NULL (previously it was converted to an empty string).
The new behaviour is consistent with how the corresponding output
typemap works.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10864 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2008-09-18 14:02:15 +00:00
commit 16c8749768
2 changed files with 21 additions and 2 deletions

View file

@ -1,6 +1,21 @@
Version 1.3.37 (in progress)
=============================
2008-09-18: olly
[PHP5] Change the default input typemap for char * to turn PHP
Null into C NULL (previously it was converted to an empty string).
The new behaviour is consistent with how the corresponding output
typemap works.
If you want to keep the old behaviour, add the following typemap
to your interface file (PHP's convert_to_string_ex() function does
the converting from PHP Null to an empty string):
%typemap(in) char * {
convert_to_string_ex($input);
$1 = Z_STRVAL_PP($input);
}
2008-09-18: olly
[PHP5] Fix extra code added to proxy class constructors in the case
where the only constructor takes no arguments.

View file

@ -24,8 +24,12 @@
%enddef
%define CONVERT_STRING_IN(lvar,t,invar)
convert_to_string_ex(invar);
lvar = (t) Z_STRVAL_PP(invar);
if ((*invar)->type==IS_NULL) {
lvar = (t) 0;
} else {
convert_to_string_ex(invar);
lvar = (t) Z_STRVAL_PP(invar);
}
%enddef
%define %pass_by_val( TYPE, CONVERT_IN )