|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-03-05 10:34 UTC] 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 15:00:01 2025 UTC |
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/htmlI 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