Bug #74131 [Asn]: session.upload_progress doesn't work for database sessions

From: Date: Thu, 23 Feb 2017 14:31:27 +0000
Subject: Bug #74131 [Asn]: session.upload_progress doesn't work for database sessions
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-207522@lists.php.net to get a copy of this message
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:             Assigned
 Type:               Bug
 Package:            Session related
 Operating System:   CentOS 7
 PHP Version:        7.0.16
 Assigned To:        krakjoe
 Block user comment: N
 Private report:     N

 New Comment:

I would greatly appreciate it if someone could please get hold of Krakjoe and let him know about
this question as we are trying to decide what to do regarding this problem (...frankly nothing
except APCu providing the keys is looking pretty)


Previous Comments:
------------------------------------------------------------------------
[2017-02-21 08:00:33] fred5 at originsystems dot co dot za

Hi Krakjoe,

As further background to the below: our business invested invested a lot of time and energy in
building a reliable file upload progress bar, and we have good robust tested solution, with a lot of
customers out there using it. 

With the introduction of PHP 5.6 there was a slight hiccup when APC became APCu and some
functionality disappeared, however the apc.rfc1867 keys remained in APCu so everything was fine.

Now however in PHP 7 we have installed both apcu and apc-bc but the apc.rfc1867 keys seem to have
disappeared from phpinfo(), and our progress bar functionality thus does not work.

This effectively means we are unable to upgrade from PHP 5.6 until a solution is found.

I'm not sure if this is a minor thing or a major thing from an APCu perspective and I would
very much appreciate it if we could get some clarity on this, because right now we are between a
rock and a hard place.

thanks so much in advance

------------------------------------------------------------------------
[2017-02-21 03:48:46] laruence@php.net

I am not sure what apcu's plan, I am assigning this to the author

------------------------------------------------------------------------
[2017-02-20 21:33:39] fred5 at originsystems dot co dot za

Hi Laurence,

It appears that the hack I've suggested below won't work as it causes a "chicken and
egg" situation ie. $_SESSION is not populated until session_start() but
session_set_save_handler() must be executed prior to session_start()

The above means a recode of our "progress check" ajax call as a complete anomaly for our
development framework (as it would be the only component in the entire application not using our
standard session handling mechanism).

The above is something we'd really like to avoid if possible so it becomes even more desirable
for us to be able to utilise APCu and apc.rfc1867 as we have been doing.

I would thus really appreciate any feedback you can provide regarding whether the fact that
apc.rfc1867 not working is something I can / should log a bug for in order to get resolved.

I look forward to hearing from you - thanks!

------------------------------------------------------------------------
[2017-02-20 12:56:55] fred5 at originsystems dot co dot za

thanks again!

Regarding:

1. I am not sure why you think php doesn't support rfc1867

In PHP 7, even with both APCu and APC Backward Compatibility (apc-bc) installed, the apc.rfc1867
keys no longer show in phpinfo, and are likewise not accessible when uploading using apc. So the
upload does not work. 

Please see here for explanation of the problem: https://github.com/krakjoe/apcu-bc/issues/22

My 100% first prize at this point would be able to continue to use APC. With this in mind should I
open a separate bug for getting the apc.rfc1867 keys re-instated? (they are still very much included
in the PHP documentation)

2. Your suggestion regarding session.upload_progress
We have a standard handling that applies to every call made to the server. In every case, Session is
set up as the first step, which means that we would need to take something like the following
approach:

Within Session::__construct() {
 ...
 $fileSESSION = $_SESSION;
 session_set_save_handler($this,true);
 array_merge($_SESSION,$fileSESSION); // ensuring that fileSESSION takes value priority
 ...
It does however seem a bit of a hack and has the following drawbacks that I can think of:
- Redundant session files get created that will need to be managed; and 
- The above is redundant overhead in every call except for those during file upload
- On completion of file upload, redundant $_SESSION file upload information will be retained

The above reasons as well as the fact that we have significant investment already in APC is why I
would vastly prefer to continue using APC apc.rfc1867 if at all possible.

Please do let me know what you think - thanks again.

------------------------------------------------------------------------
[2017-02-20 12:23:23] laruence@php.net

apcu use an internal cache to cache upload progress, php7 use session(according to
session.save_handler) to cache that info;

I am not sure why you think php doesn't support rfc1867, the problem here is, when php is
receiving upload progresss infos from webserver, no user codes has been executed, when php is try to
store upload porgress infos into session, how do he knows that you are using database session save
handler?

you can still get upload progress infos before you calling set_save_handler(which change the
session.save_handler that php used to cache progress info .)

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=74131


--
Edit this bug report at https://bugs.php.net/bug.php?id=74131&edit=1


Thread (12 messages)

« previous php.bugs (#207522) next »