php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52645 resources trough SESSIONS fail?
Submitted: 2010-08-19 16:20 UTC Modified: 2010-08-19 16:31 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: robin at rdtx dot eu Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: Irrelevant OS: Debian 4 x64
Private report: No CVE-ID: None
 [2010-08-19 16:20 UTC] 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.

Patches

ihazno.patch (last revision 2010-08-19 14:21 UTC by robin at rdtx dot eu)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-08-19 16:31 UTC] kalle@php.net
-Status: Open +Status: Bogus
 [2010-08-19 16:31 UTC] kalle@php.net
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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 12:01:31 2024 UTC