#50602 [Opn->Bgs]: Session doesn't work in php5
| From: | derick@php.net | Date: | Tue, 29 Dec 2009 09:38:50 +0000 |
| Subject: | #50602 [Opn->Bgs]: Session doesn't work in php5 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-146172@lists.php.net to get a copy of this message | ||
ID: 50602
Updated by: derick@php.net
Reported By: jansi_bosco at yahoo dot co dot in
-Status: Open
+Status: Bogus
Bug Type: Session related
Operating System: Linux
PHP Version: 5.3.1
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
There are many things wrong here, but they are not bugs. Tip: can't run
session_Start() after echo content (such as HTML).
Previous Comments:
------------------------------------------------------------------------
[2009-12-29 08:19:51] jansi_bosco at yahoo dot co dot in
Description:
------------
I am using php5 version. The script is doesn't work in php5. But its
work under php4 fine. What may be the problem occurs? I search the page
in my php info() file, The register_global is ON mode in Php4.
But in the php5 the register_global is OFF.
In my site, there are the scripts are didn't work well. The file
redirect to another page. But there is no data is retreived. The
save_path also have a no value. so I have created the sample page in my
site whether the session is work or not. But in my server side the
session is not working well. I checked the php info file the register
global is off
Given below the example was I used. Its not working under php5.
Reproduce code:
---------------
//session1.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<?php
session_start('mysession');
class Cus{
var $cusid;
function newCus($cusid, $index){
$this->cusid[$index] = $cusid;
}
function getCus(&$tmparray){
for($i = 0; $i < count($this->cusid); $i++){
$tmparray[$i] = $this->cusid[$i];
}
}
}
$customer = new Cus();
$customer->newCus("Cliente 1",0);
$_SESSION['customer'] = $customer;
echo "<a href=\"./session2.php\">Página 2 de la
sesión</a><br>";
print_r($_SESSION);
?>
</body>
</html>
---------------------------------------------------------------------
//session2.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<?php
session_start();
class Cus{
var $cusid;
function newCus($cusid, $index){
$this->cusid[$index] = $cusid;
}
function getCus(&$tmparray){
for($i = 0; $i < count($this->cusid); $i++){
$tmparray[$i] = $this->cusid[$i];
}
}
}
$_SESSION['customer']->getCus($tmparr);
print_r($tmparr);
session_unset();
session_destroy();
?>
</body>
</html>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50602&edit=1