ID:               49936
 Updated by:       pierr...@php.net
 Reported By:      marielyne at acanac dot net
 Status:           Closed
 Bug Type:         Filesystem function related
 Operating System: Windows 7
 PHP Version:      5.3SVN-2009-10-20 (snap)
 Assigned To:      pierrick
 New Comment:

Unfortunately the patch was not applied on time for the 5.3.1 release
and if I remember well, the opendir() test only crashed when PHP is
compiled with --enable-debug. That's probably why you can't reproduce
it.



Previous Comments:
------------------------------------------------------------------------

[2009-11-28 16:20:18] marielyne at acanac dot net

Did it make it in time for 5.3.1 ?
The opendir() test passes, but original issue remains

<?php
$file = 'ftp://ftp.gnu.org/gnu/m4/m4-1.4.13.tar.xz.sig';
var_dump(
 $fr1 = fopen($file, 'rb'),
 fclose($fr1),
 $fr2 = fopen($file, 'rb'),
 fclose($fr2)
);
?>

------------------------------------------------------------------------

[2009-11-15 20:31:13] fel...@php.net

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Thanks for the patch!

------------------------------------------------------------------------

[2009-11-15 20:30:59] s...@php.net

Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&revision=290796
Log: - Fixed bug #49936 (crash with ftp stream in
php_stream_context_get_option())
  (patch by Pierrick)

------------------------------------------------------------------------

[2009-11-12 00:14:51] pierr...@php.net

The same problem can be reproduce with the following code 

<?php
$dir = 'ftp://your:s...@localhost/';

opendir($dir);
opendir($dir);

This bug was introduce in 5.3 with the new way to manage references of
stream context.

Patch can be found here (it modify the php_stream_context_set
signature) :
http://www.adoy.net/php/stream-nofetch.diff

Or here (same version but with TSRMLS_FETCH to avoid any signature
modification):
http://www.adoy.net/php/stream-fetch.diff

------------------------------------------------------------------------

[2009-10-24 20:06:23] marielyne at acanac dot net

New information

Reproduce code:
---------------
<?php
$file = 'ftp://your:s...@localhost/test.txt';

echo "start\n";
$fo1 = fopen($file, 'rb');
echo "opened.1\n";
fclose($fo1);
echo "closed.1\n";
$fo2 = fopen($file, 'rb');
echo "opened.2\n";
fclose($fo2);
echo "closed.2\n";
?>


Expected result:
----------------
start
opened.1
closed.1
opened.2
closed.2


Actual result:
--------------
start
opened.1
closed.1


Same result if opening different files
Same result if opening different files from different servers

However, if I move first fclose() below second fopen(), it works as
expected

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/49936

-- 
Edit this bug report at http://bugs.php.net/?id=49936&edit=1

Reply via email to