bobthecow / psysh

A REPL for PHP
https://psysh.org
MIT License
9.71k stars 308 forks source link

Error running 'help' - return value of UnicodeString::length() must be of the type int, null returned #714

Closed irongaze closed 2 years ago

irongaze commented 2 years ago

Running latest (0.11.2) as phar, no config files or command-line overrides, I get the following:

>>> help
PHP Warning:  Use of undefined constant SYMFONY_GRAPHEME_CLUSTER_RX - assumed 'SYMFONY_GRAPHEME_CLUSTER_RX' (this will throw an Error in a future version of PHP) in phar:///home/rmorris/code/app.lexercise.com/scripts/psysh/vendor/symfony/polyfill-intl-grapheme/Grapheme.php on line 70
TypeError: Return value of _HumbugBox0a0703dea8eb\Symfony\Component\String\UnicodeString::length() must be of the type int, null returned
>>>

Error occurs on all tested internal commands (e.g. 'ls') in addition to 'help'.

Running PHP v. 7.4 on Ubuntu 20.04, readline, mbstring installed.

Will dig in in a bit to see what I can find, but as I just installed PsySH, I'd appreciate any ideas on where to start looking...

bobthecow commented 2 years ago

Can you share the output of \psy\info()?

bobthecow commented 2 years ago

(if you can't get it to work in the REPL, you can make a simple php file that includes the phar then runs var_dump(\psy\info()))

irongaze commented 2 years ago
>>> \psy\info();
=> [
     "PsySH version" => "v0.11.2",
     "PHP version" => "7.4.3",
     "OS" => "Linux",
     "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.2",
       "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\GNUReadline",
       "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" => null,
       "sqlite available" => true,
     ],
     "autocomplete" => [
       "tab completion enabled" => true,
       "bracketed paste" => false,
       "custom matchers" => [],
     ],
   ]
bobthecow commented 2 years ago

Ok! I've got a fix in 189701b7beaab29b5d6791c4e8df4a6e4adeac44. It'll be included in the next stable release. Thanks for reporting!

bobthecow commented 2 years ago

Oh just kidding, this might have only fixed the first one! @irongaze do you mind checking the latest release to confirm?

irongaze commented 2 years ago

Just tested w/ 0.11.4, all commands tested worked as expected. Thanks for the quick fix!

bobthecow commented 2 years ago

Great, thanks for confirming.