Skip to content

Commit f0b5096

Browse files
committed
Do not use readline when not having a tty
This is important for e.g. run-tests.php
1 parent 6aadeba commit f0b5096

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

sapi/phpdbg/phpdbg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ static PHP_FUNCTION(phpdbg_end_oplog)
564564
last_function = op_array->function_name;
565565
last_scope = op_array->scope;
566566
if (last_scope == NULL) {
567-
fn_name = zend_string_copy(last_function ? last_function : last_file);
567+
fn_name = zend_string_copy(last_function);
568568
} else {
569569
fn_name = strpprintf(ZSTR_LEN(last_function) + ZSTR_LEN(last_scope->name) + 2, "%.*s::%.*s", ZSTR_LEN(last_scope->name), ZSTR_VAL(last_scope->name), ZSTR_LEN(last_function), ZSTR_VAL(last_function));
570570
}

sapi/phpdbg/phpdbg_cmd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ PHPDBG_API char *phpdbg_read_input(char *buffered) /* {{{ */
716716
#define USE_LIB_STAR (defined(HAVE_LIBREADLINE) || defined(HAVE_LIBEDIT))
717717
/* note: EOF makes readline write prompt again in local console mode - and ignored if compiled without readline */
718718
#if USE_LIB_STAR
719-
if (PHPDBG_G(flags) & PHPDBG_IS_REMOTE)
719+
if ((PHPDBG_G(flags) & PHPDBG_IS_REMOTE) || !isatty(PHPDBG_G(io)[PHPDBG_STDOUT].fd))
720720
#endif
721721
{
722722
phpdbg_write("prompt", "", "%s", phpdbg_get_prompt());

0 commit comments

Comments
 (0)