[PHP] Stop generating a bogus line of code in certain constructors.

This was mostly harmless, but caused a PHP notice to be issued, if
enabled (SF#2985684).


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12033 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2010-05-21 07:07:15 +00:00
commit e512093358
2 changed files with 13 additions and 6 deletions

View file

@ -1,6 +1,11 @@
Version 2.0.0 (in progress) Version 2.0.0 (in progress)
============================ ============================
2010-05-21: olly
[PHP] Stop generating a bogus line of code in certain constructors.
This was mostly harmless, but caused a PHP notice to be issued, if
enabled (SF#2985684).
2010-05-18: wsfulton 2010-05-18: wsfulton
[Java] Fix member pointers on 64 bit platforms. [Java] Fix member pointers on 64 bit platforms.

View file

@ -1495,7 +1495,7 @@ public:
Printf(prepare, "case %d: ", ++last_handled_i); Printf(prepare, "case %d: ", ++last_handled_i);
} }
if (Cmp(d, "void") != 0) { if (Cmp(d, "void") != 0) {
if ((!directorsEnabled() || !Swig_directorclass(n)) && !newobject) { if ((!directorsEnabled() || !Swig_directorclass(n)) && !newobject) {
Append(prepare, "$r="); Append(prepare, "$r=");
} else { } else {
Printf(prepare, "$this->%s=", SWIG_PTR); Printf(prepare, "$this->%s=", SWIG_PTR);
@ -1631,11 +1631,13 @@ public:
Printf(output, "%s", prepare); Printf(output, "%s", prepare);
if (constructor) { if (constructor) {
if (!directorsEnabled() || !Swig_directorclass(n)) { if (!directorsEnabled() || !Swig_directorclass(n)) {
if (strcmp(methodname, "__construct") == 0) { if (!Len(prepare)) {
Printf(output, "\t\t$this->%s=%s;\n", SWIG_PTR, invoke); if (strcmp(methodname, "__construct") == 0) {
} else { Printf(output, "\t\t$this->%s=%s;\n", SWIG_PTR, invoke);
String *classname = Swig_class_name(current_class); } else {
Printf(output, "\t\treturn new %s(%s);\n", classname, invoke); String *classname = Swig_class_name(current_class);
Printf(output, "\t\treturn new %s(%s);\n", classname, invoke);
}
} }
} else { } else {
Node *parent = Swig_methodclass(n); Node *parent = Swig_methodclass(n);