Re: Zend Engine.

From: Date: Fri, 08 Jul 2005 23:30:02 +0000
Subject: Re: Zend Engine.
References: 1 2 3 4 5  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-2589@lists.php.net to get a copy of this message
On Jul 8, 2005, at 1:50 PM, Michael Wallner wrote:
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
Hey Mike, Thanks for the response. For the record and my ego, I have been a C programmer for a long time, and I have done extensive work in C++. My email with the multiple frees was an illustration of my frustration with the inconsistencies I had experienced. I am sorry that everyone is so caught up on that one email, because I asked a lot of direct questions in other emails. The Zend engine is really powerful, but it is sloppy, and I am having trouble figuring out the logic of it.

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