cataphract                               Sun, 08 May 2011 19:59:42 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=310844

Log:
- Merged to 5.3 change in trunk in _php_stream_free. This prevents the segfault
  in the testcase for bug #53624. The testcase still has to be fixed though,
  because it only works as intended on Windows.

Bug: http://bugs.php.net/53624 (Closed) NULL also works for $row
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/main/streams/streams.c

Modified: php/php-src/branches/PHP_5_3/main/streams/streams.c
===================================================================
--- php/php-src/branches/PHP_5_3/main/streams/streams.c 2011-05-08 19:35:02 UTC 
(rev 310843)
+++ php/php-src/branches/PHP_5_3/main/streams/streams.c 2011-05-08 19:59:42 UTC 
(rev 310844)
@@ -355,7 +355,12 @@

        /* If not called from the resource dtor, remove the stream from the 
resource list. */
        if ((close_options & PHP_STREAM_FREE_RSRC_DTOR) == 0 && remove_rsrc) {
-               zend_list_delete(stream->rsrc_id);
+               /* zend_list_delete actually only decreases the refcount; if 
we're
+                * releasing the stream, we want to actually delete the 
resource from
+                * the resource list, otherwise the resource will point to 
invalid memory.
+                * In any case, let's always completely delete it from the 
resource list,
+                * not only when PHP_STREAM_FREE_RELEASE_STREAM is set */
+               while (zend_list_delete(stream->rsrc_id) == SUCCESS) {}
        }

        /* Remove stream from any context link list */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to