Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sapi/cli: Don't set ini-settings mid-expression in interactive shell #17389

Open
wants to merge 3 commits into
base: PHP-8.3
Choose a base branch
from

Conversation

ReimarPB
Copy link

@ReimarPB ReimarPB commented Jan 6, 2025

This fixes an issue in the interactive shell (php -a) where the prompt character shown after setting an ini-setting while in the middle of an expression (having pressed enter after an unfinished quote/bracket) would always incorrectly be >.

Here is a demonstration of the current behavior:

Interactive shell

php > $str = "
php " #key=value
php > 

Notice how the last prompt is php > although it should be php " since we are still in the middle of a string.

This PR changes such that the setting is just ignored as long as your expression is unfinished:

Interactive shell

php > $str = "
php " #key=value
php " ";
php > echo $str;

#key=value
php > 

Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR!

ext/readline/readline_cli.c Show resolved Hide resolved
ext/readline/readline_cli.c Outdated Show resolved Hide resolved
Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Sorry for the delay, GH does not notify when discussions have been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants