This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation

If you are using a legacy version of concrete5 and on a server that runs php 5.4 you may see strict standard errors. Generally these errors show up when you have either moved concrete5 to a new upgraded server or have upgraded to an unsupported PHP version without first upgrading concrete5. Here are some examples of errors that you will see:

  • Strict Standards: Non-static method Loader::database() should not be called statically in /concrete/dispatcher.php on line 23
  • Strict standards: Non-static method Loader::library() should not be called statically in /concrete/libraries/loader.php on line 177
  • Strict standards: Non-static method Cache::startup() should not be called statically in /concrete/dispatcher.php on line 27

Why you are getting the strict standards message

Strict warnings are sent by PHP when certain old features are used or some code doesn't otherwise adhere to php's strict standards. In general, these errors are only helpful in development and can be ignored in production.

In PHP 5.4, the E_STRICT error type was set to output by default. Because legacy versions of concrete5 make use of some deprecated features and can raise strict warnings, this change caused versions of concrete5 that are not compatible with PHP 5.4 to show many php warnings.

How to remove the strict standards error message

The recommended way to resolve this issue is to modify the source files to disable outputting either E_STRICT or E_DEPRECATED warnings. The code we use to do that is:

// Shim to hide errors!
error_reporting(error_reporting() & ~E_STRICT & ~E_DEPRECATED); 
  1. Open up /index.php and add the code to the top.
    It should look like this:

    <?php
    // Shim to hide errors!
    error_reporting(error_reporting() & ~E_STRICT & ~E_DEPRECATED); 
    
    require_once('concrete/dispatcher.php');
    
  2. Open /concrete/startup/debug_logging.php and add the code to the bottom.
    Note: If you have upgraded your concrete5 site before, you may have to update a file in the /updates directory instead. Check your /config/site.php for information about the active update directory. Once you're done it should look like this:

    <?php defined('C5_EXECUTE') or die("Access Denied.");
    $debug_level = Config::get('SITE_DEBUG_LEVEL');
    switch($debug_level) {
        case DEBUG_DISPLAY_ERRORS:
            ini_set('display_errors', 1);
            break;
    
        default:
            ini_set('display_errors', 0);
            break;
    }
    
    // Shim to hide errors!
    error_reporting(error_reporting() & ~E_STRICT & ~E_DEPRECATED); 
    
  3. Upgrade concrete5 past version 5.5.2. This is essential! Keeping your concrete5 site up to date will prevent these issues in the future.
Loading Conversation