Deprecated warnings after upgrade to PHP 8.1
GlassGruber opened this issue · 5 comments
I've recently upgraded my PHP install from 8.0 to 8.1 (8.1.25 to be specific) and every time I open and use psysh several deprecated messages are printed on console.
Brief installation data
$ composer --version
Composer version 2.6.5 2023-10-06 10:11:52
$ php --version
PHP 8.1.25 (cli) (built: Oct 25 2023 08:05:15) (NTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.1.25, Copyright (c) Zend Technologies
Below is the console output when the app is started and calling for example get_loaded_extensions()
Thank you!
$ psysh
PHP Deprecated: Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in [REDACTED_PATH]\.composer\vendor\symfony\console\Helper\HelperSet.php on line 94
Deprecated: Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in [REDACTED_PATH]\.composer\vendor\symfony\console\Helper\HelperSet.php on line 94
Psy Shell v0.11.22 (PHP 8.1.25 — cli) by Justin Hileman
> get_loaded_extensions()
PHP Deprecated: Return type of Symfony\Component\VarDumper\Cloner\Data::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in [REDACTED_PATH]\.composer\vendor\symfony\var-dumper\Cloner\Data.php on line 153
Deprecated: Return type of Symfony\Component\VarDumper\Cloner\Data::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in [REDACTED_PATH]\.composer\vendor\symfony\var-dumper\Cloner\Data.php on line 153
PHP Deprecated: Return type of Symfony\Component\VarDumper\Cloner\Data::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in [REDACTED_PATH]\.composer\vendor\symfony\var-dumper\Cloner\Data.php on line 158
Deprecated: Return type of Symfony\Component\VarDumper\Cloner\Data::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in [REDACTED_PATH]\.composer\vendor\symfony\var-dumper\Cloner\Data.php on line 158
PHP Deprecated: Return type of Symfony\Component\VarDumper\Cloner\Data::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in [REDACTED_PATH]\.composer\vendor\symfony\var-dumper\Cloner\Data.php on line 163
Deprecated: Return type of Symfony\Component\VarDumper\Cloner\Data::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in [REDACTED_PATH]\.composer\vendor\symfony\var-dumper\Cloner\Data.php on line 163
PHP Deprecated: Return type of Symfony\Component\VarDumper\Cloner\Data::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in [REDACTED_PATH]\.composer\vendor\symfony\var-dumper\Cloner\Data.php on line 168
Deprecated: Return type of Symfony\Component\VarDumper\Cloner\Data::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in [REDACTED_PATH]\.composer\vendor\symfony\var-dumper\Cloner\Data.php on line 168
PHP Deprecated: Return type of Symfony\Component\VarDumper\Cloner\Data::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in [REDACTED_PATH]\.composer\vendor\symfony\var-dumper\Cloner\Data.php on line 114
Deprecated: Return type of Symfony\Component\VarDumper\Cloner\Data::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in [REDACTED_PATH]\.composer\vendor\symfony\var-dumper\Cloner\Data.php on line 114
PHP Deprecated: Return type of Symfony\Component\VarDumper\Cloner\Data::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in [REDACTED_PATH]\.composer\vendor\symfony\var-dumper\Cloner\Data.php on line 122
Deprecated: Return type of Symfony\Component\VarDumper\Cloner\Data::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in [REDACTED_PATH]\.composer\vendor\symfony\var-dumper\Cloner\Data.php on line 122
= [
"Core",
"bcmath",
"calendar",
"ctype",
"date",
"filter",
"hash",
"iconv",
"json",
"SPL",
"pcre",
"readline",
"Reflection",
"session",
"standard",
"mysqlnd",
"tokenizer",
"zip",
"zlib",
"libxml",
"dom",
"PDO",
"openssl",
"SimpleXML",
"xml",
"xmlreader",
"xmlwriter",
"curl",
"fileinfo",
"gd",
"intl",
"imap",
"mbstring",
"exif",
"Phar",
"pdo_mysql",
]
>
You're running a pretty outdated version of two of PsySH's dependencies (symfony/console and symfony/var-dumper).
It looks like you might be using Composer global install? If you are, and you just switched to a more recent PHP version, try running composer global update
to upgrade to PHP 8.1 compatible versions of those libraries.
Thanks a lot, that fixed it, sorry this looks like a RTFM issue on my side.
It's very weird though because no warnings popped up when I did composer update for psysh package, I expected composer would have complained about outdated dependencies, I thought it would take care of everything necessary.
PsySH (intentionally) supports an extremely wide range of versions for its dependencies—as of the latest release, we support Symfony library versions over six years old. So if you just tried having Composer update PsySH, there's no reason it would try to update anything else.
Interesting, guess I need to brush up quite more deeply composer mechanics and general practices. I guess I should have done something like composer update psy/psysh --with-dependencies
.
Thank you for your time!
Yep, that would have done it :)