Skip to content

[Error] Attempt to modify property "tags" on null #196

Closed
@GaryReckard

Description

@GaryReckard

I'm seeing this error "[Error] Attempt to modify property "tags" on null" show up on my production site that I just upgraded from Craft 3 to Craft 5, when using the element-api and when no results are returned. This doesn't happen locally, haven't figured out why yet, but I did notice when inspecting the code that these lines:

[$dep, $maxDuration] = $elementsService->stopCollectingCacheInfo();
$dep->tags[] = 'element-api';

are going to fail with that error this due to these lines:

        if (empty($tags)) {
            return [null, null];
        }

in
https://github.com/craftcms/cms/blob/00a6febb85972771ca9af8d42abb28c5cd24a40a/src/services/Elements.php#L749-L751

Not sure the best resolution here, but wanted to flag.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions