#49936 [Opn]: crash with ftp stream in php_stream_context_get_option()

From: Date: Sat, 24 Oct 2009 20:06:23 +0000
Subject: #49936 [Opn]: crash with ftp stream in php_stream_context_get_option()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-143905@lists.php.net to get a copy of this message
 ID:               49936
 User updated by:  marielyne at acanac dot net
 Reported By:      marielyne at acanac dot net
 Status:           Open
 Bug Type:         Filesystem function related
 Operating System: Windows 7
 PHP Version:      5.3SVN-2009-10-20 (snap)
 New Comment:

New information

Reproduce code:
---------------
<?php
$file = 'ftp://your:self@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


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

[2009-10-21 14:58:13] marielyne at acanac dot net

Does not happen with 5.2.11
Does not happen with local directory

ftp://...@localhost/php5.dll.001
fopen 2
fread
fwrite
ftp://...@localhost/php5.dll.002
fopen 3
fread
fwrite
ftp://...@localhost/php5.dll.003
fopen 3
fread
fwrite
ftp://...@localhost/php5.dll.004
fopen 3
fread
fwrite
ftp://...@localhost/php5.dll.005
fopen 3
fread
fwrite
done

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

[2009-10-21 12:36:12] jani@php.net

Does this happen with PHP 5.2.11 ? Does this happen using local
filesystem instead of remote ftp site?

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

[2009-10-20 22:12:21] marielyne at acanac dot net

Description:
------------
Trying to split a local file (at least 1 megabyte) to a FTP server à la
Hjsplit

PHP
=====
This snapshot was automatically generated on
Tue, 20 Oct 2009 19:16:25 +0000

Version: 5.3.2-dev
Branch: HEAD
Build: Release
=====

FTP
=====
FileZilla server 0.9.33
=====

Reproduce code:
---------------
http://www.pastebin.ca/1633753

Expected result:
----------------
*filename
fopen 2
fread
fwrite
[repeat last 2]
*filename
fopen 3
fread
fwrite
[repeat last 4]
done

Actual result:
--------------
*filename
fopen 2
fread
fwrite
*filename
CRASH

backtrace and FTP log @ http://www.pastebin.ca/1633797


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


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



Thread (9 messages)

« previous php.bugs (#143905) next »