Merge branch 'PHP-8.2' into PHP-8.3

* PHP-8.2:
  Fix GH-13199: Redundant prompt in phpdbg with libedit/readline
This commit is contained in:
Peter Kokot 2024-08-02 08:37:35 +02:00
commit 97049b44bd
No known key found for this signature in database
GPG key ID: A94800907AA79B36
2 changed files with 29 additions and 9 deletions

4
NEWS
View file

@ -35,6 +35,10 @@ PHP NEWS
- PDO_Firebird: - PDO_Firebird:
. Fix bogus fallthrough path in firebird_handle_get_attribute(). (nielsdos) . Fix bogus fallthrough path in firebird_handle_get_attribute(). (nielsdos)
- PHPDBG:
. Fixed bug GH-13199 (EOF emits redundant prompt in phpdbg local console mode
with libedit/readline). (Peter Kokot)
- Soap: - Soap:
. Fixed bug #55639 (Digest autentication dont work). (nielsdos) . Fixed bug #55639 (Digest autentication dont work). (nielsdos)

View file

@ -23,6 +23,10 @@
#include "phpdbg_prompt.h" #include "phpdbg_prompt.h"
#include "phpdbg_io.h" #include "phpdbg_io.h"
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
ZEND_EXTERN_MODULE_GLOBALS(phpdbg) ZEND_EXTERN_MODULE_GLOBALS(phpdbg)
static inline const char *phpdbg_command_name(const phpdbg_command_t *command, char *buffer) { static inline const char *phpdbg_command_name(const phpdbg_command_t *command, char *buffer) {
@ -746,6 +750,17 @@ PHPDBG_API char *phpdbg_read_input(const char *buffered) /* {{{ */
if ((PHPDBG_G(flags) & (PHPDBG_IS_STOPPING | PHPDBG_IS_RUNNING)) != PHPDBG_IS_STOPPING) { if ((PHPDBG_G(flags) & (PHPDBG_IS_STOPPING | PHPDBG_IS_RUNNING)) != PHPDBG_IS_STOPPING) {
if (buffered == NULL) { if (buffered == NULL) {
#ifdef HAVE_PHPDBG_READLINE #ifdef HAVE_PHPDBG_READLINE
# ifdef HAVE_UNISTD_H
/* EOF makes readline write prompt again in local console mode and
ignored if compiled without readline integration. */
if (!isatty(PHPDBG_G(io)[PHPDBG_STDIN].fd)) {
char buf[PHPDBG_MAX_CMD];
phpdbg_write("%s", phpdbg_get_prompt());
phpdbg_consume_stdin_line(buf);
buffer = estrdup(buf);
} else
# endif
{
char *cmd = readline(phpdbg_get_prompt()); char *cmd = readline(phpdbg_get_prompt());
PHPDBG_G(last_was_newline) = 1; PHPDBG_G(last_was_newline) = 1;
@ -757,6 +772,7 @@ PHPDBG_API char *phpdbg_read_input(const char *buffered) /* {{{ */
add_history(cmd); add_history(cmd);
buffer = estrdup(cmd); buffer = estrdup(cmd);
free(cmd); free(cmd);
}
#else #else
phpdbg_write("%s", phpdbg_get_prompt()); phpdbg_write("%s", phpdbg_get_prompt());
phpdbg_consume_stdin_line(buf); phpdbg_consume_stdin_line(buf);