Bug #52645 [Opn->Bgs]: resources trough SESSIONS fail?
Edit report at http://bugs.php.net/bug.php?id=52645&edit=1
ID: 52645
Updated by: kalle@php.net
Reported by: robin at rdtx dot eu
Summary: resources trough SESSIONS fail?
-Status: Open
+Status: Bogus
Type: Bug
Package: Unknown/Other Function
Operating System: Debian 4 x64
PHP Version: Irrelevant
Block user comment: N
New Comment:
You cannot store resources thru session, its the nature of resources as
they cannot be serialized. Use persistent connections if you really need
such functionality
Previous Comments:
------------------------------------------------------------------------
[2010-08-19 16:20:24] robin at rdtx dot eu
Description:
------------
Passing a resource trough a session over multiple pages fails (only for
ssh2_connect?)
Test script:
---------------
1 Page.
Works
<?php
session_start();
$con = ssh2_connect("127.0.0.1");
ssh2_auth_password($con, 'username', 'password');
$_SESSION["con"] = $con;
$con2 = $_SESSION["con"]
ssh2_exec($con2, "touch /tmp/test");
?>
2 pages
doesn't work
a.php
<?php
session_start();
$con = ssh2_connect("127.0.0.1");
ssh2_auth_password($con, 'username', 'password');
$_SESSION["con"] = $con;
?>
b.php
<?php
session_start();
$con2 = $_SESSION["con"]
ssh2_exec($con2, "touch /tmp/test");
?>
Expected result:
----------------
That it works?
Actual result:
--------------
Invalid resource.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52645&edit=1
Thread (2 messages)