|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2016-01-05 17:08 UTC] pfenderd at bellsouth dot net
Description: ------------ Using session_name() to specify a name immediately before session_start() causes the session_progress feature to indicate that an upload has completed immediately even though the file is still being sent. In my test case, the only difference between a working version and the failed version is the used of session_name(). Without using session_name(), the session_progress feature works very well. I currently use session_name() to differentiate sessions when using the same browser to access different web pages in different tabs that show data from different websites on the same server. This feature works well except for the session_progress feature. Test script: --------------- $session_name_str = "upload_session"; session_name($session_name_str); session_start(); PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 20:00:01 2025 UTC |
The reason why changing session name after module initialization does not work is the way RFC 1867 callback implemented. Upload progress callback (php_rfc1867_callback) is registered when session module is initialized. It is used when RFC 1867 upload is performed and handled in main/rfc1867.c. This means changing session name in user script is too late to make it work. I think it does not work in older versions also, does it? Possible fix would be delaying file upload handling and/or handle file upload manually. PHP handles file uploading automatically now. Anyway, user cannot make use of session_name('NEW_NAME')/ini_set('session.name', 'NEW_NAME') to use multiple file upload progress handling. I checked the code briefly. Please correct me if I'm wrong.Like Yasuo said, uploads are processed before any scripts are actually executed. When an upload is in progress, the respective data are written to the session as specified in php.ini, and $_SESSION is populated. If you change the session name and then start a session, the upload data are therefore no longer available in $_SESSION. The cleanest solution is to set the desired session.name prior to script execution. If that is not possible for whatever reason, you can work around with something like: <?php if (isset($_SESSION)) { $upload_data = $_SESSION; } session_name("myname"); session_start(); $_SESSION = array_merge($_SESSION, $upload_data); ?> Thus, this is merely a doc problem, and hence a duplicate of bug #76808.