You are here: Re: $_SESSION / $HTTP_SESSION_VARS behaviour « PHP Programming Language « IT news, forums, messages
Re: $_SESSION / $HTTP_SESSION_VARS behaviour

Posted by Pedro Graca on 11/02/06 17:17

Michael Windsor wrote:
> if I [...] put "$HTTP_SESSION_VARS = $_SESSION" after
> session_start(), it stops $_SESSION behaving properly [...]
>
> Could this be a bug in PHP?

My PHP does not exhibit that behaviour.
Can it be that you have /something else/ in your code responsible for
the behaviour you describe?


<?php
session_start();

if (rand(0, 1)) {

echo "Using copy of the \$_SESSION array...<br>\n";

$COPY_SESSION = $_SESSION;
if (!isset($COPY_SESSION['count'])) {
$COPY_SESSION['count'] = 0;
}
$val = ++$COPY_SESSION['count'];
if (rand(0, 1)) {
echo "and not copying it back.<br>\n";
} else {
$_SESSION = $COPY_SESSION;
}

} else {

if (!isset($_SESSION['count'])) {
$_SESSION['count'] = 0;
}
$val = ++$_SESSION['count'];

}

echo "Current value is $val.<br>\n";
?>

--
I (almost) never check the dodgeit address.
If you *really* need to mail me, use the address in the Reply-To
header with a message in *plain* *text* *without* *attachments*.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация