From: domino at operamail dot com Operating system: Linux / Fedora 7 PHP version: 5.2.4 PHP Bug Type: Streams related Bug description: persistent sockets do not stay persistent
Description: ------------ Socket handle as returned by pfsockopen is not preserved within the same session. First page will open a persistent socket and store it in the SESSION array. (Yes, i have a component running on 20505). Then, first page redirect to second page, which retrieves the stored object. The string is retrieved OK from resumed SESSION, but socket is dead. PS. As a test, I have reconfigured Apache to run in single thread mode. The code sample still doesnt work as expected. Reproduce code: --------------- socket.php: Code: <?php session_start(); $_SESSION['langleySockets'] = array(); $_SESSION['langleySockets'][0] = array( 'hi' => 'bye', 'socket' => fsockopen("127.0.0.1", 20505)); $fh=fopen("/tmp/socket.xxx", "w");fwrite($fh, print_r($_SESSION['langleySockets'][0], true));fclose($fh); session_write_close(); header("Location: socket2.php" . "?" . SID); ?> socket2.php: Code: <?php session_start(); $fh=fopen("/tmp/socket.xxx", "a");fwrite($fh, print_r($_SESSION['langleySockets'][0], true));fclose($fh); session_write_close(); ?> Expected result: ---------------- [EMAIL PROTECTED] db]# cat /tmp/socket.xxx Array ( [hi] => bye [socket] => Resource id #15 ) Array ( [hi] => bye [socket] => Resource id #15 ) Actual result: -------------- [EMAIL PROTECTED] db]# cat /tmp/socket.xxx Array ( [hi] => bye [socket] => Resource id #15 ) Array ( [hi] => bye [socket] => 0 ) -- Edit bug report at http://bugs.php.net/?id=43026&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43026&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43026&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43026&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43026&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43026&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43026&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43026&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=43026&r=needscript Try newer version: http://bugs.php.net/fix.php?id=43026&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43026&r=support Expected behavior: http://bugs.php.net/fix.php?id=43026&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43026&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43026&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43026&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43026&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43026&r=dst IIS Stability: http://bugs.php.net/fix.php?id=43026&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43026&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43026&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43026&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=43026&r=mysqlcfg