Don't segfault if PHP Null is passed as this pointer (e.g.

Class_method(Null)) - give a PHP Error instead.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9166 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2006-06-17 01:33:17 +00:00
commit d95e0cce8a
2 changed files with 9 additions and 2 deletions

View file

@ -1045,7 +1045,7 @@ public:
// errors, or find a better way of dealing with _thisptr.
// I would like, if objects are wrapped, to assume _thisptr is always
// _this and not the first argument.
// This may mean looking at Lang::memberfunctionhandler
// This may mean looking at Language::memberfunctionHandler
for (i = 0, p = l; i < num_arguments; i++) {
String * source;
@ -1086,6 +1086,9 @@ public:
Replaceall(tm,"$input", source);
Setattr(p,"emit:input", source);
Printf(f->code,"%s\n",tm);
if (i == 0 && HashGetAttr(p, k_self)) {
Printf(f->code,"\tif(!arg1) SWIG_PHP_Error(E_ERROR, \"this pointer is NULL\");\n");
}
p = Getattr(p,"tmap:in:next");
if (i >= num_required) {
Printf(f->code,"}\n");