Templates list in debug mode not showing

Hi I have configure cs cart project on local and have made debug_mode on but on debug tab it only show 17 files include template and when i click on template tab it shows error

Message

json_decode() expects parameter 1 to be string, array given

Error at

D:\laragon\www\leyjao\app\Tygh\Debugger.php, line: 148
target function at 148
public static function getData($data_time)
{
$data = array();
if (!empty($data_time)) {
$debugger_data = Registry::get(‘dbg_’ . $data_time);
$data = !empty($debugger_data) ? $debugger_data : array();
$data = json_decode($data, true);
}

    return $data;
}

here the registry function is not returning data here is the registry function
public static function get($key)
{
if (isset(self::$legacy_keys[$key])) {
// Development::deprecated(‘Usage of Registry class for storing services is deprecated. Use Tygh::$app instead.’);

        return self::$application[$key];
    }

    $val = self::_varByKey('get', $key);

    return ($val !== self::NOT_FOUND) ? $val : null;
} 

My cs cart version is 4.11.3 Now what to do here to get the results. Anyone can help?

You will only see this error if you are using PHP 8.0 or newer. Support for PHP 8.0 was added in CS-Cart 4.15.1 and your current version does not support PHP version higher than 7.3. Please switch back to PHP 7.3 or upgrade your installation to at least version 4.15.1.

1 Like

But I am using php verson 7.4 and my cs-cart version is 4.11.3.

On PHP lower than 8.0, only Warning is being showed.

This issue was fixed in CS-Cart 4.12.1, please upgrade your installation to at least to this version.

Or replace:

    public static function getData($data_time)
    {
        $data = array();
        if (!empty($data_time)) {
            $debugger_data = Registry::get('dbg_' . $data_time);
            $data = !empty($debugger_data) ? $debugger_data : array();
            $data = json_decode($data, true);
        }

        return $data;
    }

With:

    public static function getData($data_time)
    {
        if (empty($data_time)) {
            return [];
        }

        $debugger_data = Registry::get('dbg_' . $data_time);

        return empty($debugger_data) ? [] : json_decode($debugger_data, true);
    }
2 Likes