# ze1 question (bug 23132)

- Thread: https://externals.io/message/844
- Original archive: https://news-web.php.net/php.internals/844
- Started by George Schlossnagle on 2003-04-10T20:46:08+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #844 — George Schlossnagle — 2003-04-10T20:46:08+00:00

URL: https://externals.io/message/844#844

I'm trying to track down a ze1 bug for edin:

http://bugs.php.net/bug.php?id=23132

What's happening is that under certain conditions (like the testcase in 
the bug)

Variables passed by reference into a function are being reference 
counted in ZEND_RECV (correct), but not being dereferenced when the 
function ends and their copy-pointer falls out of scope.  In the test 
case this is done in a loop, which eventually causes the zvals refcount 
to overflow causing it to be accidentally garbage collected, causing a 
segfault.

I've found and witnessed all of the above, but I'm not sure where the 
variables should be deref'd when the function ends.  Any pointers from 
anyone in the know?

---

## #873 — Rob Richards — 2003-04-12T09:33:56+00:00

URL: https://externals.io/message/844#873 · In reply to: #844

I am looking to use getter/setter functionality within classes in an
extension. After going through the object_handler piece, it looks like the
only way to implement it is by using a single function which then must
handle performing the appropriate function based on the property that was
passed in. The only examples I could see using this functionality were
extensions which were working against external objects (such as the ones in
the rpc extensions). Is this the only way to do this or are there any other
calls that can be used (similar to the add_property_x calls but which would
allow you to specify a function for the get/set)?

If so, is it possible to use a hash table for each class which would have
the property and a function so that when the property name is passed in to
the _get/_set handler it can look up the property and then call the
appropriate function?
Now that being said how can a private hash be setup on a class basis and how
is the memory destruction to be handled for a private hash?

Last question concerns streams. How stable are streams at this point? Its
been a while since I had seen talk about streams other than when they were
first being introduced. We are possibly looking to implement some
functionality using streams (not a priority in the extension at this point),
but want to know wether it is something to consider or not.

Thanks,

Rob Richards

---

## #875 — Wez Furlong — 2003-04-12T13:06:58+00:00

URL: https://externals.io/message/844#875 · In reply to: #873

> If so, is it possible to use a hash table for each class which would have
> the property and a function so that when the property name is passed in to
> the _get/_set handler it can look up the property and then call the
> appropriate function?
> Now that being said how can a private hash be setup on a class basis and how
> is the memory destruction to be handled for a private hash?

Look at ext/rpc, ext/adt and ext/mysqli.

> Last question concerns streams. How stable are streams at this point? Its
> been a while since I had seen talk about streams other than when they were
> first being introduced. We are possibly looking to implement some
> functionality using streams (not a priority in the extension at this point),
> but want to know wether it is something to consider or not.

Stable (despite some hiccups in 4.3.0).

<plug>
I recommend reading my articles in PHP Magazine http://php-mag.net if
you are planning to develop your own streams.
</plug>

Also note that you should not use ANSI stdio within PHP if you want your
extension to be portable; AT&T based libc (Solaris) has braindead limits
on the number of files you can open, and that limit may have already
been reached or exceeded even before PHP and the Zend Engine have been
started to handle the request.

--Wez.
