Browse files

Fix PHP 5.4 upload progress working only with session.upload_progress…

….cleanup set to Off
  • Loading branch information...
1 parent a042003 commit 5dc0f782f501ed011a918483e4e69085bff722b0 J.M committed Jun 30, 2012
Showing with 11 additions and 2 deletions.
  1. +11 −2 import_status.php
View
13 import_status.php
@@ -25,12 +25,12 @@
) {
$sessionupload = array();
- $prefix = ini_get('session.upload_progress.prefix');
+ define('UPLOAD_PREFIX', ini_get('session.upload_progress.prefix'));
session_start();
foreach ($_SESSION as $key => $value) {
// only copy session-prefixed data
- if (substr($key, 0, strlen($prefix)) == $prefix) {
+ if (substr($key, 0, strlen(UPLOAD_PREFIX)) == UPLOAD_PREFIX) {
$sessionupload[$key] = $value;
}
}
@@ -54,6 +54,15 @@
foreach ($sessionupload as $key => $value) {
$_SESSION[$key] = $value;
}
+
+ // remove session upload data that are not set anymore
+ foreach ($_SESSION as $key => $value) {
+ if (substr($key, 0, strlen(UPLOAD_PREFIX)) == UPLOAD_PREFIX
+ && ! isset($sessionupload[$key])
+ ) {
+ unset($_SESSION[$key]);
+ }
+ }
}
/**

0 comments on commit 5dc0f78

Please sign in to comment.