coduo/php-matcher

Expecting null but give an array throws strange runtime error

alexander-schranz opened this issue · 3 comments

I have the following snapshot:

{
    "availableLocales": null
}

Which is testing the following json:

{
    "availableLocales": [
        "en"
    ]
}

Example:
https://php-matcher.norbert.tech/?form%5Bvalue%5D=%7B%0D%0A++++%22availableLocales%22%3A+%5B%0D%0A++++++++%22en%22%0D%0A++++%5D%0D%0A%7D&form%5Bpattern%5D=%7B%0D%0A++++%22availableLocales%22%3A+null%0D%0A%7D&form%5Bmatch%5D=

It errors with Argument 4 is null instead of string at:

$this->backtrace->matcherFailed(self::class, $value, $pattern, $this->getError());

It seems like a problem with expecting null but getting an array but not sure where the error exists.

hey @alexander-schranz thanks for reporting this bug!
#336 will fix it, expect a new patch release soon!

Version 6.0.8 was just released