Skip to content

Pressing backspace in an empty text input crashes the menu system #266

Open
@tbannister

Description

@tbannister

To duplicate: Open a new text input using v4.3.0 of cli-menu and press the backspace key until there the placeholder text has been deleted, then press it once more.
Expected result: Nothing happens.
Actual result:
Fatal error: Uncaught TypeError: Argument 2 passed to PhpSchool\CliMenu\Input\InputIO::drawInput() must be of the type string, bool given, called in /.../vendor/php-school/cli-menu/src/Input/InputIO.php on line 80 and defined in /.../vendor/php-school/cli-menu/src/Input/InputIO.php on line 205
Also, after the crash the terminal window stops echoing input.
Environment: CentOS 7.9, running PHP 7.4.20

Sample code:
'$result = $menu->askText()
->setPromptText($prompt.' :')
->ask();'

I can replicate this behavior with the text input sample code in the examples directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions