bobthecow / psysh

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

bug: Laravel tinker won't start because of a missing Termfile? #722

Closed sts-ryan-holton closed 2 years ago

sts-ryan-holton commented 2 years ago

I've just tried to start tinker in my Laravel 8 project, I'm working on a Windows 10 PC with Mamp, I'm running PHP 7.4 and when running php artisan tinker I get the following error:

Terminfo file does not exist

I originally posted this on a Stackoverflow and it seems that this is a recent change of this library that has been made to look for a terminfo file?

I've tried manually installing the dev branch into my project as a dependency with as part of a suggestion:

composer require psy/psysh:@dev

But this doesn't resolve my issue and I continue to experience the same error. Furthermore, I have tried changing PHP versions from 7.4 to 7.3 and still get the same error, I've also checked that I have the php_pdo_sqlite extension installed and active and I do. 7G5sX

My production site on a Cent OS 8 machine running PHP 7.4 doesn't experience this error.

bobthecow commented 2 years ago

This exception should be prevented by a recent change in dev. Can you confirm that the isSupported method in Psy\Readline\Userland reads:

return HoaUstring::checkMbString() && HoaConsoleTput::getTerminfo() !== '';
sts-ryan-holton commented 2 years ago

@bobthecow When I run:

composer require psy/psysh:@dev

The following is added to my composer.json file:

"psy/psysh": "@dev",

This is the output from my command line Capture

And then when looking at the location you suggested, I do not see that line. The method still looks like:

/**
 * @return bool
 */
public static function isSupported(): bool
{
    return HoaUstring::checkMbString();
}

If I manually add the last bit, then I get this error:

file_exists(): Unable to find the wrapper "hoa" - did you forget to enable it when you configured PHP?

Still running PHP 7.4

I also tried doing:

composer require psy/psysh:@develop

and

composer require psy/psysh:@main

still no luck

bobthecow commented 2 years ago

yeah, you're definitely not on the most recent psysh. what does composer info show?

sts-ryan-holton commented 2 years ago

@bobthecow what version tag do I need to install? It's clear that dev as a version tag doesn't exist so it never installed thus not containing your change?

bobthecow commented 2 years ago

It should be @dev. If you start a new project and only require psy/psyh:@dev you'll get the current main:

Screen Shot 2022-06-01 at 8 33 07 AM

My guess is that you have another constraint somewhere preventing PsySH from updating.

sts-ryan-holton commented 2 years ago

Did a composer update earlier, getting a different error now:

file_exists(): Unable to find the wrapper "hoa" - did you forget to enable it when you configured PHP?

bobthecow commented 2 years ago

Please share the output of composer info

sts-ryan-holton commented 2 years ago
$ composer info
asm89/stack-cors                     v2.1.1    Cross-origin resource sharing library and stack middleware
bacon/bacon-qr-code                  2.0.7     BaconQrCode is a QR code generator for PHP.
brick/math                           0.9.3     Arbitrary-precision arithmetic library
clue/stream-filter                   v1.6.0    A simple and modern approach to stream filtering in PHP
composer/package-versions-deprecated 1.11.99.5 Composer plugin that provides efficient querying for installed pack...
dasprid/enum                         1.0.3     PHP 7.1 enum implementation
dflydev/dot-access-data              v3.0.1    Given a deep data structure, access data by dot notation.
doctrine/cache                       2.2.0     PHP Doctrine Cache library is a popular cache implementation that s...
doctrine/dbal                        2.13.9    Powerful PHP database abstraction layer (DBAL) with many features f...
doctrine/deprecations                v1.0.0    A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 l...
doctrine/event-manager               1.1.1     The Doctrine Event Manager is a simple PHP event system that was bu...
doctrine/inflector                   2.0.4     PHP Doctrine Inflector is a small library that can perform string m...
doctrine/instantiator                1.4.1     A small, lightweight utility to instantiate objects in PHP without ...
doctrine/lexer                       1.2.3     PHP Doctrine Lexer parser library that can be used in Top-Down, Rec...
dompdf/dompdf                        v1.2.2    DOMPDF is a CSS 2.1 compliant HTML to PDF converter
dragonmantank/cron-expression        v3.3.1    CRON for PHP: Calculate the next or previous run date and determine...
egulias/email-validator              2.1.25    A library for validating emails against several RFCs
facade/flare-client-php              1.9.1     Send PHP errors to Flare
facade/ignition                      2.17.5    A beautiful error page for Laravel applications.
facade/ignition-contracts            1.0.2     Solution contracts for Ignition
fideloper/proxy                      4.4.1     Set trusted proxies for Laravel
filp/whoops                          2.14.5    php error handling for cool kids
fruitcake/laravel-cors               v2.2.0    Adds CORS (Cross-Origin Resource Sharing) headers support in your L...
fzaninotto/faker                     v1.9.2    Faker is a PHP library that generates fake data for you.
geerlingguy/ping                     1.2.1     A PHP class to ping hosts.
graham-campbell/result-type          v1.0.4    An Implementation Of The Result Type
guzzlehttp/guzzle                    7.4.3     Guzzle is a PHP HTTP client library
guzzlehttp/promises                  1.5.1     Guzzle promises library
guzzlehttp/psr7                      2.2.1     PSR-7 message implementation that also provides common utility methods
hamcrest/hamcrest-php                v2.0.1    This is the PHP port of Hamcrest Matchers
http-interop/http-factory-guzzle     1.2.0     An HTTP Factory using Guzzle PSR7
jean85/pretty-package-versions       2.0.5     A library to get pretty versions strings of installed dependencies
laminas/laminas-diactoros            2.11.0    PSR HTTP Message implementations
laravel/cashier                      v13.10.1  Laravel Cashier provides an expressive, fluent interface to Stripe'...
laravel/fortify                      v1.13.0   Backend controllers and scaffolding for Laravel authentication.
laravel/framework                    v8.83.12  The Laravel Framework.
laravel/nexmo-notification-channel   v2.5.1    Nexmo Notification Channel for laravel.
laravel/sanctum                      v2.15.1   Laravel Sanctum provides a featherweight authentication system for ...
laravel/serializable-closure         v1.2.0    Laravel Serializable Closure provides an easy and secure way to ser...
laravel/slack-notification-channel   v2.4.0    Slack Notification Channel for laravel.
laravel/telescope                    v4.9.0    An elegant debug assistant for the Laravel framework.
laravel/tinker                       v2.7.0    Powerful REPL for the Laravel framework.
lcobucci/clock                       2.0.0     Yet another clock abstraction
lcobucci/jwt                         4.0.4     A simple library to work with JSON Web Token and JSON Web Signature
$
league/config                        v1.1.1    Define configuration arrays with strict schemas and access values w...
league/flysystem                     1.1.9     Filesystem abstraction: Many filesystems, one API.
league/mime-type-detection           1.11.0    Mime-type detection for Flysystem
lorisleiva/cron-translator           v0.1.1    Makes CRON expressions human-readable
mockery/mockery                      1.5.0     Mockery is a simple yet flexible PHP mock object framework
moneyphp/money                       v3.3.1    PHP implementation of Fowler's Money pattern
monolog/monolog                      2.6.0     Sends your logs to files, sockets, inboxes, databases and various w...
myclabs/deep-copy                    1.11.0    Create deep copies (clones) of your objects
nesbot/carbon                        2.58.0    An API extension for DateTime that supports 281 different languages.
nette/schema                         v1.2.2    📐 Nette Schema: validating data structures against a given Schema.
nette/utils                          v3.2.7    🛠  Nette Utils: lightweight utilities for string & array manipul...
nexmo/laravel                        2.4.1     Laravel Package for Nexmo's PHP Client
nikic/php-parser                     v4.14.0   A PHP parser written in PHP
nunomaduro/collision                 v5.11.0   Cli error handling for console/command-line PHP applications.
nyholm/psr7                          1.5.0     A fast PHP7 implementation of PSR-7
opis/closure                         3.6.3     A library that can be used to serialize closures (anonymous functio...
paragonie/constant_time_encoding     v2.5.0    Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-3...
phar-io/manifest                     2.0.3     Component for reading phar.io manifest information from a PHP Archi...
phar-io/version                      3.2.1     Library for handling version information and constraints
phenx/php-font-lib                   0.5.4     A library to read, parse, export and make subsets of different type...
phenx/php-svg-lib                    0.4.1     A library to read, parse and export to PDF SVG files.
php-http/client-common               2.5.0     Common HTTP Client implementations and tools for HTTPlug
php-http/discovery                   1.14.2    Finds installed HTTPlug implementations and PSR-7 message factories
php-http/httplug                     2.3.0     HTTPlug, the HTTP client abstraction for PHP
php-http/message                     1.13.0    HTTP Message related tools
php-http/message-factory             v1.0.2    Factory interfaces for PSR-7 HTTP Message
php-http/promise                     1.1.0     Promise used for asynchronous HTTP requests
phpdocumentor/reflection-common      2.2.0     Common reflection classes used by phpdocumentor to reflect the code...
phpdocumentor/reflection-docblock    5.3.0     With this component, a library can provide support for annotations ...
phpdocumentor/type-resolver          1.6.1     A PSR-5 based resolver of Class names, Types and Structural Element...
phpoption/phpoption                  1.8.1     Option Type for PHP
phpspec/prophecy                     v1.15.0   Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage            9.2.15    Library that provides collection, processing, and rendering functio...
phpunit/php-file-iterator            3.0.6     FilterIterator implementation that filters files based on a list of...
phpunit/php-invoker                  3.1.1     Invoke callables with a timeout
phpunit/php-text-template            2.0.4     Simple template engine.
phpunit/php-timer                    5.0.3     Utility class for timing
phpunit/phpunit                      9.5.20    The PHP Unit Testing framework.
pragmarx/google2fa                   8.0.0     A One Time Password Authentication package, compatible with Google ...
psr/container                        1.1.2     Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher                 1.0.0     Standard interfaces for event handling.
psr/http-client                      1.0.1     Common interface for HTTP clients
psr/http-factory                     1.0.1     Common interfaces for PSR-7 HTTP message factories
psr/http-message                     1.0.1     Common interface for HTTP messages
psr/log                              1.1.4     Common interface for logging libraries
psr/simple-cache                     1.0.1     Common interfaces for simple caching
psy/psysh                            v0.11.5   An interactive shell for modern PHP.
ralouphie/getallheaders              3.0.3     A polyfill for getallheaders.
ramsey/collection                    1.2.2     A PHP library for representing and manipulating collections.
ramsey/uuid                          4.2.3     A PHP library for generating and working with universally unique id...
sabberworm/php-css-parser            8.4.0     Parser for CSS Files written in PHP
sebastian/cli-parser                 1.0.1     Library for parsing CLI options
sebastian/code-unit                  1.0.8     Collection of value objects that represent the PHP code units
sebastian/code-unit-reverse-lookup   2.0.3     Looks up which function or method a line of code belongs to
sebastian/comparator                 4.0.6     Provides the functionality to compare PHP values for equality
sebastian/complexity                 2.0.2     Library for calculating the complexity of PHP code units
sebastian/diff                       4.0.4     Diff implementation
sebastian/environment                5.1.4     Provides functionality to handle HHVM/PHP environments
sebastian/exporter                   4.0.4     Provides the functionality to export PHP variables for visualization
sebastian/global-state               5.0.5     Snapshotting of global state
sebastian/lines-of-code              1.0.3     Library for counting the lines of code in PHP source code
sebastian/object-enumerator          4.0.4     Traverses array structures and object graphs to enumerate all refer...
sebastian/object-reflector           2.0.4     Allows reflection of object attributes, including inherited and non...
sebastian/recursion-context          4.0.4     Provides functionality to recursively process PHP variables
sebastian/resource-operations        3.0.3     Provides a list of PHP built-in functions that operate on resources
sebastian/type                       3.0.0     Collection of value objects that represent the types of the PHP typ...
sebastian/version                    3.0.2     Library that helps with managing the version number of Git-hosted P...
sentry/sdk                           3.2.0     This is a metapackage shipping sentry/sentry with a recommended HTT...
sentry/sentry                        3.5.0     A PHP SDK for Sentry (http://sentry.io)
sentry/sentry-laravel                2.12.0    Laravel SDK for Sentry (https://sentry.io)
spatie/laravel-schedule-monitor      2.0.2     Monitor scheduled tasks in a Laravel app
stripe/stripe-php                    v7.128.0  Stripe PHP Library
swiftmailer/swiftmailer              v6.3.0    Swiftmailer, free feature-rich PHP mailer
symfony/console                      v5.4.9    Eases the creation of beautiful and testable command line interfaces
symfony/css-selector                 v5.4.3    Converts CSS selectors to XPath expressions
symfony/deprecation-contracts        v2.5.1    A generic function and convention to trigger deprecation notices
symfony/error-handler                v5.4.9    Provides tools to manage errors and ease debugging PHP code
symfony/event-dispatcher             v5.4.9    Provides tools that allow your application components to communicat...
symfony/event-dispatcher-contracts   v2.5.1    Generic abstractions related to dispatching event
symfony/finder                       v5.4.8    Finds files and directories via an intuitive fluent interface
symfony/http-client                  v5.4.9    Provides powerful methods to fetch HTTP resources synchronously or ...
symfony/http-client-contracts        v2.5.1    Generic abstractions related to HTTP clients
symfony/http-foundation              v5.4.9    Defines an object-oriented layer for the HTTP specification
symfony/http-kernel                  v5.4.9    Provides a structured process for converting a Request into a Response
symfony/mime                         v5.4.9    Allows manipulating MIME messages
symfony/options-resolver             v5.4.3    Provides an improved replacement for the array_replace PHP function
symfony/polyfill-ctype               v1.26.0   Symfony polyfill for ctype functions
symfony/polyfill-iconv               v1.26.0   Symfony polyfill for the Iconv extension
symfony/polyfill-intl-grapheme       v1.26.0   Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-icu            v1.26.0   Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn            v1.26.0   Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-intl-normalizer     v1.26.0   Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring            v1.26.0   Symfony polyfill for the Mbstring extension
symfony/polyfill-php72               v1.26.0   Symfony polyfill backporting some PHP 7.2+ features to lower PHP ve...
symfony/polyfill-php73               v1.26.0   Symfony polyfill backporting some PHP 7.3+ features to lower PHP ve...
symfony/polyfill-php80               v1.26.0   Symfony polyfill backporting some PHP 8.0+ features to lower PHP ve...
symfony/polyfill-php81               v1.26.0   Symfony polyfill backporting some PHP 8.1+ features to lower PHP ve...
symfony/polyfill-uuid                v1.26.0   Symfony polyfill for uuid functions
symfony/process                      v5.4.2    Executes commands in sub-processes
symfony/psr-http-message-bridge      v2.1.2    PSR HTTP message bridge
symfony/routing                      v5.4.8    Maps an HTTP request to a set of configuration variables
symfony/service-contracts            v2.5.1    Generic abstractions related to writing services
symfony/string                       v5.4.9    Provides an object-oriented API to strings and deals with bytes, UT...
symfony/translation                  v5.4.9    Provides tools to internationalize your application
symfony/translation-contracts        v2.5.1    Generic abstractions related to translation
symfony/var-dumper                   v5.4.9    Provides mechanisms for walking through any arbitrary PHP variable
theseer/tokenizer                    1.2.1     A small library for converting tokenized PHP source code into XML a...
tijsverkoyen/css-to-inline-styles    2.2.4     CssToInlineStyles is a class that enables you to convert HTML-pages...
vlucas/phpdotenv                     v5.4.1    Loads environment variables from `.env` to `getenv()`, `$_ENV` and ...
voku/portable-ascii                  1.6.1     Portable ASCII library - performance optimized (ascii) string funct...
vonage/client                        2.4.0     PHP Client for using Vonage's API.
vonage/client-core                   2.10.1    PHP Client for using Vonage's API.
vonage/nexmo-bridge                  0.1.1     Provides a bridge for using the Vonage PHP SDK with the older Nexmo...
webmozart/assert                     1.11.0    Assertions to validate method input/output with nice error messages.
bobthecow commented 2 years ago

You have the current stable PsySH version installed:

psy/psysh                            v0.11.5   An interactive shell for modern PHP.

Try updating your PsySH dependency to dev-main#93d6a05, re-running composer update, and checking the info output again.

tapacko88 commented 2 years ago

dev-main#93d6a05

In console it works for me even without the dev version, but in laravel plugin tinker window I have an error and with this dev version another error: PHP Fatal error: Uncaught ErrorException: file_exists(): Unable to find the wrapper "hoa" - did you forget to enable it when you configured PHP? \vendor\psy\psysh\src\Readline\Hoa\ConsoleTput.php:791

mayne commented 2 years ago

I got the same problem, when I downgrade psy/psysh from v0.11.4 to v0.11.2, it fixed

bobthecow commented 2 years ago

Can someone try installing just psy/psysh in an empty composer project on a machine where this repros (rather than a dependency of Laravel)?

enesbsafak commented 2 years ago

I have done all the steps but the problem persists.

bobthecow commented 2 years ago

Please run composer info | grep psysh and share the result.

enesbsafak commented 2 years ago

Please run composer info | grep psysh and share the result.

nesbot/carbon                    2.58.0  An API extension for DateTime that supports 281 different languages.
nikic/php-parser                 v4.14.0 A PHP parser written in PHP
psr/container                    2.0.2   Common Container Interface (PHP FIG PSR-11)
psy/psysh                        v0.11.2 An interactive shell for modern PHP.
smater/grep                      1.0.1   Linux常用命令查找
symfony/console                  v6.1.2  Eases the creation of beautiful and testable command line interfaces
symfony/deprecation-contracts    v3.1.0  A generic function and convention to trigger deprecation notices
symfony/polyfill-ctype           v1.26.0 Symfony polyfill for ctype functions
symfony/polyfill-intl-grapheme   v1.26.0 Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-normalizer v1.26.0 Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring        v1.26.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php80           v1.26.0 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/service-contracts        v3.1.0  Generic abstractions related to writing services
symfony/string                   v6.1.2  Provides an object-oriented API to strings and deals with bytes, UTF-8 co...
symfony/translation              v6.1.0  Provides tools to internationalize your application
symfony/translation-contracts    v3.1.0  Generic abstractions related to translation
symfony/var-dumper               v6.1.0  Provides mechanisms for walking through any arbitrary PHP variable
bobthecow commented 2 years ago

Wait. With that composer setup you have the issue?

enesbsafak commented 2 years ago

Wait. With that composer setup you have the issue?

Yes, sorry if I'm making a mistake somewhere, I'm still learning, I'm trying to use tinker for laravel.

bobthecow commented 2 years ago

No, this is weird. Probably not your fault. That shows you running v0.11.2, which other people have claimed fixes their issue.

enesbsafak commented 2 years ago

No, this is weird. Probably not your fault. That shows you running v0.11.2, which other people have claimed fixes their issue.

return HoaUstring::checkMbString() && HoaConsoleTput::getTerminfo() !== '';

When I add this code, I get the following output.


file_exists(): Unable to find the wrapper "hoa" - did you forget to enable it when you configured PHP?

  at C:\MAMP\htdocs\dbtest\vendor\psy\psysh\src\Readline\Hoa\ConsoleTput.php:791
    787▕         $fileAlpha = $term[0].\DIRECTORY_SEPARATOR.$term;
    788▕         $pathname = null;
    789▕
    790▕         foreach ($paths as $path) {
  ➜ 791▕             if (\file_exists($_ = $path.\DIRECTORY_SEPARATOR.$fileHexa) ||
    792▕                 \file_exists($_ = $path.\DIRECTORY_SEPARATOR.$fileAlpha)) {
    793▕                 $pathname = $_;
    794▕
    795▕                 break;

  1   C:\MAMP\htdocs\dbtest\vendor\psy\psysh\src\Readline\Hoa\ConsoleTput.php:791
      file_exists()

  2   C:\MAMP\htdocs\dbtest\vendor\psy\psysh\src\Readline\Userland.php:43
      Psy\Readline\Hoa\ConsoleTput::getTerminfo()
bobthecow commented 2 years ago

PsySH v0.11.2 does not include the file src\Readline\Hoa\ConsoleTput.php:

https://github.com/bobthecow/psysh/tree/7f7da640d68b9c9fec819caae7c744a213df6514/src/Readline

It's from before that code was landed. So something's definitely weird. Try running composer update?

enesbsafak commented 2 years ago

PsySH v0.11.2 does not include the file src\Readline\Hoa\ConsoleTput.php:

https://github.com/bobthecow/psysh/tree/7f7da640d68b9c9fec819caae7c744a213df6514/src/Readline

It's from before that code was landed. So something's definitely weird. Try running composer update?

When I enter the update command I get the following output

Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
13 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
bobthecow commented 2 years ago

How about composer info psy/psysh?

enesbsafak commented 2 years ago

How about composer info psy/psysh?

name     : psy/psysh
descrip. : An interactive shell for modern PHP.
keywords : REPL, console, interactive, shell
versions : * v0.11.2
type     : library
license  : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
homepage : http://psysh.org
source   : [git] https://github.com/bobthecow/psysh.git 7f7da640d68b9c9fec819caae7c744a213df6514
dist     : [zip] https://api.github.com/repos/bobthecow/psysh/zipball/7f7da640d68b9c9fec819caae7c744a213df6514 7f7da640d68b9c9fec819caae7c744a213df6514
path     : C:\Users\eness\vendor\psy\psysh
names    : psy/psysh

support
issues : https://github.com/bobthecow/psysh/issues
source : https://github.com/bobthecow/psysh/tree/v0.11.2

autoload
files
psr-4
Psy\ => src/

requires
ext-json *
ext-tokenizer *
nikic/php-parser ^4.0 || ^3.1
php ^8.0 || ^7.0.8
symfony/console ^6.0 || ^5.0 || ^4.0 || ^3.4
symfony/var-dumper ^6.0 || ^5.0 || ^4.0 || ^3.4

requires (dev)
bamarni/composer-bin-plugin ^1.2
hoa/console 3.17.05.02

suggests
ext-pcntl Enabling the PCNTL extension makes PsySH a lot happier :)
ext-pdo-sqlite The doc command requires SQLite to work.
ext-posix If you have PCNTL, you'll want the POSIX extension as well.
ext-readline Enables support for arrow-key history navigation, and showing and manipulating command history.
hoa/console A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit.

conflicts
symfony/console 4.4.37 || 5.3.14 || 5.3.15 || 5.4.3 || 5.4.4 || 6.0.3 || 6.0.4
enesbsafak commented 2 years ago

How about composer info psy/psysh?

name     : psy/psysh
descrip. : An interactive shell for modern PHP.
keywords : REPL, console, interactive, shell
versions : * v0.11.2
type     : library
license  : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
homepage : http://psysh.org
source   : [git] https://github.com/bobthecow/psysh.git 7f7da640d68b9c9fec819caae7c744a213df6514
dist     : [zip] https://api.github.com/repos/bobthecow/psysh/zipball/7f7da640d68b9c9fec819caae7c744a213df6514 7f7da640d68b9c9fec819caae7c744a213df6514
path     : C:\Users\eness\vendor\psy\psysh
names    : psy/psysh

support
issues : https://github.com/bobthecow/psysh/issues
source : https://github.com/bobthecow/psysh/tree/v0.11.2

autoload
files
psr-4
Psy\ => src/

requires
ext-json *
ext-tokenizer *
nikic/php-parser ^4.0 || ^3.1
php ^8.0 || ^7.0.8
symfony/console ^6.0 || ^5.0 || ^4.0 || ^3.4
symfony/var-dumper ^6.0 || ^5.0 || ^4.0 || ^3.4

requires (dev)
bamarni/composer-bin-plugin ^1.2
hoa/console 3.17.05.02

suggests
ext-pcntl Enabling the PCNTL extension makes PsySH a lot happier :)
ext-pdo-sqlite The doc command requires SQLite to work.
ext-posix If you have PCNTL, you'll want the POSIX extension as well.
ext-readline Enables support for arrow-key history navigation, and showing and manipulating command history.
hoa/console A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit.

conflicts
symfony/console 4.4.37 || 5.3.14 || 5.3.15 || 5.4.3 || 5.4.4 || 6.0.3 || 6.0.4

Could this error be caused by PHP version?

bobthecow commented 2 years ago

Composer installs dependencies locally to a project. Your error above is in C:\MAMP\htdocs\dbtest\vendor\psy\psysh. The composer dependencies you're interacting with right now are in C:\Users\eness\vendor\psy\psysh. Change to C:\MAMP\htdocs\dbtest and try again?

enesbsafak commented 2 years ago

Composer installs dependencies locally to a project. Your error above is in C:\MAMP\htdocs\dbtest\vendor\psy\psysh. The composer dependencies you're interacting with right now are in C:\Users\eness\vendor\psy\psysh. Change to C:\MAMP\htdocs\dbtest and try again?

name     : psy/psysh
descrip. : An interactive shell for modern PHP.
keywords : REPL, console, interactive, shell
versions : * v0.11.5
type     : library
license  : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
homepage : http://psysh.org
source   : [git] https://github.com/bobthecow/psysh.git c23686f9c48ca202710dbb967df8385a952a2daf
dist     : [zip] https://api.github.com/repos/bobthecow/psysh/zipball/c23686f9c48ca202710dbb967df8385a952a2daf c23686f9c48ca202710dbb967df8385a952a2daf
path     : C:\MAMP\htdocs\dbtest\vendor\psy\psysh
names    : psy/psysh

support
issues : https://github.com/bobthecow/psysh/issues
source : https://github.com/bobthecow/psysh/tree/v0.11.5

autoload
files
psr-4
Psy\ => src/

requires
ext-json *
ext-tokenizer *
nikic/php-parser ^4.0 || ^3.1
php ^8.0 || ^7.0.8
symfony/console ^6.0 || ^5.0 || ^4.0 || ^3.4
symfony/var-dumper ^6.0 || ^5.0 || ^4.0 || ^3.4

requires (dev)
bamarni/composer-bin-plugin ^1.2

suggests
ext-pcntl Enabling the PCNTL extension makes PsySH a lot happier :)
ext-pdo-sqlite The doc command requires SQLite to work.
ext-posix If you have PCNTL, you'll want the POSIX extension as well.
ext-readline Enables support for arrow-key history navigation, and showing and manipulating command history.

conflicts
symfony/console 4.4.37 || 5.3.14 || 5.3.15 || 5.4.3 || 5.4.4 || 6.0.3 || 6.0.4
bobthecow commented 2 years ago

Okay, so this is v0.11.5, which is known to have this issue. From here, please run composer require psy/psysh:dev-main#93d6a05, and see if the issue persists.

enesbsafak commented 2 years ago

Okay, so this is v0.11.5, which is known to have this issue. From here, please run composer require psy/psysh:dev-main#93d6a05, and see if the issue persists.

The same problem persisted when I did this.

composer require psy/psysh:dev-main#93d6a05

But when I reinstalled this version it was fixed

composer require psy/psysh:0.11.2 --dev

Thank you very much for helping and solving my problem.

bobthecow commented 2 years ago

I mean, that's a temporary workaround. We still need to solve the actual problem :)

enesbsafak commented 2 years ago

I mean, that's a temporary workaround. We still need to solve the actual problem :)

Yes you're right, is there anything I can do about it?

bobthecow commented 2 years ago

Yeah! Can you try switching to the dev-main version (from that directory), running composer update, then paste the exact output when it fails?

enesbsafak commented 2 years ago

Yeah! Can you try switching to the dev-main version (from that directory), running composer update, then paste the exact output when it fails?

Error :


  1   C:\MAMP\htdocs\dbtest\vendor\psy\psysh\src\Readline\Hoa\ConsoleTput.php:791
      file_exists()

  2   C:\MAMP\htdocs\dbtest\vendor\psy\psysh\src\Readline\Hoa\ConsoleTput.php:811
      Psy\Readline\Hoa\ConsoleTput::getTerminfo()

İnfo :

C:\MAMP\htdocs\dbtest>composer info psy/psysh
name     : psy/psysh
descrip. : An interactive shell for modern PHP.
keywords : REPL, console, interactive, shell
versions : * 0.11.x-dev, * dev-main
type     : library
license  : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
homepage : http://psysh.org
source   : [git] https://github.com/bobthecow/psysh.git e1354e6f7ffed05c187b56d7f0522aa652dc2d10
dist     : [zip] https://api.github.com/repos/bobthecow/psysh/zipball/e1354e6f7ffed05c187b56d7f0522aa652dc2d10 e1354e6f7ffed05c187b56d7f0522aa652dc2d10
path     : C:\MAMP\htdocs\dbtest\vendor\psy\psysh
names    : psy/psysh

support
issues : https://github.com/bobthecow/psysh/issues
source : https://github.com/bobthecow/psysh/tree/main

autoload
files
psr-4
Psy\ => src/

requires
ext-json *
ext-tokenizer *
nikic/php-parser ^4.0 || ^3.1
php ^8.0 || ^7.0.8
symfony/console ^6.0 || ^5.0 || ^4.0 || ^3.4
symfony/var-dumper ^6.0 || ^5.0 || ^4.0 || ^3.4

requires (dev)
bamarni/composer-bin-plugin ^1.2

suggests
ext-pcntl Enabling the PCNTL extension makes PsySH a lot happier :)
ext-pdo-sqlite The doc command requires SQLite to work.
ext-posix If you have PCNTL, you'll want the POSIX extension as well.
ext-readline Enables support for arrow-key history navigation, and showing and manipulating command history.

conflicts
symfony/console 4.4.37 || 5.3.14 || 5.3.15 || 5.4.3 || 5.4.4 || 6.0.3 || 6.0.4
bobthecow commented 2 years ago

is this any better with the latest release @enesbsafak @mayne @tapacko88 @sts-ryan-holton?

daniser commented 2 years ago

https://github.com/bobthecow/psysh/blob/77fc7270031fbc28f9a7bea31385da5c4855cb7a/src/Readline/Hoa/ConsoleTput.php#L783 I've added additional check if hoa stream wrapper registered and exception gone:

if (in_array('hoa', stream_get_wrappers())) {
    $paths[] = 'hoa://Library/Terminfo';
}

Now it falls back to Transient readline implementation on my machine (Windows).

bobthecow commented 2 years ago

I've added additional check if hoa stream wrapper registered

but this is the library which registers the hoa stream wrapper so … how is it not present?

daniser commented 2 years ago

I've added additional check if hoa stream wrapper registered

but this is the library which registers the hoa stream wrapper so … how is it not present?

https://github.com/bobthecow/psysh/blob/77fc7270031fbc28f9a7bea31385da5c4855cb7a/src/Configuration.php#L822 isSupported() called statically, so stream wrapper is uninitialized at this stage.

https://github.com/bobthecow/psysh/blob/77fc7270031fbc28f9a7bea31385da5c4855cb7a/src/Configuration.php#L795 Stream wrapper actually registers here.

P.S. I think adding static::bootstrapHoa(); into isSupported() function will do the job.

bobthecow commented 2 years ago

A fix has landed (thanks @daniser!) and will be in the next release.

bobthecow commented 2 years ago

Thanks for your patience. This has been resolved in v0.11.8.