php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14264 Session variable not keeping track of increment
Submitted: 2001-11-28 05:42 UTC Modified: 2001-11-28 05:49 UTC
From: francis at natsoft dot com dot my Assigned:
Status: Not a bug Package: Session related
PHP Version: 4.1.0 OS: RedHat LINUX 7.2
Private report: No CVE-ID: None
 [2001-11-28 05:42 UTC] francis at natsoft dot com dot my
With this piece of code the session variable is not keeping track of the increment:

<?php
error_reporting(63);
session_start();
$abc = '';
session_register('abc');

$abc += 1;
$_SESSION['abc'] += 2;
print "<pre>$abc\n\n";
print_r( $_SESSION);
?>

While minor alteration of above code as below the session variable works:

<?php
error_reporting(63);
$abc = '';
session_start();
session_register('abc');

$abc += 1;
$_SESSION['abc'] += 2;
print "<pre>$abc\n\n";
print_r( $_SESSION);
?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-28 05:49 UTC] hholzgra@php.net
> session_start();
> $abc = '';

so what do you expect to happen when you overwrite
the value of a session variable immediately after
restoring it using session_start()?


PS:
> error_reporting(63);

*never* use numeric constants for error reporting settings, *always* use the symbolic constants like E_ALL and E_WARNING, unless you want to get bitten by future additions of error classes 
 [2001-11-28 05:49 UTC] hholzgra@php.net
(bogusified)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 16:01:30 2024 UTC