Skip to content

$cache->getInfo() fails when array $cols is used #2255

@matjazpotocnik

Description

@matjazpotocnik

Based on the api ref https://processwire.com/api/ref/wire-cache/get-info/

$array = $cache->getInfo(bool $verbose = true, $names = [], $exclude = [], array $cols = []);

$verbose (optional) | bool | Whether to be more verbose for human readability
$names (optional) | array string | Optionally specify name(s) of cache to get info. If omitted, all caches are included.
$exclude (optional) | array string | Exclude any caches that begin with any of these namespaces Default:[]
$cols (optional) | array | Columns to get, default = [ 'name', 'expires', 'data', 'size' ]

$cache->getInfo(false, 'MyCache*', [], ['name']);

Error: Undefined array key "expires" on line: 1148 in wire/core/WireCache/WireCache.php

Error: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated on line: 1156 in wire/core/WireCache/WireCache.php

This is ok:

$cache->getInfo(false, 'MyCache*', []);

Also, I don't see any difference when $verbose is true or false.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions