mirror of https://github.com/swig/swig
php: Fix char* typecheck typemap to accept Null
The corresponding in typemap already does. Fixes #1655, reported by CJSlominski.
This commit is contained in:
parent
157465f65b
commit
b7dedecfdd
|
@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
|||
Version 4.1.0 (in progress)
|
||||
===========================
|
||||
|
||||
2021-03-18: olly
|
||||
#1655 [PHP] Fix char* typecheck typemap to accept PHP Null like the
|
||||
corresponding in typemap does.
|
||||
|
||||
2021-03-18: olly
|
||||
#1900, #1905 [PHP] Fix wrapping of overloaded directed methods with
|
||||
non-void return.
|
||||
|
|
|
@ -23,4 +23,7 @@ class Unknown;
|
|||
int test2(Unknown* unknown) { return 0; }
|
||||
int test2(Base* base) { return 1; }
|
||||
|
||||
int test3(const char*, const Base* = 0, bool = false) { return 0; }
|
||||
int test3(Base&, const char* = 0, const Base* = 0, bool = false) { return 1; }
|
||||
|
||||
%}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
require "tests.php";
|
||||
require "overload_polymorphic.php";
|
||||
|
||||
$t = new Derived();
|
||||
|
||||
check::equal(overload_polymorphic::test($t), 0, "test(Derived)");
|
||||
check::equal(overload_polymorphic::test(1), 1, "test(1)");
|
||||
check::equal(overload_polymorphic::test2($t), 1, "test2(Derived)");
|
||||
check::equal(overload_polymorphic::test3($t, null, $t), 1, "test3(Derived, null, Derived)");
|
||||
|
||||
check::done();
|
||||
?>
|
|
@ -465,7 +465,10 @@
|
|||
%php_typecheck(double,SWIG_TYPECHECK_DOUBLE,IS_DOUBLE)
|
||||
%php_typecheck(char,SWIG_TYPECHECK_CHAR,IS_STRING)
|
||||
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_STRING) char *, char *&, char []
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_STRING) char *, char *&
|
||||
" $1 = (Z_TYPE($input) == IS_STRING || Z_TYPE($input) == IS_NULL); "
|
||||
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_STRING) char []
|
||||
" $1 = (Z_TYPE($input) == IS_STRING); "
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE
|
||||
|
|
Loading…
Reference in New Issue