bobthecow/psysh

Undefined constant "Psy\Readline\Hoa\DS"

dereckson opened this issue · 3 comments

Can only repro this with the last released phar (0.11.13), but not if I clone the repository.

The constant DS in the expression\file_exists(__DIR__.DS.'..'.DS.'..'.DS.'..'.DS.'..'.DS.'autoload.php') doesn't exist.

$ php -v
PHP 8.2.4 (cli) (built: Mar 21 2023 01:19:05) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.4, Copyright (c) Zend Technologies
    with Xdebug v3.2.0, Copyright (c) 2002-2022, by Derick Rethans

$ ./psysh

Fatal error: Uncaught Error: Undefined constant "Psy\Readline\Hoa\DS" in phar:///tmp/psysh/psysh/src/Readline/Hoa/ProtocolNodeLibrary.php on line 9

Error: Undefined constant "Psy\Readline\Hoa\DS" in phar:///tmp/psysh/psysh/src/Readline/Hoa/ProtocolNodeLibrary.php on line 9

Call Stack:
    0.0023    4401672   1. {main}() /tmp/psysh/psysh:0
    0.0229    5793880   2. Psy\{closure:phar:///tmp/psysh/psysh/src/functions.php:163-259}() /tmp/psysh/psysh:155
    0.0254    6370072   3. Psy\Shell->__construct($config = class Psy\Configuration { private $defaultIncludes = []; private $configDir = NULL; private $dataDir = NULL; private $runtimeDir = NULL; private $configFile = NULL; private $historyFile = NULL; private $historySize = NULL; private $eraseDuplicates = NULL; private $manualDbFile = NULL; private $hasReadline = FALSE; private $useReadline = NULL; private $useBracketedPaste = NULL; private $hasPcntl = TRUE; private $usePcntl = NULL; private $newCommands = []; private $pipedInput = FALSE; private $pipedOutput = NULL; private $rawOutput = FALSE; private $requireSemicolons = FALSE; private $useUnicode = NULL; private $useTabCompletion = NULL; private $newMatchers = []; private $errorLoggingLevel = 32767; private $warnOnMultipleConfigs = FALSE; private $colorMode = 'auto'; private $interactiveMode = 'auto'; private $updateCheck = NULL; private $startupMessage = ''; private $forceArrayIndexes = FALSE; private $formatterStyles = []; private $verbosity = 'normal'; private $yolo = FALSE; private $theme = NULL; private $readline = NULL; private $output = NULL; private $shell = NULL; private $cleaner = class Psy\CodeCleaner { private $yolo = FALSE; private $parser = class _HumbugBoxae08e7ce639e\PhpParser\Parser\Php7 { ... }; private $printer = class _HumbugBoxae08e7ce639e\PhpParser\PrettyPrinter\Standard { ... }; private $traverser = class _HumbugBoxae08e7ce639e\PhpParser\NodeTraverser { ... }; private $namespace = NULL }; private $pager = NULL; private $manualDb = NULL; private $presenter = NULL; private $autoCompleter = NULL; private $checker = NULL; private $prompt = NULL; private $configPaths = class Psy\ConfigPaths { private $configDir = NULL; private $dataDir = NULL; private $runtimeDir = NULL; private $env = class Psy\SuperglobalsEnv { ... } } }) phar:///tmp/psysh/psysh/src/functions.php:252
    0.0363    9230776   4. Psy\Configuration->getReadline() phar:///tmp/psysh/psysh/src/Shell.php:64
    0.0363    9230776   5. Psy\Configuration->getReadlineClass() phar:///tmp/psysh/psysh/src/Configuration.php:376
    0.0364    9246352   6. Psy\Readline\Userland::isSupported() phar:///tmp/psysh/psysh/src/Configuration.php:390
    0.0376    9466096   7. Psy\Readline\Hoa\ConsoleTput::isSupported() phar:///tmp/psysh/psysh/src/Readline/Userland.php:23
    0.0376    9466096   8. Psy\Readline\Hoa\ConsoleTput::getTerminfo($term = ???) phar:///tmp/psysh/psysh/src/Readline/Hoa/ConsoleTput.php:151
    0.0377    9466704   9. file_exists($filename = 'hoa://Library/Terminfo/73/screen-256color') phar:///tmp/psysh/psysh/src/Readline/Hoa/ConsoleTput.php:139
    0.0377    9466960  10. Psy\Readline\Hoa\ProtocolWrapper->url_stat($path = 'hoa://Library/Terminfo/73/screen-256color', $flags = 6) phar:///tmp/psysh/psysh/src/Readline/Hoa/ConsoleTput.php:139
    0.0377    9466960  11. Psy\Readline\Hoa\ProtocolWrapper::realPath($path = 'hoa://Library/Terminfo/73/screen-256color', $exists = ???) phar:///tmp/psysh/psysh/src/Readline/Hoa/ProtocolWrapper.php:169
    0.0377    9466960  12. Psy\Readline\Hoa\Protocol->resolve($path = 'hoa://Library/Terminfo/73/screen-256color', $exists = TRUE, $unfold = ???) phar:///tmp/psysh/psysh/src/Readline/Hoa/ProtocolWrapper.php:12
    0.0377    9466992  13. Psy\Readline\Hoa\ProtocolNode->_resolve($path = 'hoa://Library/Terminfo/73/screen-256color', $accumulator = [], $id = ???) phar:///tmp/psysh/psysh/src/Readline/Hoa/Protocol.php:48
    0.0377    9467088  14. Psy\Readline\Hoa\ProtocolNodeLibrary->reach($queue = ???) phar:///tmp/psysh/psysh/src/Readline/Hoa/ProtocolNode.php:88

Code elsewhere uses DIRECTORY_SEPARATOR

Rebuilding the .phar with make build, it works like a charm with DIRECTORY_SEPARATOR.

Preparing patch.

Thanks for the report and for tracking down the issue!