#43026 [Opn->Bgs]: persistent sockets do not stay persistent
| From: | johannes@php.net | Date: | Fri, 19 Oct 2007 08:28:11 +0000 |
| Subject: | #43026 [Opn->Bgs]: persistent sockets do not stay persistent | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-118699@lists.php.net to get a copy of this message | ||
ID: 43026
Updated by: johannes@php.net
Reported By: domino at operamail dot com
-Status: Open
+Status: Bogus
Bug Type: Streams related
Operating System: Linux / Fedora 7
PHP Version: 5.2.4
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Resources can't be stored in a session, not even persistent ones.
Instead the persistent connection will be reused when you reopen a
connection with the same parameters. Please also see
http://php.net/manual/en/features.persistent-connections.php
Previous Comments:
------------------------------------------------------------------------
[2007-10-18 23:20:22] domino at operamail dot com
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
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43026&edit=1