Consider the following example:
%module example
class A { };
class B {
public:
int foo(int x);
A foo(string y);
};
This example causes swig to segfault:
$ swig -c++ -php example.i
Segmentation fault
The segmentation fault only occurs if all of the following is true:
* there are at least two overloaded class methods that return different types.
* at least one return type is a class that has been declared to SWIG (eg "class A {};" above).
I'll submit a patch soon that will simply report an error instead of segfaulting, but I don't really consider it a "solution" - more just a temporary fix, and an indication of where the error occurs, so that hopefully someone else who understands php.cxx can take it further :)
One possible workaround is to rename one of the overloads, ie the above example can be fixed by adding:
%rename(foo2) foo(int);
See also "Temporary fix for segmentation fault in php.cxx" https://sourceforge.net/tracker/?func=detail&aid=3168603&group_id=1645&atid=301645
The segfault is because int isn't a class, so the correct response is to just skip to the next potential return type.
Fixed in SVN r12471.