|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-12-29 09:38 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 14 00:00:02 2025 UTC |
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>