diff --git a/CHANGES.current b/CHANGES.current index 7ec9a304b..01878c7d4 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -1,6 +1,13 @@ Version 1.3.32 (in progress) ============================ +05/26/2007: olly + [PHP5] + Fix wrapping of methods and functions which return a pointer to a + class (bug#1700788) and those which have overloaded forms returning + both classes and non-classes (bug#1712717, thanks to Simon + Berthiaume for the patch). + 05/25/2007: wsfulton Fixed %rename inconsistency in conversion operators as reported by Zhong Ren. The matching is now done on the operator name in the same way as it is done for parameters. For example: diff --git a/Source/Modules/php4.cxx b/Source/Modules/php4.cxx index bfdb0d8c7..a837cb77b 100644 --- a/Source/Modules/php4.cxx +++ b/Source/Modules/php4.cxx @@ -1833,6 +1833,14 @@ public: String *mangled = NewString("_p"); Printf(mangled, "%s", SwigType_manglestr(ret_type)); Node *class_node = Getattr(zend_types, mangled); + if (!class_node) { + /* This is needed when we're returning a pointer to a type + * rather than returning the type by value or reference. */ + class_node = current_class; + Delete(mangled); + mangled = NewString(SwigType_manglestr(ret_type)); + class_node = Getattr(zend_types, mangled); + } if (i.item) { Printf(output, "case \"%s\": ", mangled); } else { @@ -1841,7 +1849,10 @@ public: const char *classname = GetChar(class_node, "sym:name"); if (!classname) classname = GetChar(class_node, "name"); - Printf(output, "return new %s%s($r);\n", prefix, classname); + if (classname) + Printf(output, "return new %s%s($r);\n", prefix, classname); + else + Printf(output, "return $r;\n"); Delete(mangled); } Printf(output, "\t\t}\n");