session.upload_progress start session automatically

158 Views Asked by At

PHP session.upload_progress is a good library to track your upload progress, however when you send a file to server, session.upload_progress start php session automatically, that's does not play fine with Zend Framework causing an exception when you call:

$Session = new Zend_Session_Namespace ( 'zend_session' , true );

Exception:

session has already been started by session.auto-start or session_start()

With my session.auto_start set to "Off", I put on the top of the page the code below:

// no one command is executed before this
echo "<pre>";
print_r ($_SESSION );
exit;
  • Just calling page without upload: PHP says that $_SESSION is not set
  • Posting a form with a file: PHP shows the entire $_SESSION var even without calling session_start()

my Session section configuration:

Session Support     enabled
Registered save handlers    files user memcache memcached redis
Registered serializer handlers  php_serialize php php_binary wddx igbinary

Directive   Local Value Master Value
session.auto_start      Off Off
session.cache_expire    180 180
session.cache_limiter   nocache nocache
session.cookie_domain   no value    no value
session.cookie_httponly Off Off
session.cookie_lifetime 0   0
session.cookie_path     /   /
session.cookie_secure   Off Off
session.entropy_file    /dev/urandom    /dev/urandom
session.entropy_length  32  32
session.gc_divisor      1000    1000
session.gc_maxlifetime  1440    1440
session.gc_probability  1   1
session.hash_bits_per_character 5   5
session.hash_function   0   0
session.name    PHPSESSID   PHPSESSID
session.referer_check   no value    no value
session.save_handler    files   files
session.save_path       /tmp    /tmp
session.serialize_handler   php php
session.upload_progress.cleanup Off Off
session.upload_progress.enabled On  On
session.upload_progress.freq    1%  1%
session.upload_progress.min_freq    1   1
session.upload_progress.name    PHP_SESSION_UPLOAD_PROGRESS PHP_SESSION_UPLOAD_PROGRESS
session.upload_progress.prefix  upload_progress_    upload_progress_
session.use_cookies         On  On
session.use_only_cookies    On  On
session.use_strict_mode     Off Off
session.use_trans_sid       1   1

I does not have an session_start() on my code, I just let ZendFramework do it by run:

Zend_Registry::set( "session" , new Zend_Session_Namespace ( 'zend_session' , true ) ) ;
1

There are 1 best solutions below

0
On

in Zend_Session() : 456 it test:

if (!self::$_unitTestEnabled && defined('SID')) ...

SID is defined but $_SESSION is empty. but the problem is that this is a Zend Framework class, you can comment it if you want, but it's not recomended to change framework files