Skip to content

Commit

Permalink
Fix #51695: CLI interactive mode broken without readline/editline
Browse files Browse the repository at this point in the history
  • Loading branch information
cmb69 committed Nov 9, 2021
1 parent bd8169a commit 688cc56
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions features/commandline.xml
Expand Up @@ -1594,6 +1594,17 @@ php >
defined before called.
</para>
</note>

<section xml:id="features.commandline.interactive.mode">
<title>Interactive mode</title>
<para>
If the readline extension is not available, invoking the &cli.sapi; with the
<option>-a</option> option provides the interactive mode. In this mode, a
complete PHP script is supposed to be given via STDIN, and after termination
with <literal>CRTL+d</literal> (POSIX) or <literal>CTRL+z</literal>
followed by <literal>ENTER</literal> (Windows), this script is evaluated.
</para>
</section>

This comment has been minimized.

Copy link
@mumumu

mumumu Nov 9, 2021

Member

@cmb69 As of PHP 8.1.0, -a option without readline extension emits error. Also, complete PHP script entering mode from STDIN is enabled when calling php without any arguments.

$ php --version
8.1.0RC5
$ php -a
Interactive shell (-a) requires the readline extension.
$ php
<?php
echo "hello!";
(... entering <CTRL+d> in POSIX
hello!
$

This comment has been minimized.

Copy link
@cmb69

cmb69 Nov 9, 2021

Author Contributor

Ah, I wasn't aware of that change in PHP 8.1 (well, guess I forgot about it). And yes, php without option behaves the same, but I wanted to document the difference between interactive mode/shell, which apparently causes a lot of confusion. I'll update the docs ASAP.

This comment has been minimized.

Copy link
@cmb69

cmb69 Nov 9, 2021

Author Contributor

Done as a2fc238. Thanks for pointing this out, @mumumu!

</section>
<!--}}}-->

Expand Down

0 comments on commit 688cc56

Please sign in to comment.