Closed downace closed 5 years ago
var_exporting League\Uri\Http without auth info outputs code where user_info is null. This code leads to TypeError.
var_export
League\Uri\Http
user_info
null
TypeError
$uri = \League\Uri\Http::createFromString('http://example.test'); $exported = var_export($uri, true); $uri = eval("return $exported;"); // just for demonstration var_dump($uri);
class League\Uri\Http#4 (9) { protected $scheme => string(4) "http" protected $user_info => NULL protected $host => string(12) "example.test" protected $port => NULL protected $authority => string(12) "example.test" protected $path => string(0) "" protected $query => NULL protected $fragment => NULL protected $uri => NULL }
Fatal error: Uncaught TypeError: explode() expects parameter 2 to be string, null given in /var/www/html/vendor/league/uri-schemes/src/AbstractUri.php on line 140 TypeError: explode() expects parameter 2 to be string, null given in /var/www/html/vendor/league/uri-schemes/src/AbstractUri.php on line 140 Call Stack: 0.0001 387904 1. {main}() /usr/src/scratches/scratch_312.php:0 0.0346 5488296 2. eval('return League\Uri\Http::__set_state(array( 'scheme' => 'http', 'user_info' => NULL, 'host' => 'example.test', 'port' => NULL, 'authority' => 'example.test', 'path' => '', 'query' => NULL, 'fragment' => NULL, 'uri' => NULL, ));') /usr/src/scratches/scratch_312.php:9 0.0346 5488296 3. League\Uri\AbstractUri::__set_state() /usr/src/scratches/scratch_312.php(9) : eval()'d code:2 0.0346 5488296 4. explode() /var/www/html/vendor/league/uri-schemes/src/AbstractUri.php:140
@downace thanks for reporting the issue the related package is being fixed. A bugfix release may be released next week or the week after.
the fix has been released for a while 😄
Issue summary
var_export
ingLeague\Uri\Http
without auth info outputs code whereuser_info
isnull
. This code leads toTypeError
.System informations
Standalone code, or other way to reproduce the problem
Expected result
Actual result