Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS 12.1 PHP 8.1 installed via Brew, Deprecated Warnings on HumbugBox3100 #700

Closed
ooglek opened this issue Jan 20, 2022 · 10 comments
Closed

Comments

@ooglek
Copy link

ooglek commented Jan 20, 2022

I run psysh on other machines using PHP 7.3 without issue.

As Apple removed PHP in MacOS 12, I installed it via Brew.

Now when I run psysh, I get these warnings on most every command. (I replaced the actual username)

PHP Deprecated:  Return type of HumbugBox3100\KevinGH\RequirementChecker\RequirementCollection::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///Users/<ooglek>/bin/psysh/.box/src/RequirementCollection.php on line 12

Deprecated: Return type of HumbugBox3100\KevinGH\RequirementChecker\RequirementCollection::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///Users/<ooglek>/bin/psysh/.box/src/RequirementCollection.php on line 12
PHP Deprecated:  Return type of HumbugBox3100\KevinGH\RequirementChecker\RequirementCollection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///Users/<ooglek>/bin/psysh/.box/src/RequirementCollection.php on line 16

Deprecated: Return type of HumbugBox3100\KevinGH\RequirementChecker\RequirementCollection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///Users/<ooglek>/bin/psysh/.box/src/RequirementCollection.php on line 16
PHP Deprecated:  Return type of _HumbugBox42a59c061d08\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 phar:///Users/<ooglek>/bin/psysh/vendor/symfony/console/Helper/HelperSet.php on line 49

Deprecated: Return type of _HumbugBox42a59c061d08\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 phar:///Users/<ooglek>/bin/psysh/vendor/symfony/console/Helper/HelperSet.php on line 49

As this is part of the phar, I'm not sure how to fix. Is this a PHP 7 vs 8 issue?

@ooglek
Copy link
Author

ooglek commented Jan 20, 2022

Maybe related -- box-project/box builds are failing since the release of 3.14.0. Seems possibly related to Composer 2.2 changes.

Damn dependency hell, eh? :-)

@bobthecow
Copy link
Owner

😕 Yeah, that's a PHP 8 compatibility issue for the pre-built Phars. Types will be the death of us.

Can you get me the output of psy\info()?

@dereckson
Copy link
Contributor

dereckson commented Jan 22, 2022

Not related to Brew or Mac OS X, I can repro with manual .phar installation on FreeBSD 13 or on Debian 11.

See humbug/php-scoper#539 for the upstream issue. Upstream wants a proper refactoring of the attributs, not a quick and dirty solution, see box-project/box#585.

That's not the only library to have this issue. We can also see it in Symfony VarDumper:

Deprecated: Return type of _HumbugBox42a59c061d08\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 phar:///opt/psysh/psysh/vendor/symfony/var-dumper/Cloner/Data.php on line 80

$ psy\info() 
(some new deprecation notices)
 [
     "PsySH version" => "v0.11.1",
     "PHP version" => "8.1.1",
    ...
]

@dereckson
Copy link
Contributor

The issue can't be repro on fresh psysh repository clone, then a composer install, so I suspect stale Composer dependencies in the phar.

@ooglek
Copy link
Author

ooglek commented Jan 23, 2022

{
  "PsySH version": "v0.11.1",
  "PHP version": "8.1.0",
  "OS": "Darwin",
  "default includes": [],
  "require semicolons": false,
  "error logging level": 32767,
  "config file": {
    "default config file": null,
    "local config file": null,
    "PSYSH_CONFIG env": false
  },
  "loop listeners": [
    "Psy\\ExecutionLoop\\ProcessForker"
  ],
  "commands": {
    "help": "Psy\\Command\\HelpCommand",
    "?": "Psy\\Command\\HelpCommand",
    "ls": "Psy\\Command\\ListCommand",
    "dir": "Psy\\Command\\ListCommand",
    "dump": "Psy\\Command\\DumpCommand",
    "doc": "Psy\\Command\\DocCommand",
    "rtfm": "Psy\\Command\\DocCommand",
    "man": "Psy\\Command\\DocCommand",
    "show": "Psy\\Command\\ShowCommand",
    "wtf": "Psy\\Command\\WtfCommand",
    "last-exception": "Psy\\Command\\WtfCommand",
    "wtf?": "Psy\\Command\\WtfCommand",
    "whereami": "Psy\\Command\\WhereamiCommand",
    "throw-up": "Psy\\Command\\ThrowUpCommand",
    "timeit": "Psy\\Command\\TimeitCommand",
    "trace": "Psy\\Command\\TraceCommand",
    "buffer": "Psy\\Command\\BufferCommand",
    "buf": "Psy\\Command\\BufferCommand",
    "clear": "Psy\\Command\\ClearCommand",
    "edit": "Psy\\Command\\EditCommand",
    "sudo": "Psy\\Command\\SudoCommand",
    "history": "Psy\\Command\\HistoryCommand",
    "hist": "Psy\\Command\\HistoryCommand",
    "exit": "Psy\\Command\\ExitCommand",
    "quit": "Psy\\Command\\ExitCommand",
    "q": "Psy\\Command\\ExitCommand"
  },
  "updates": {
    "update available": false,
    "latest release version": "v0.11.1",
    "update check interval": "weekly",
    "update cache file": "~/.config/psysh/update_check.json"
  },
  "pcntl": {
    "pcntl available": true,
    "posix available": true,
    "use pcntl": true
  },
  "input": {
    "interactive mode": "auto",
    "input interactive": true,
    "yolo": false
  },
  "readline": {
    "readline available": true,
    "readline enabled": true,
    "readline service": "Psy\\Readline\\Libedit",
    "readline library": "EditLine wrapper",
    "readline name": "psysh"
  },
  "output": {
    "color mode": "auto",
    "output decorated": null,
    "output verbosity": "normal"
  },
  "history": {
    "history file": "~/.config/psysh/psysh_history",
    "history size": null,
    "erase duplicates": null
  },
  "docs": {
    "manual db file": "~/.local/share/psysh/php_manual.sqlite",
    "sqlite available": true,
    "db lang": "en",
    "db version": "1.3.29",
    "db svn rev": "352311",
    "db built at": "Mon, 18 Jan 2021 15:05:08 +0000",
    "db hash": "1cd305a82157a60712fa40124652715a"
  },
  "autocomplete": {
    "tab completion enabled": true,
    "bracketed paste": false,
    "custom matchers": []
  }
}

@morozov
Copy link

morozov commented Feb 23, 2022

It looks like the phars need to be rebuilt with a newer version of Box. The corresponding changes were fixed in box-project/box#557 and should be available as of release 3.14.0. According to the error message, an older version of Box is used to build the phars (HumbugBox3100).

UPD: building with Box 3.16.0 produces a package that doesn't produce the errors:

$ psysh
Psy Shell v0.11.1 (PHP 8.1.3 — cli) by Justin Hileman
>>> ^D
Exit:  Ctrl+D

@ooglek
Copy link
Author

ooglek commented Feb 24, 2022

Wicked. Thanks @morozov ! Can I help make that happen?

@bobthecow
Copy link
Owner

It'll happen on the next release. We're waiting for an upstream fix for a different issue in symfony/console.

@bobthecow
Copy link
Owner

This is fixed with the latest release. Thanks for your patience.

@ooglek
Copy link
Author

ooglek commented Mar 7, 2022

I've upgraded to 0.11.2 and can confirm that it is working beautifully on FreeBSD 12 and macOS 12.2.1 with PHP 7.3.5 and PHP 8.1.0.

Cheers, and thanks @bobthecow !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants