Hi internals,
If the readline extension is enabled, PHP provides an interactive shell
under -a. If it is not enabled, it falls back to an "interactive mode"
(yes, the difference between "interactive shell" and "interactive mode" is
important here). The interactive mode is simply an stdin input, which needs
to be terminated using Ctrl+D. You can only run one script that way.
I think the current behavior is quite confusing, because it's really not
obvious that you ended up in this fallback mode (you need to know the
difference between "shell" and "mode" in the output) and most people
wouldn't know what to do with it. The latest instance of this is
https://bugs.php.net/bug.php?id=81033.
I think we would be better off disabling -a completely if readline is not
available, and exit with a helpful error message. I've opened
https://github.com/php/php-src/pull/6976 to that effect. Does that sound
reasonable?
Regards,
Nikita
Am 12.05.2021 um 10:12 schrieb Nikita Popov nikita.ppv@gmail.com:
Hi internals,
If the readline extension is enabled, PHP provides an interactive shell
under -a. If it is not enabled, it falls back to an "interactive mode"
(yes, the difference between "interactive shell" and "interactive mode" is
important here). The interactive mode is simply an stdin input, which needs
to be terminated using Ctrl+D. You can only run one script that way.I think the current behavior is quite confusing, because it's really not
obvious that you ended up in this fallback mode (you need to know the
difference between "shell" and "mode" in the output) and most people
wouldn't know what to do with it. The latest instance of this is
https://bugs.php.net/bug.php?id=81033.I think we would be better off disabling -a completely if readline is not
available, and exit with a helpful error message. I've opened
https://github.com/php/php-src/pull/6976 to that effect. Does that sound
reasonable?Regards,
Nikita
Hi Nikita,
if I may ask, would it also be possible to have deadline as a mandatory
dependency to always have the interactive shell available? Is there a good
reason to compile PHP without? Having a basic prompt available is really
handy at times — especially looking at Node.js with their ahead-completion
and general UX.
The same has been done for other PHP modules in the past, so I wonder if
we could simply have readline as a guarantee.
Regards,
Moritz
Am 12.05.2021 um 10:12 schrieb Nikita Popov nikita.ppv@gmail.com:
Hi internals,
If the readline extension is enabled, PHP provides an interactive shell
under -a. If it is not enabled, it falls back to an "interactive mode"
(yes, the difference between "interactive shell" and "interactive mode"
is
important here). The interactive mode is simply an stdin input, which
needs
to be terminated using Ctrl+D. You can only run one script that way.I think the current behavior is quite confusing, because it's really not
obvious that you ended up in this fallback mode (you need to know the
difference between "shell" and "mode" in the output) and most people
wouldn't know what to do with it. The latest instance of this is
https://bugs.php.net/bug.php?id=81033.I think we would be better off disabling -a completely if readline is not
available, and exit with a helpful error message. I've opened
https://github.com/php/php-src/pull/6976 to that effect. Does that sound
reasonable?Regards,
NikitaHi Nikita,
if I may ask, would it also be possible to have deadline as a mandatory
dependency to always have the interactive shell available? Is there a good
reason to compile PHP without? Having a basic prompt available is really
handy at times — especially looking at Node.js with their ahead-completion
and general UX.
The same has been done for other PHP modules in the past, so I wonder if
we could simply have readline as a guarantee.
The readline extension has an external dependency on readline / libedit.
Making it a required extension would also make this a required dependency.
We avoid having dependencies for the minimal build. The only dependency we
currently have is libpcre, and we vendor that one. I doubt we'll want to
add a new vendored dependency, as they tend to be a major pain.
I personally do not use the interactive shell (and I think most people who
do use an interactive shell prefer psysh), so I don't think this can be
reasonably considered a "required" feature.
Regards,
Nikita
Morning Nikita,
+1 on the change to cli.
It can't really be a default extension right now because readline license
is not compatible:
https://github.com/php/php-src/pull/3823
Even without the license problem, I'm not convinced of the value of adding
the dependency: Because of this long standing strange behaviour, I don't
really think the interactive shell is well used.
Cheers
Joe
Am 12.05.2021 um 10:12 schrieb Nikita Popov nikita.ppv@gmail.com:
Hi internals,
If the readline extension is enabled, PHP provides an interactive shell
under -a. If it is not enabled, it falls back to an "interactive mode"
(yes, the difference between "interactive shell" and "interactive mode"
is
important here). The interactive mode is simply an stdin input, which
needs
to be terminated using Ctrl+D. You can only run one script that way.I think the current behavior is quite confusing, because it's really
not
obvious that you ended up in this fallback mode (you need to know the
difference between "shell" and "mode" in the output) and most people
wouldn't know what to do with it. The latest instance of this is
https://bugs.php.net/bug.php?id=81033.I think we would be better off disabling -a completely if readline is
not
available, and exit with a helpful error message. I've opened
https://github.com/php/php-src/pull/6976 to that effect. Does that
sound
reasonable?Regards,
NikitaHi Nikita,
if I may ask, would it also be possible to have deadline as a mandatory
dependency to always have the interactive shell available? Is there a
good
reason to compile PHP without? Having a basic prompt available is really
handy at times — especially looking at Node.js with their
ahead-completion
and general UX.
The same has been done for other PHP modules in the past, so I wonder if
we could simply have readline as a guarantee.The readline extension has an external dependency on readline / libedit.
Making it a required extension would also make this a required dependency.
We avoid having dependencies for the minimal build. The only dependency we
currently have is libpcre, and we vendor that one. I doubt we'll want to
add a new vendored dependency, as they tend to be a major pain.I personally do not use the interactive shell (and I think most people who
do use an interactive shell prefer psysh), so I don't think this can be
reasonably considered a "required" feature.Regards,
Nikita
Le 12/05/2021 à 11:29, Joe Watkins a écrit :
Morning Nikita,
+1 on the change to cli.
It can't really be a default extension right now because readline license
is not compatible:https://github.com/php/php-src/pull/3823
Even without the license problem, I'm not convinced of the value of adding
the dependency: Because of this long standing strange behaviour, I don't
really think the interactive shell is well used.
Hello,
I might be an exception, I don't know, but I do use it a lot (almost
every day). I don't want to install psysh or anything like it, php -a is
enough for what I do with it.
Regards,
Pierre
Le 12/05/2021 à 11:29, Joe Watkins a écrit :
Morning Nikita,
+1 on the change to cli.
It can't really be a default extension right now because readline license
is not compatible:https://github.com/php/php-src/pull/3823
Even without the license problem, I'm not convinced of the value of adding
the dependency: Because of this long standing strange behaviour, I don't
really think the interactive shell is well used.Hello,
I might be an exception, I don't know, but I do use it a lot (almost every day). I don't want to install psysh or anything like it, php -a is enough for what I do with it.
Regards,
Pierre
--
To unsubscribe, visit: https://www.php.net/unsub.php
Hello,
I’m using php -a daily on CLI to quickly try out hypothesis or evaluate expressions. No interest in using other tools.
Cheers,
Michelangelo
On Wed, May 12, 2021 at 11:44 AM Michelangelo van Dam dragonbe@gmail.com
wrote:
Le 12/05/2021 à 11:29, Joe Watkins a écrit :
Morning Nikita,
+1 on the change to cli.
It can't really be a default extension right now because readline
license
is not compatible:https://github.com/php/php-src/pull/3823
Even without the license problem, I'm not convinced of the value of
adding
the dependency: Because of this long standing strange behaviour, I don't
really think the interactive shell is well used.Hello,
I might be an exception, I don't know, but I do use it a lot (almost
every day). I don't want to install psysh or anything like it, php -a is
enough for what I do with it.Regards,
Pierre
--
To unsubscribe, visit: https://www.php.net/unsub.php
Hello,
I’m using php -a daily on CLI to quickly try out hypothesis or evaluate
expressions. No interest in using other tools.
Everyone, let's please keep discussion relating to the interactive shell
with readline out of this thread. Unless you are using the interactive
mode without readline, your usage will not be affected by the proposed
change.
If you want to discuss improvements to php -a with readline, then please
do so in a different thread.
Regards,
Nikita
Morning,
Still I think heavy use has to be the exception, especially heavy use where
readline is not available (because it's questionably useful).
Cheers
Joe
Le 12/05/2021 à 11:29, Joe Watkins a écrit :
Morning Nikita,
+1 on the change to cli.
It can't really be a default extension right now because readline license
is not compatible:https://github.com/php/php-src/pull/3823
Even without the license problem, I'm not convinced of the value of
adding
the dependency: Because of this long standing strange behaviour, I don't
really think the interactive shell is well used.Hello,
I might be an exception, I don't know, but I do use it a lot (almost
every day). I don't want to install psysh or anything like it, php -a is
enough for what I do with it.Regards,
Pierre
--
To unsubscribe, visit: https://www.php.net/unsub.php
I think we would be better off disabling -a completely if readline is not
available, and exit with a helpful error message. I've opened
https://github.com/php/php-src/pull/6976 to that effect. Does that sound
reasonable?
I'm in favor of dropping the interactive mode. Thank you for the PR!
I wonder, though, if there is even a difference between php -a
(without readline) and php
(besides the "interactive mode" message).
--
Christoph M. Becker
On Wed, May 12, 2021 at 3:42 PM Christoph M. Becker cmbecker69@gmx.de
wrote:
I think we would be better off disabling -a completely if readline is not
available, and exit with a helpful error message. I've opened
https://github.com/php/php-src/pull/6976 to that effect. Does that sound
reasonable?I'm in favor of dropping the interactive mode. Thank you for the PR!
I wonder, though, if there is even a difference between
php -a
(without readline) andphp
(besides the "interactive mode" message).
I don't think there's any difference.
Nikita
Am 12.05.2021 um 10:12 schrieb Nikita Popov nikita.ppv@gmail.com:
Hi internals,
If the readline extension is enabled, PHP provides an interactive shell
under -a. If it is not enabled, it falls back to an "interactive mode"
(yes, the difference between "interactive shell" and "interactive mode" is
important here). The interactive mode is simply an stdin input, which needs
to be terminated using Ctrl+D. You can only run one script that way.I think the current behavior is quite confusing, because it's really not
obvious that you ended up in this fallback mode (you need to know the
difference between "shell" and "mode" in the output) and most people
wouldn't know what to do with it. The latest instance of this is
https://bugs.php.net/bug.php?id=81033.I think we would be better off disabling -a completely if readline is not
available, and exit with a helpful error message. I've opened
https://github.com/php/php-src/pull/6976 to that effect. Does that sound
reasonable?Regards,
Nikita
Hey Nikita,
yes, please merge that PR, I've been annoyed more than once that the php -a was not actually interactive despite a seemingly good message. (and as cmb noted, it's effectively identical to bare php without args.)
Bob
Hi internals,
If the readline extension is enabled, PHP provides an interactive shell
under -a. If it is not enabled, it falls back to an "interactive mode"
(yes, the difference between "interactive shell" and "interactive mode" is
important here). The interactive mode is simply an stdin input, which needs
to be terminated using Ctrl+D. You can only run one script that way.I think the current behavior is quite confusing, because it's really not
obvious that you ended up in this fallback mode (you need to know the
difference between "shell" and "mode" in the output) and most people
wouldn't know what to do with it. The latest instance of this is
https://bugs.php.net/bug.php?id=81033.I think we would be better off disabling -a completely if readline is not
available, and exit with a helpful error message. I've opened
https://github.com/php/php-src/pull/6976 to that effect. Does that sound
reasonable?Regards,
Nikita
This would have been helpful several years ago when I started compiling PHP myself and was confused why php -a
broke. An error message would have saved me some time. So yes, please, merge it.
Aaron Piotrowski
I think we would be better off disabling -a completely if readline is not
available, and exit with a helpful error message. I've opened
https://github.com/php/php-src/pull/6976 to that effect. Does that sound
reasonable?Regards,
Nikita
+1 for this, the shell is very useful but "interactive mode", the evidence
is clear has a tendency to confuse people.
To invert the question, would anyone have a good justification to NOT
remove interactive mode?
I think we would be better off disabling -a completely if readline is not
available, and exit with a helpful error message. I've opened
https://github.com/php/php-src/pull/6976 to that effect. Does that sound
reasonable?Regards,
Nikita+1 for this, the shell is very useful but "interactive mode", the evidence
is clear has a tendency to confuse people.
To invert the question, would anyone have a good justification to NOT
remove interactive mode?
I've never once ran php -a
and wanted the behavior that comes if you
don't have readline or libedit available. As has been mentioned, if
you want that behavior run php
without -a. There's no loss of
functionality here, methinks. As long as php -a
gives a sensible
message if it wasn't built with readline or libedit that says such:
The interactive shell requires libedit or readline support, which
this build does not have.
Run php without -a to get an interactive mode instead.
Or something.
The interactive shell requires libedit or readline support, which
this build does not have.
Run php without -a to get an interactive mode instead.
Unless I'm missing something, the default CLI mode (php without -a) is
"interactive PHP" only if you consider "cat > foo.txt" to be an
"interactive editor". You can type a complete script (remembering to
start with "<?php"), hit Ctrl-D (if you happen to know that that means
"end of file") and it will execute it, then exit.
I too have been stung by accidentally triggering this mode without
readline enabled, and would be happy to see Nikita's patch merged.
Regards,
--
Rowan Tommins
[IMSoP]
Hey all,
please remember that you can also use php -r to quickly evaluate
expressions, e.g. generating a random password:
php -r 'var_dump(bin2hex(random_bytes(16)));'
I'm in favor of removal without readline.
Best,
Niklas
Rowan Tommins rowan.collins@gmail.com schrieb am Mi., 12. Mai 2021, 22:46:
The interactive shell requires libedit or readline support, which
this build does not have.
Run php without -a to get an interactive mode instead.Unless I'm missing something, the default CLI mode (php without -a) is
"interactive PHP" only if you consider "cat > foo.txt" to be an
"interactive editor". You can type a complete script (remembering to
start with "<?php"), hit Ctrl-D (if you happen to know that that means
"end of file") and it will execute it, then exit.I too have been stung by accidentally triggering this mode without
readline enabled, and would be happy to see Nikita's patch merged.Regards,
--
Rowan Tommins
[IMSoP]--
To unsubscribe, visit: https://www.php.net/unsub.php