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

@ -1,6 +1,10 @@
Version 1.3.30 (in progress) Version 1.3.30 (in progress)
============================ ============================
06/17/2006: olly
[php] Don't segfault if PHP Null is passed as this pointer (e.g.
Class_method(Null)) - give a PHP Error instead.
06/15/2006: mutandiz 06/15/2006: mutandiz
[allegrocl] [allegrocl]
Add initial support for std::list container class. Add initial support for std::list container class.
@ -50,7 +54,7 @@ Version 1.3.30 (in progress)
05/05/2006: olly 05/05/2006: olly
[php] Fix wrappers generated for global 'char' variables to not [php] Fix wrappers generated for global 'char' variables to not
include a terminating zero in the PHP string. include a terminating zero byte in the PHP string.
05/03/2006: wsfulton 05/03/2006: wsfulton
Modify typemaps so that char * can be applied to unsigned char * or signed char * Modify typemaps so that char * can be applied to unsigned char * or signed char *

View file

@ -1045,7 +1045,7 @@ public:
// errors, or find a better way of dealing with _thisptr. // errors, or find a better way of dealing with _thisptr.
// I would like, if objects are wrapped, to assume _thisptr is always // I would like, if objects are wrapped, to assume _thisptr is always
// _this and not the first argument. // _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++) { for (i = 0, p = l; i < num_arguments; i++) {
String * source; String * source;
@ -1086,6 +1086,9 @@ public:
Replaceall(tm,"$input", source); Replaceall(tm,"$input", source);
Setattr(p,"emit:input", source); Setattr(p,"emit:input", source);
Printf(f->code,"%s\n",tm); 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"); p = Getattr(p,"tmap:in:next");
if (i >= num_required) { if (i >= num_required) {
Printf(f->code,"}\n"); Printf(f->code,"}\n");