Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Uncaught TypeError: Return value of Zend\\Diactoros\\Uri::filterQueryOrFragment() must be of the type string, null returned #357
TypeError does not occur
@weierophinney Hi, here you go
This is not even a problem for recreating this particular case. Uri::filterPath() has type checks to return string. And preg_replace_callback that is inside might return null if some errors occurs. There is no checks for that situation and it might happen that Uri::filterPath() will return null - thus breaking contract.
In my local environment diactoros unit tests fails due to this exact problem:
And preg_last_error() return 4 which is PREG_BAD_UTF8_ERROR code.
I'm trying to find which configuration option is doing this, but i suspect that some locale configuration might do that.
However this is not even an issue as there are environments that are running with this configuration and they are affected by this TypeError issue. AFAIK throwing exception or emmiting error will be BC way of fixing that (changing return type to nullable is probably bad idea)
I could attach my php.ini configuration to maybe help recreating this issue?
I added to tests example that will fail preg match here
and travis will fail