This has been another one of those hair pulling moments, and I was wondering if anyone could shed some light on this issue I'm having.
I've managed to replicate the issue with 2 simple php pages.
Page1 (test.php)
This is just a simple file upload form that also uses the session.upload_progress.name
hidden field. It then outputs the $_SESSION
array:
<form name="fileupload" action="test2.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="<?php echo ini_get("session.upload_progress.name"); ?>" value="123">
<input type="file" name="newfile">
<input type="submit" name="submit" value="Submit">
</form>
<?php
if(!isset($_SESSION)) {
session_start();
}
print_r($_SESSION);
?>
Page 2 (test2.php)
This page simply adds a session variable, and outputs the $_SESSION
array. It also includes a link to go back to test.php:
<?php
if(!isset($_SESSION)) {
session_start();
}
$_SESSION['new']='Im a new value that will disappear';
print_r($_SESSION);
?>
<a href="test.php">Go back</a>
Now, if you load test1.php
, it will output:
{ The form }
Array()
Click submit, and it will take you to test2.php and output:
Array
(
[upload_progress_123] => Array
(
[start_time] => 1419385365
etc etc ...
)
)
[new] => Im a new value that will disappear
)
Now click 'Go back' and it will only output:
{ the form }
Array
(
[upload_progress_123] => Array
(
[start_time] => 1419385365
etc etc ...
)
)
)
(Notice how [new]
is not there)
Is there any solid reason as to why this is happening?
In this example, I have session.upload_progress.cleanup
set to off, for debugging. But the behaviour of the new session is the same when it is set to on.