Re: C'Mon Guys, Lend Me a Hand Here!

From: Date: Fri, 08 Jul 2005 17:50:20 +0000
Subject: Re: C'Mon Guys, Lend Me a Hand Here!
References: 1 2 3 4  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-2585@lists.php.net to get a copy of this message
herrwitten@php.net wrote:
I have read through many modules and through Zend internals, but I can't figure out what I need to do.
Did you read a book about C programming so far? You must not free anything more than once. It's not a good idea to start writing a PHP extension without learning some C basics (and probably more) -- I know that, because I made the same mistake like you and tried to cook up some C code with minimal knowledge. Most of the time you'll want to use zval_ptr_dtor(zval **) to "destroy" zvals, because it takes care about the refcount and only frees the "contents" of the zval if the refcount reaches 0. It's just (bad) luck when the memory at the address of a freed location still contains the data you expect. I know it's very hard to get answers about php/ext coding, so it is even more important to ask the questions in a meaningful way. You'll also find many unanswered questions of mine in the archive. The pecl/http repository contains thousands of "blood & sweat" lines of code, perhaps you can find some answers there. Regards, Mike

« previous php.pecl.dev (#2585) next »