|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-10-19 08:28 UTC] johannes@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 09:00:01 2025 UTC |
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: ---------------- [root@xyz db]# cat /tmp/socket.xxx Array ( [hi] => bye [socket] => Resource id #15 ) Array ( [hi] => bye [socket] => Resource id #15 ) Actual result: -------------- [root@xyz db]# cat /tmp/socket.xxx Array ( [hi] => bye [socket] => Resource id #15 ) Array ( [hi] => bye [socket] => 0 )