Edit report at https://bugs.php.net/bug.php?id=64357&edit=1
ID: 64357
User updated by: abxccd at msn dot com
Reported by: abxccd at msn dot com
Summary: PHP mangles expires header when
session.cache_limiter is used
-Status: Feedback
+Status: Closed
Type: Bug
Package: Output Control
Operating System: Ubuntu 12.10
PHP Version: 5.4.12
Block user comment: N
Private report: N
New Comment:
I just tested against PHP 5.4.17RC1 on Ubuntu 13.04 64-bit and it seems to be
fine.
It must have been fixed somewhere between 5.4.12 and 5.4.17.
Thanks for your help :)
Previous Comments:
------------------------------------------------------------------------
[2013-06-27 22:11:52] [email protected]
I forgot to session_start(), but it works. Waiting your feedback.
$ ./sapi/cgi/php-cgi
<?php
session_cache_limiter('private');
session_start();
header('Expires: Wed, 05 Mar 2014 21:25:41');
X-Powered-By: PHP/5.4.18-dev
Set-Cookie: PHPSESSID=f78a61f21785e499ea0a6f27e50176fe; path=/
Cache-Control: private, max-age=10800, pre-check=10800
Expires: Wed, 05 Mar 2014 21:25:41
Content-type: text/html
------------------------------------------------------------------------
[2013-06-27 22:07:06] [email protected]
It seems works for PHP 5.5/5.4 cgi SAPI. What SAPI are you using? You can check
it by using phpinfo() on your server.
$ ./sapi/cgi/php-cgi
<?php
session_cache_limiter('private');
header('Expires: Wed, 05 Mar 2014 21:25:41');
X-Powered-By: PHP/5.5.1-dev
Expires: Wed, 05 Mar 2014 21:25:41
Content-type: text/html
$ ./sapi/cgi/php-cgi
<?php
session_cache_limiter('private');
header('Expires: Wed, 05 Mar 2014 21:25:41');
X-Powered-By: PHP/5.4.18-dev
Expires: Wed, 05 Mar 2014 21:25:41
Content-type: text/html
------------------------------------------------------------------------
[2013-03-05 10:34:27] abxccd at msn dot com
Description:
------------
If session.cache_limiter in php.ini has any of these values: public, private,
or nocache, the expires header will be mangled if we try to set one at a later
stage.
To replication, first, set your session.cache_limiter to private or any of the
above values, or do it using session_cache_limiter. Then, run the test script.
Then, inspect the response headers with a tool like FireBug.
Test script:
---------------
<?php
header('Expires: Wed, 05 Mar 2014 21:25:41');
Expected result:
----------------
Content-Type text/html
Date Tue, 05 Mar 2013 10:25:42 GMT
Expires Wed, 05 Mar 2014 21:25:41 GMT
Actual result:
--------------
Content-Type text/html
Date Tue, 05 Mar 2013 10:30:17 GMT
Expires Thu, 19 Nov 1981 08:52:00 GMT, Wed, 05 Mar 2014 21:25:41 GMT <----
Mangled
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64357&edit=1