php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63414 built-in upload progress mechanism does not work with custom session handler
Submitted: 2012-11-01 18:21 UTC Modified: 2013-03-12 11:48 UTC
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:2 (66.7%)
From: anton dot gudkov at flatstack dot com Assigned:
Status: Closed Package: *General Issues
PHP Version: 5.4.8 OS: ubuntu 12.04 x86_64
Private report: No CVE-ID: None
 [2012-11-01 18:21 UTC] anton dot gudkov at flatstack dot com
Description:
------------
By default php stores sessions in files (default filepath is /var/lib/php5).
If we want to store sessions, for example, in database, upload progress info 
doesn't appears there. Even If we change session_save_path to another directory we 
will get the same problem.

P.S. script example you could get here:
https://github.com/ihabunek/php-upload-progress

and custom session handler example here:
http://durak.org/sean/pubs/software/php-5.4.6/function.session-set-save-
handler.html

Thanks,
Anton


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-11-02 02:57 UTC] laruence@php.net
-Status: Open +Status: Feedback
 [2012-11-02 02:57 UTC] laruence@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

could you make a simple test script to illustrate your point? thanks
 [2012-11-21 23:21 UTC] chad dot scott at gmail dot com
I haven't gone deep enough into the PHP source to identify what's going on, but it 
appears that PHP writes the upload progress session data using the handler set in 
"session.save_handler", ignoring any custom session handler. On Ubuntu 12.04 with 
the default settings, this means the data is going into "/var/lib/php5/sess_<id>".
 [2012-12-06 15:53 UTC] anton dot gudkov at flatstack dot com
Hi. Here is the script example which reproduces "upload progress doesn't work". 
Sorry for the huge script, but it couldn't be more simplier. Here is it:


<?php

/* if you set any writeable/readable dir to store sessions
upload progress will not work. But if you comment this line,
it will work. */
session_save_path('/tmp');

session_start();
$uploadName = 'test'; //upload unique name
if (isset($_GET['ajax'])) {
    if (isset($_SESSION["upload_progress_$uploadName"])) {
        $progress = $_SESSION["upload_progress_$uploadName"];
        $percent = round(100 * $progress['bytes_processed'] / 
$progress['content_length']);
        echo "Upload progress: $percent%<br /><pre>" . print_r($progress, 1) . 
'</pre>';
    } else {
        echo 'no uploading';
    }
    exit;
} elseif (isset($_GET['frame'])) { ?>
    <form action="" method="POST" enctype="multipart/form-data">
        <input type="hidden" name="<?=ini_get("session.upload_progress.name")?>"
                value="<?=$uploadName?>" /><br />
        <input type="file" name="file" /><br />
        <input type="submit" />
    </form>
<?php } else { ?>
    <iframe src="?frame" height="100" width="500"></iframe>
    <script 
src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script>
        $(function() {
            setInterval(function() {
                $.get('?ajax', function(data) {
                    $('#ajax').html(data);
                });
            }, 500);
        });
    </script>
    <div id="ajax"></div>
<?php }
 [2013-02-18 00:36 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 [2013-03-12 11:48 UTC] anton dot gudkov at flatstack dot com
-: xergin at gmail dot com +: anton dot gudkov at flatstack dot com -Status: No Feedback +Status: Closed
 [2013-03-12 11:48 UTC] anton dot gudkov at flatstack dot com
I've provided feedback on how to reproduce this issue at 2012-12-06 15:53 UTC
 [2013-03-14 10:02 UTC] elena dot batmanova at flatstack dot com
Hello,

Please check the script Anton provided in December 2012 or kindly let us know 
what other feedback is required. It's very important for us to have this issue 
resolved.

Thanks
 [2016-08-23 14:35 UTC] mark at sasoft dot co dot za
Hello,
Please kindly let me know why this bug was not re-opened when the user responded that they did provide feedback ?

This bug is an ongoing issue and severely limits our ability to provide a decent public facing interface when uploading files when the php.ini session.save_handler is set to user (database session).

Thanks
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 00:01:33 2024 UTC