diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c index 3aa0b7b60d7e..d9cc8f5e891e 100644 --- a/sapi/phpdbg/phpdbg.c +++ b/sapi/phpdbg/phpdbg.c @@ -845,7 +845,7 @@ static void php_sapi_phpdbg_register_vars(zval *track_vars_array) /* {{{ */ static inline size_t php_sapi_phpdbg_ub_write(const char *message, size_t length) /* {{{ */ { - return phpdbg_script(P_STDOUT, "%.*s", (int) length, message); + return phpdbg_process_print(PHPDBG_G(io)[PHPDBG_STDOUT].fd, P_STDOUT, message, (int) length); } /* }}} */ /* beginning of struct, see main/streams/plain_wrapper.c line 111 */ diff --git a/sapi/phpdbg/phpdbg_out.c b/sapi/phpdbg/phpdbg_out.c index af2f3b98d2ba..63b61fb8eab0 100644 --- a/sapi/phpdbg/phpdbg_out.c +++ b/sapi/phpdbg/phpdbg_out.c @@ -40,7 +40,7 @@ PHPDBG_API int _phpdbg_asprintf(char **buf, const char *format, ...) { return ret; } -static int phpdbg_process_print(int fd, int type, const char *msg, int msglen) { +int phpdbg_process_print(int fd, int type, const char *msg, int msglen) { char *msgout = NULL; int msgoutlen = FAILURE; diff --git a/sapi/phpdbg/phpdbg_out.h b/sapi/phpdbg/phpdbg_out.h index 828e147a1b7e..1a54bb7ec284 100644 --- a/sapi/phpdbg/phpdbg_out.h +++ b/sapi/phpdbg/phpdbg_out.h @@ -59,6 +59,8 @@ PHPDBG_API void phpdbg_free_err_buf(void); PHPDBG_API void phpdbg_activate_err_buf(bool active); PHPDBG_API int phpdbg_output_err_buf(const char *strfmt, ...); +int phpdbg_process_print(int fd, int type, const char *msg, int msglen); + /* {{{ For separation */ #define SEPARATE "------------------------------------------------" /* }}} */ diff --git a/sapi/phpdbg/tests/gh10715.phpt b/sapi/phpdbg/tests/gh10715.phpt index 13edd9afdd8f..63d98cae1073 100644 Binary files a/sapi/phpdbg/tests/gh10715.phpt and b/sapi/phpdbg/tests/gh10715.phpt differ diff --git a/sapi/phpdbg/tests/gh14553.phpt b/sapi/phpdbg/tests/gh14553.phpt new file mode 100644 index 000000000000..bcf61c0a9fb4 --- /dev/null +++ b/sapi/phpdbg/tests/gh14553.phpt @@ -0,0 +1,14 @@ +--TEST-- +GH-14553 (Bug in phpdbg8.3 (also 8.1 and 8.2) echo output - trimmed at NULL byte (?)) +--PHPDBG-- +r +q +--FILE-- + +--EXPECTF-- +[Successful compilation of %s] +prompt> hello%0world +[Script ended normally] +prompt>