]> granicus.if.org Git - php/commitdiff
Do not use readline when not having a tty
authorBob Weinand <bobwei9@hotmail.com>
Mon, 20 Jul 2015 19:57:00 +0000 (21:57 +0200)
committerBob Weinand <bobwei9@hotmail.com>
Mon, 20 Jul 2015 19:57:00 +0000 (21:57 +0200)
This is important for e.g. run-tests.php

sapi/phpdbg/phpdbg.c
sapi/phpdbg/phpdbg_cmd.c

index 3fdc7cbe301f173b5316103769960bb716aac686..d594601f2901fdbbb7c749c73fb119b4bfa33abd 100644 (file)
@@ -564,7 +564,7 @@ static PHP_FUNCTION(phpdbg_end_oplog)
                                        last_function = op_array->function_name;
                                        last_scope = op_array->scope;
                                        if (last_scope == NULL) {
-                                               fn_name = zend_string_copy(last_function ? last_function : last_file);
+                                               fn_name = zend_string_copy(last_function);
                                        } else {
                                                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));
                                        }
index 97be41d5616fee418e73e30cc7749d3f3b543142..e28e3a9693edb19a2c3f9a83739a3c0693e2154c 100644 (file)
@@ -716,7 +716,7 @@ PHPDBG_API char *phpdbg_read_input(char *buffered) /* {{{ */
 #define USE_LIB_STAR (defined(HAVE_LIBREADLINE) || defined(HAVE_LIBEDIT))
                        /* note: EOF makes readline write prompt again in local console mode - and ignored if compiled without readline */
 #if USE_LIB_STAR
-                       if (PHPDBG_G(flags) & PHPDBG_IS_REMOTE)
+                       if ((PHPDBG_G(flags) & PHPDBG_IS_REMOTE) || !isatty(PHPDBG_G(io)[PHPDBG_STDOUT].fd))
 #endif
                        {
                                phpdbg_write("prompt", "", "%s", phpdbg_get_prompt());