From:             marcus at quintic dot co dot uk
Operating system: Windows XP
PHP version:      4.3.2
PHP Bug Type:     Session related
Bug description:  Sessions that pass documents back using fpassthru hang intermittently

Description:
------------
I have an application that uses multiple frames (anywhere from 5-10 at a
time). The frames get updated at roughly the same time - a user steps
through a flowchart that has multiple documents attached to each step that
can target any of the frames). Each of the frames is running in the same
session (in that the php that generates a requested page starts with
session_start()). The document to be displayed is passed through on the
url and this argument is looked up in an array which returns a path to a
local file. This path is then fed to fpassthru and the document gets
served up to the browser.

The session locks up randomly using fpassthru, but if the fpassthru is
replaced by a redirect (header("Location:....")) to a web based copy of
the requested document the lock up stop occuring.

Obviously the workaround is to use the redirect but this means that a user
can get directly to a document without going through the session
authentication etc, so I'd prefer to get the fpassthru to work.

My php installation is the standard install with the following extensions
enabled:

extension=php_db.dll
extension=php_dba.dll
extension=php_dbx.dll
extension=php_domxml.dll
extension=php_gd2.dll
extension=php_mhash.dll
extension=php_pdf.dll
extension=php_shmop.dll
extension=php_sockets.dll
extension=php_xmlrpc.dll

I'm using the SAPI module. The problem still exists (although seems to
happen less frequently) with the cgi version.

Reproduce code:
---------------
start_session();

// lookup file and place in $path

// ... code removed ...

// send headers 
header("Pragma: ");
header("Cache-Control: ");

// lookup mimetype and place in $mimetype
// ... code removed ...
                        
header("Content-type: " . $mimetype ); 

$sizeh = "Content-length: " . filesize($path); 
header($sizeh);
header("Content-transfer-encoding: binary\n"); 
                
// send file contents 
$fp=fopen($path, "rb"); 
fpassthru($fp);                         
fclose($fp);                                            
exit;

Expected result:
----------------
The document requested in the browser frame, which is what happens the
majority of times (approx 95%). Its definitely something to do with an
interaction between a session and fpassthru because removing either fixes
the problem.

Actual result:
--------------
Lockups approx 5% of the time - a new session can be started in a
different browser instance, but the current session is lost.

-- 
Edit bug report at http://bugs.php.net/?id=24295&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=24295&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=24295&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=24295&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=24295&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=24295&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=24295&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=24295&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=24295&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=24295&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=24295&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24295&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=24295&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=24295&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=24295&r=gnused

Reply via email to