php: Fix overloaded directed methods with non-void return

We were treating  such methods like constructors and assigning to the
internal _cPtr, which just seems bizarrely wrong.

Fixes #1900
This commit is contained in:
Olly Betts 2020-12-09 09:48:55 +13:00
commit 2e7da86b2c
4 changed files with 34 additions and 3 deletions

View file

@ -1566,7 +1566,7 @@ public:
Printf(prepare, "case %d: ", ++last_handled_i);
}
if (non_void_return) {
if ((!directorsEnabled() || !Swig_directorclass(n)) && !constructor) {
if (!constructor) {
Append(prepare, "$r=");
} else if (wrapperType == staticmemberfn || wrapperType == staticmembervar) {
Append(prepare, "$r=");
@ -1590,7 +1590,7 @@ public:
if (had_a_case)
Printf(prepare, "default: ");
if (non_void_return) {
if ((!directorsEnabled() || !Swig_directorclass(n)) && !constructor) {
if (!constructor) {
Append(prepare, "$r=");
} else if (wrapperType == staticmemberfn || wrapperType == staticmembervar) {
Append(prepare, "$r=");