php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61155 session_strat gives error
Submitted: 2012-02-21 15:25 UTC Modified: 2012-02-21 19:26 UTC
From: elcmusic at inter dot net dot il Assigned:
Status: Not a bug Package: Session related
PHP Version: 5.3.10 OS: Server Version: Apache/2.2.11
Private report: No CVE-ID: None
 [2012-02-21 15:25 UTC] elcmusic at inter dot net dot il
Description:
------------
---
From manual page: http://www.php.net/function.session-start
---
I'm using session_start(); and some times when a $_SESSION param is EMPTY I get this error:

Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0



Test script:
---------------
session_start();
//error_reporting(0);
//session_unset ();


$_SESSION['product'] = $_SESSION['form'];//received from prev. page this is the bug when ['form'] is empty or not defined

include('do-csv.php');// save $_GET in a csv file
include('do-Scsv.php');// save $_SESSION in a csv file

Expected result:
----------------
no warning should be output.

Actual result:
--------------
Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-02-21 15:27 UTC] aharvey@php.net
As the warning says, disable session.bug_compat_42 (after making sure your code 
doesn't rely on it) and the warning will go away.
 [2012-02-21 15:27 UTC] aharvey@php.net
-Status: Open +Status: Not a bug
 [2012-02-21 19:26 UTC] elcmusic at inter dot net dot il
When I added $_SESSION['form'] = "anything"; before:
$_SESSION['product'] = $_SESSION['form'];

the warning did not show!
so I guess this because I tried to read an undefined variable.
Is it or is it not a bug?
Thanks!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 23:01:31 2024 UTC