# Patch for bug #49936

- Thread: https://externals.io/message/46039
- Original archive: https://news-web.php.net/php.internals/46039
- Started by Pierrick Charron on 2009-11-13T10:26:33+00:00
- Messages: 2
- 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

---

## #46039 — Pierrick Charron — 2009-11-13T10:26:33+00:00

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

Hi,

I created a patch for the bug #49936.

The problem was due to the new way to manage references of stream context.
The patch increase the refcount of the context when it's assigned to a
stream (in the method php_stream_context_set).
A zend_list_delete is already called on the context when the stream is
destroyed to do the opposit.

There is two different version of the patch. The better one (because
it's not using TSRMLS_FETCH) modify the php_stream_context_set which
may be used by some of the PECL extensions. And of course the second
version of the patch use TSRMLS_FETCH to avoid signature modification.

http://www.adoy.net/php/stream-nofetch.diff
http://www.adoy.net/php/stream-fetch.diff

I also wrote two phpt for this bug :

http://www.adoy.net/php/phpt/bug49936-phpt.tgz

Thanks for feedbacks.
Pierrick

---

## #46043 — Felipe Pena — 2009-11-15T20:36:34+00:00

URL: https://externals.io/message/46039#46043 · In reply to: #46039

Hi Pierrick,

2009/11/13 Pierrick Charron <pierrick@webstart.fr>

> Hi,
>
> I created a patch for the bug #49936.
>
> The problem was due to the new way to manage references of stream context.
> The patch increase the refcount of the context when it's assigned to a
> stream (in the method php_stream_context_set).
> A zend_list_delete is already called on the context when the stream is
> destroyed to do the opposit.
>
> There is two different version of the patch. The better one (because
> it's not using TSRMLS_FETCH) modify the php_stream_context_set which
> may be used by some of the PECL extensions. And of course the second
> version of the patch use TSRMLS_FETCH to avoid signature modification.
>
> http://www.adoy.net/php/stream-nofetch.diff
> http://www.adoy.net/php/stream-fetch.diff
>
> I also wrote two phpt for this bug :
>
> http://www.adoy.net/php/phpt/bug49936-phpt.tgz
>
> Thanks for feedbacks.
> Pierrick
>
>
>
Committed! Thanks for the patch again!

-- 
Regards,
Felipe Pena
