Edit report at https://bugs.php.net/bug.php?id=74131&edit=1
ID: 74131
User updated by: fred5 at originsystems dot co dot za
Reported by: fred5 at originsystems dot co dot za
Summary: session.upload_progress doesn't work for database
sessions
-Status: Feedback
+Status: Open
Type: Bug
Package: Session related
Operating System: CentOS 7
PHP Version: 7.0.16
Block user comment: N
Private report: N
New Comment:
thank you very much for the quick feedback!
A synopsis is as follows...
Relevant phpinfo(); configuration:
----------------------------------------------
session.save_handler files files
session.save_path /temp/session /temp/session
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_
And our session handling code contains the following:
1. class Session implements SessionHandlerInterface {}
2. in Session::__construct() we set "session_set_save_handler($this,true);" (and the
following session methods Session::open,read,write etc are defined and correctly saving and
retrieving $_SESSION information from the database.
General session handling test applied:
-----------------------------------------
1. $_SESSION["test var"] = "blah blah";
This variable and value is correctly reflected serialized in the database; and
2. print $_SESSION["test var"]; prints the correct value on subsequent HTTP calls for the
same session
(no session information is stored in session.save_path folder)
Specific session.upload_progress testing
-----------------------------------------
1. On our file upload page inserted:
<input name="PHP_SESSION_UPLOAD_PROGRESS" value="ABC"
id="PHP_SESSION_UPLOAD_PROGRESS" type="hidden">
(prior to our file input field)
<input name="af58aac50f2c132" id="af58aac50f2c132" type="file">
2. submit the form and trigger concurrent ajax progress call loop
The result / problem is as follows:
A. The ajax progress call contains "print_r($_SESSION);" . This returns returns only
"test var" and value (as above) ie. it contains no file progress information
B. At the same time, a new session file is created in session.save_path (/temp/session) containing
the following:
upload_progress_ABC|a:5:{s:10:"start_time";i:1487586588;s:14:"content_length";i:19882;s:15:"bytes_processed";i:19882;s:4:"done";b:1;s:5:"files";a:1:{i:0;a:7:{s:10:"field_name";s:15:"af58aac50f2c132";s:4:"name";s:20:"bugs.xlsx";s:8:"tmp_name";s:37:"/temp/uploads/phpCvyjWg";s:5:"error";i:0;s:4:"done";b:1;s:10:"start_time";i:1487586588;s:15:"bytes_processed";i:18795;}}}
It contains only session information relating to the upload. (ie. the information I am expecting to
be both saved in the database and reflected in $_SESSION)
I hope this explains the problem in more detail but please let me know if I can provide further
information!
Regarding apache - here is more detail of our configuration:
# httpd -M
Loaded Modules:
core_module (static)
so_module (static)
http_module (static)
mpm_prefork_module (static)
authn_file_module (shared)
authn_core_module (shared)
authz_host_module (shared)
authz_groupfile_module (shared)
authz_user_module (shared)
authz_core_module (shared)
auth_basic_module (shared)
reqtimeout_module (shared)
filter_module (shared)
mime_module (shared)
log_config_module (shared)
env_module (shared)
headers_module (shared)
setenvif_module (shared)
version_module (shared)
unixd_module (shared)
status_module (shared)
autoindex_module (shared)
dir_module (shared)
alias_module (shared)
php7_module (shared)
expires_module (shared)
rewrite_module (shared)
socache_shmcb_module (shared)
deflate_module (shared)
ssl_module (shared)
Previous Comments:
------------------------------------------------------------------------
[2017-02-20 10:14:09] laruence@php.net
I can not reproduce this, please note if you are running php via fastcgi, you should disable
nginx/apache's request buffering to make this work
------------------------------------------------------------------------
[2017-02-19 21:56:50] fred5 at originsystems dot co dot za
Description:
------------
session.upload_progress always writes its $_SESSION progress information to the session.save_path
session file, ignoring session_set_save_handler settings
Therefore, if a system stores session information in the database then:
1. the database session information is not updated with the progress information; and consequently
2. print_r($_SESSION) excludes any session.upload_progress information.
Rendering session.upload_progress useless for any system using database session handling.
This has become critical as PHP 7 has stopped supporting apc.rfc1867 - which is the only reliable
alternative of which I am aware.
Please see http://stackoverflow.com/q/42315444/3051627
for more information on this if desired.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74131&edit=1