CMS MADE SIMPLE FORGE

CMS Made Simple Core

 

[#12529] Cacheable Pages have Bad Header Last-Modified

avatar
Created By: Philippe Thomas (filto)
Date Submitted: Sun Feb 06 02:20:08 -0500 2022

Assigned To: Rolf (rolf1)
Version: 2.2.16
CMSMS Version: 2.2.16
Severity: Minor
Resolution: Fixed
State: Open
Summary:
Cacheable Pages have Bad Header Last-Modified
Detailed Description:
Cacheable Pages have Bad Header Last-Modified :

/lib/misc.functions.php

L1262

// frontend request
        $expiry = (int)max(0,cms_siteprefs::get('browser_cache_expiry',60));
        @session_cache_expire($expiry);
        @session_cache_limiter('public');
        @header_remove('Last-Modified');
    }

    #Setup session with different id and start it
    $session_name = 'CMSSESSID'.substr(md5(__DIR__.CMS_VERSION), 0, 12);
    if( !isset($CMS_INSTALL_PAGE) ) {
        @session_name($session_name);
        @ini_set('url_rewriter.tags', '');
        @ini_set('session.use_trans_sid', 0);
    }

    if( isset($_COOKIE[$session_name]) ) {
        // validate the contents of the cookie.
if (!preg_match('/^[a-zA-Z0-9,-]{22,40}$/', $_COOKIE[$session_name]) ) {
            session_id( uniqid() );
            session_start();
            session_regenerate_id();
        }
    }
    if(!@session_id()) session_start();
    $_setup_already = true;

#---------
L1262 @header_remove do nothing because session is NOT yet generated
Only session_start will generate the Header !

#------solve -----

1 :remove  at L1262 : @header_remove('Last-Modified');

2 : just add before last line : if($cachable) header_remove('Last-Modified');

if($cachable) header_remove('Last-Modified');
$_setup_already = true;

#-------------------

Then Last-Modified is revoved from Header has expected !


History

Comments
avatar
Date: 2022-04-04 10:12
Posted By: Jean-Claude Etiemble (jce76350)

I confirm
      
avatar
Date: 2022-04-19 11:42
Posted By: Fernando Morgado (JoMorg)

Fixed in SVN, thanks.
      
avatar
Date: 2022-04-20 19:57
Posted By: Philippe Thomas (filto)

update correction ... i forgot cachable condition !

Fernando Morgado did not forget it in his svn correction
      
Updates

Updated: 2022-04-20 19:57
description: Cacheable Pages have Bad Header Last-Modified : /lib/misc.functions.php L1262 // frontend request $expiry = (int)max(0,cms_siteprefs::get('browser_cache_expiry',60)); @session_cache_expire($expiry); @session_cache_limit => Cacheable Pages have Bad Header Last-Modified : /lib/misc.functions.php L1262 // frontend request $expiry = (int)max(0,cms_siteprefs::get('browser_cache_expiry',60)); @session_cache_expire($expiry); @session_cache_limit

Updated: 2022-04-19 11:42
resolution_id: 5 => 7

Updated: 2022-02-06 05:15
description: Cacheable Pages have Bad Header Last-Modified : /lib/misc.functions.php L1262 // frontend request $expiry = (int)max(0,cms_siteprefs::get('browser_cache_expiry',60)); @session_cache_expire($expiry); @session_cache_limit => Cacheable Pages have Bad Header Last-Modified : /lib/misc.functions.php L1262 // frontend request $expiry = (int)max(0,cms_siteprefs::get('browser_cache_expiry',60)); @session_cache_expire($expiry); @session_cache_limit
resolution_id: => 5