segfauls with ZEND_FETCH_RESOURCE (my first php extension...)
| From: | Christian Stocker | Date: | Sun, 18 Nov 2001 20:36:52 +0000 |
| Subject: | segfauls with ZEND_FETCH_RESOURCE (my first php extension...) | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-70829@lists.php.net to get a copy of this message | ||
Hi
I wrote today my first php-extension and so far, everything worked fine,
until i used ZEND_FETCH_RESOURCE. My module seems not to be able to handle
that well, 'cause if i use it like the other extensions, i get a segfault.
The offending line is:
ZEND_FETCH_RESOURCE(test, php_test*, arg1, -1, "magick object",
le_magick);
which produces the following segfault (from gdb):
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 7524)]
0x40224fa9 in zend_fetch_resource (passed_id=0x8123634, default_id=-1,
resource_type_name=0x4037a630 "magick object",
found_resource_type=0x0,
num_resource_types=1) at zend_list.c:123
123 } else if ((*passed_id)->type != IS_RESOURCE) {
If i change the -1 to 1, then it handles Resource ID #1 without any
problem, but that's certainly not the solution, since everyone else uses
the -1....
I stripped my code down until it does not much useful, only the ressource
stuff, but i still get segfaults.
The code is accesible at http://cvs.bitflux.ch/index.cgi/pearlib/magick/
any help/hints/etc is/are very welcome. I'm sure it's something very
stupid.
BTW: at www.zend.com/apidoc are some (important) tables missing...
chregu
--
nam...christian stocker adr...bremgartnerstr. 66, ch-8003 zurich
pho...+41 1 451 6021 www...http://phant.ch/chregu
mob...+41 76 561 8860 ema...chregu@phant.ch
wor...+41 1 240 5670 gpg...0x5CE1DECB