Fix bug #1613673 (bad PHP5 code generated for getters and setters).

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9613 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2006-12-14 02:15:58 +00:00
commit 4f7099cb56
2 changed files with 6 additions and 2 deletions

View file

@ -2325,7 +2325,7 @@ public:
}
} else {
Printf(s_phpclasses, "\t\t$func = '%s_'.$var.'_set';\n", shadow_classname);
Printf(s_phpclasses, "\t\tif (function_exists($func) call_user_func($func,$this->%s,$value);\n", SWIG_PTR);
Printf(s_phpclasses, "\t\tif (function_exists($func)) call_user_func($func,$this->%s,$value);\n", SWIG_PTR);
}
Printf(s_phpclasses, "\t}\n");
/* FIXME: also create __isset for PHP 5.1 and later? */
@ -2346,7 +2346,7 @@ public:
}
} else {
Printf(s_phpclasses, "\t\t$func = '%s_'.$var.'_get';\n", shadow_classname);
Printf(s_phpclasses, "\t\tif (function_exists($func) return call_user_func($func,$this->%s);\n", SWIG_PTR);
Printf(s_phpclasses, "\t\tif (function_exists($func)) return call_user_func($func,$this->%s);\n", SWIG_PTR);
}
// Reading an unknown property name gives null in PHP.
Printf(s_phpclasses, "\t\treturn null;\n");