Skip to content

Type Error: current ZoneSite #176

@benwalch

Description

@benwalch
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no

In different scenarios, the following Error occurred:

TypeError

I18nBundle\Context\I18nContext::getCurrentZoneSite(): Return value must be of type I18nBundle\Model\ZoneSiteInterface, null returned

The return type of determinateCurrentZoneSite() in https://github.com/dachcom-digital/pimcore-i18n/blob/master/src/Context/I18nContext.php#L277 is nullable, also the property currentZoneSite.
Therefore, cases may occur, where currentZoneSite of the i18n context is null.

But the return type of getCurrentZoneSite() in https://github.com/dachcom-digital/pimcore-i18n/blob/master/src/Context/I18nContext.php#L66 is non-nullable.
Calling this getter when the property is null leads to this error and the whole thing crashes

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