php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37426 variable scoping? session?
Submitted: 2006-05-13 02:35 UTC Modified: 2006-05-13 07:11 UTC
From: winterain at gmail dot com Assigned:
Status: Not a bug Package: Session related
PHP Version: 4.4.2 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: winterain at gmail dot com
New email:
PHP Version: OS:

 

 [2006-05-13 02:35 UTC] winterain at gmail dot com
Description:
------------
hello... i'm having problem here... example, i got 2 files... 1st file contains (test.php)
<?php session_start();
$_SESSION['xxx']="hello";
$xxx="world";
echo $xxx;
echo "<br>".$_SESSION['xxx'];
?>
then the 2nd file (test2.php)
<?php
session_start();
$xxx="world";
echo $xxx;
echo "<br>".$_SESSION['xxx'];
?>
if i'm goin to use PHP 4 for those files (say access test.php 1st, then next test2.php)... test.php would output "world hello"... and test2.php would output "world hello"... the problem rises when i used PHP 5... 1st file would output "world hello" but the 2nd file's output is "world world"... apparently, the $_SESSION['xxx'] value changed whenever $xxx value changes... is this some kind of bug under variable scoping?


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-13 07:11 UTC] johannes@php.net
In PHP 4.2.0, the 'register_globals' setting default changed to
'off'. See http://www.php.net/release_4_2_0.php for more info.
We are sorry about the inconvenience, but this change was a necessary
part of our efforts to make PHP scripting more secure and portable.

.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 15 01:01:35 2025 UTC