[PHP] An overloaded method which can return an object or a
primitive type no longer causes SWIG to segfault. Reported by Paul Colby in SF#3168531. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12471 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
3cee7b7b3e
commit
bf7c9e9a42
4 changed files with 28 additions and 1 deletions
|
|
@ -5,6 +5,11 @@ See the RELEASENOTES file for a summary of changes in each release.
|
|||
Version 2.0.2 (in progress)
|
||||
===========================
|
||||
|
||||
2011-02-18: olly
|
||||
[PHP] An overloaded method which can return an object or a
|
||||
primitive type no longer causes SWIG to segfault. Reported by Paul
|
||||
Colby in SF#3168531.
|
||||
|
||||
2011-02-18: olly
|
||||
[PHP] Fix invalid erase during iteration of std::map in generated
|
||||
director code. Reported by Cory Bennett in SF#3175820.
|
||||
|
|
|
|||
|
|
@ -140,6 +140,7 @@ CPP_TEST_CASES += \
|
|||
conversion \
|
||||
conversion_namespace \
|
||||
conversion_ns_template \
|
||||
covariant_return \
|
||||
cplusplus_throw \
|
||||
cpp_basic \
|
||||
cpp_enum \
|
||||
|
|
|
|||
16
Examples/test-suite/covariant_return.i
Normal file
16
Examples/test-suite/covariant_return.i
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
%module covariant_return
|
||||
|
||||
// Regression test for PHP from SF#3168531i (SWIG <= 2.0.1 segfaults).
|
||||
|
||||
%inline %{
|
||||
|
||||
#include <string>
|
||||
using namespace std;
|
||||
class A { };
|
||||
class B {
|
||||
public:
|
||||
int foo(int x);
|
||||
A foo(string y);
|
||||
};
|
||||
|
||||
%}
|
||||
|
|
@ -1718,7 +1718,6 @@ public:
|
|||
while (i.item) {
|
||||
SwigType *ret_type = i.item;
|
||||
i = Next(i);
|
||||
Printf(output, "\t\t");
|
||||
String *mangled = NewString("_p");
|
||||
Printf(mangled, "%s", SwigType_manglestr(ret_type));
|
||||
Node *class_node = Getattr(zend_types, mangled);
|
||||
|
|
@ -1729,7 +1728,13 @@ public:
|
|||
Delete(mangled);
|
||||
mangled = NewString(SwigType_manglestr(ret_type));
|
||||
class_node = Getattr(zend_types, mangled);
|
||||
if (!class_node) {
|
||||
// Return type isn't an object, so will be handled by the
|
||||
// !is_resource() check before the switch.
|
||||
continue;
|
||||
}
|
||||
}
|
||||
Printf(output, "\t\t");
|
||||
if (i.item) {
|
||||
Printf(output, "case '%s': ", mangled);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue