mirror of
https://github.com/php/php-src.git
synced 2026-03-31 04:32:19 +02:00
fixed EOL transferred to the client side, fixed strftime fmt string
the windows telnet gets broken output when receiving no '\r'
This commit is contained in:
20
phpdbg_cmd.c
20
phpdbg_cmd.c
@@ -417,43 +417,43 @@ PHPDBG_API void phpdbg_param_debug(const phpdbg_param_t *param, const char *msg)
|
||||
if (param && param->type) {
|
||||
switch (param->type) {
|
||||
case STR_PARAM:
|
||||
fprintf(stderr, "%s STR_PARAM(%s=%lu)\n", msg, param->str, param->len);
|
||||
fprintf(stderr, "%s STR_PARAM(%s=%lu)" PHP_EOL, msg, param->str, param->len);
|
||||
break;
|
||||
|
||||
case ADDR_PARAM:
|
||||
fprintf(stderr, "%s ADDR_PARAM(%lu)\n", msg, param->addr);
|
||||
fprintf(stderr, "%s ADDR_PARAM(%lu)" PHP_EOL, msg, param->addr);
|
||||
break;
|
||||
|
||||
case NUMERIC_FILE_PARAM:
|
||||
fprintf(stderr, "%s NUMERIC_FILE_PARAM(%s:#%lu)\n", msg, param->file.name, param->file.line);
|
||||
fprintf(stderr, "%s NUMERIC_FILE_PARAM(%s:#%lu)" PHP_EOL, msg, param->file.name, param->file.line);
|
||||
break;
|
||||
|
||||
case FILE_PARAM:
|
||||
fprintf(stderr, "%s FILE_PARAM(%s:%lu)\n", msg, param->file.name, param->file.line);
|
||||
fprintf(stderr, "%s FILE_PARAM(%s:%lu)" PHP_EOL, msg, param->file.name, param->file.line);
|
||||
break;
|
||||
|
||||
case METHOD_PARAM:
|
||||
fprintf(stderr, "%s METHOD_PARAM(%s::%s)\n", msg, param->method.class, param->method.name);
|
||||
fprintf(stderr, "%s METHOD_PARAM(%s::%s)" PHP_EOL, msg, param->method.class, param->method.name);
|
||||
break;
|
||||
|
||||
case NUMERIC_METHOD_PARAM:
|
||||
fprintf(stderr, "%s NUMERIC_METHOD_PARAM(%s::%s)\n", msg, param->method.class, param->method.name);
|
||||
fprintf(stderr, "%s NUMERIC_METHOD_PARAM(%s::%s)" PHP_EOL, msg, param->method.class, param->method.name);
|
||||
break;
|
||||
|
||||
case NUMERIC_FUNCTION_PARAM:
|
||||
fprintf(stderr, "%s NUMERIC_FUNCTION_PARAM(%s::%ld)\n", msg, param->str, param->num);
|
||||
fprintf(stderr, "%s NUMERIC_FUNCTION_PARAM(%s::%ld)" PHP_EOL, msg, param->str, param->num);
|
||||
break;
|
||||
|
||||
case NUMERIC_PARAM:
|
||||
fprintf(stderr, "%s NUMERIC_PARAM(%ld)\n", msg, param->num);
|
||||
fprintf(stderr, "%s NUMERIC_PARAM(%ld)" PHP_EOL, msg, param->num);
|
||||
break;
|
||||
|
||||
case COND_PARAM:
|
||||
fprintf(stderr, "%s COND_PARAM(%s=%lu)\n", msg, param->str, param->len);
|
||||
fprintf(stderr, "%s COND_PARAM(%s=%lu)" PHP_EOL, msg, param->str, param->len);
|
||||
break;
|
||||
|
||||
case OP_PARAM:
|
||||
fprintf(stderr, "%s OP_PARAM(%s=%lu)\n", msg, param->str, param->len);
|
||||
fprintf(stderr, "%s OP_PARAM(%s=%lu)" PHP_EOL, msg, param->str, param->len);
|
||||
break;
|
||||
|
||||
default: {
|
||||
|
||||
@@ -319,7 +319,7 @@ PHPDBG_HELP(aliases) /* {{{ */
|
||||
* Also note the convention that help text not directly referenceable as a help param
|
||||
* has a key ending in !
|
||||
*/
|
||||
#define CR "\n"
|
||||
#define CR PHP_EOL
|
||||
phpdbg_help_text_t phpdbg_help_text[] = {
|
||||
|
||||
/******************************** General Help Topics ********************************/
|
||||
|
||||
@@ -1140,16 +1140,16 @@ static int phpdbg_process_print(int fd, int type, const char *tag, const char *m
|
||||
severity = "error";
|
||||
if (!PHPDBG_G(last_was_newline)) {
|
||||
if (PHPDBG_G(flags) & PHPDBG_WRITE_XML) {
|
||||
phpdbg_mixed_write(fd, ZEND_STRL("<phpdbg>\n</phpdbg>"));
|
||||
phpdbg_mixed_write(fd, ZEND_STRL("<phpdbg>" PHP_EOL "</phpdbg>"));
|
||||
} else {
|
||||
phpdbg_mixed_write(fd, ZEND_STRL("\n"));
|
||||
phpdbg_mixed_write(fd, ZEND_STRL(PHP_EOL));
|
||||
}
|
||||
PHPDBG_G(last_was_newline) = 1;
|
||||
}
|
||||
if (PHPDBG_G(flags) & PHPDBG_IS_COLOURED) {
|
||||
msgoutlen = spprintf(&msgout, 0, "\033[%sm[%.*s]\033[0m\n", PHPDBG_G(colors)[PHPDBG_COLOR_ERROR]->code, msglen, msg);
|
||||
msgoutlen = spprintf(&msgout, 0, "\033[%sm[%.*s]\033[0m" PHP_EOL, PHPDBG_G(colors)[PHPDBG_COLOR_ERROR]->code, msglen, msg);
|
||||
} else {
|
||||
msgoutlen = spprintf(&msgout, 0, "[%.*s]\n", msglen, msg);
|
||||
msgoutlen = spprintf(&msgout, 0, "[%.*s]" PHP_EOL, msglen, msg);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1157,26 +1157,26 @@ static int phpdbg_process_print(int fd, int type, const char *tag, const char *m
|
||||
severity = "notice";
|
||||
if (!PHPDBG_G(last_was_newline)) {
|
||||
if (PHPDBG_G(flags) & PHPDBG_WRITE_XML) {
|
||||
phpdbg_mixed_write(fd, ZEND_STRL("<phpdbg>\n</phpdbg>"));
|
||||
phpdbg_mixed_write(fd, ZEND_STRL("<phpdbg>" PHP_EOL "</phpdbg>"));
|
||||
} else {
|
||||
phpdbg_mixed_write(fd, ZEND_STRL("\n"));
|
||||
phpdbg_mixed_write(fd, ZEND_STRL(PHP_EOL));
|
||||
}
|
||||
PHPDBG_G(last_was_newline) = 1;
|
||||
}
|
||||
if (PHPDBG_G(flags) & PHPDBG_IS_COLOURED) {
|
||||
msgoutlen = spprintf(&msgout, 0, "\033[%sm[%.*s]\033[0m\n", PHPDBG_G(colors)[PHPDBG_COLOR_NOTICE]->code, msglen, msg);
|
||||
msgoutlen = spprintf(&msgout, 0, "\033[%sm[%.*s]\033[0m" PHP_EOL, PHPDBG_G(colors)[PHPDBG_COLOR_NOTICE]->code, msglen, msg);
|
||||
} else {
|
||||
msgoutlen = spprintf(&msgout, 0, "[%.*s]\n", msglen, msg);
|
||||
msgoutlen = spprintf(&msgout, 0, "[%.*s]" PHP_EOL, msglen, msg);
|
||||
}
|
||||
break;
|
||||
|
||||
case P_WRITELN:
|
||||
severity = "normal";
|
||||
if (msg) {
|
||||
msgoutlen = spprintf(&msgout, 0, "%.*s\n", msglen, msg);
|
||||
msgoutlen = spprintf(&msgout, 0, "%.*s" PHP_EOL, msglen, msg);
|
||||
} else {
|
||||
msgoutlen = 1;
|
||||
msgout = estrdup("\n");
|
||||
msgout = estrdup(PHP_EOL);
|
||||
}
|
||||
PHPDBG_G(last_was_newline) = 1;
|
||||
break;
|
||||
@@ -1222,7 +1222,7 @@ static int phpdbg_process_print(int fd, int type, const char *tag, const char *m
|
||||
if (msg) {
|
||||
struct timeval tp;
|
||||
if (gettimeofday(&tp, NULL) == SUCCESS) {
|
||||
msgoutlen = spprintf(&msgout, 0, "[%ld %.8F]: %.*s\n", tp.tv_sec, tp.tv_usec / 1000000., msglen, msg);
|
||||
msgoutlen = spprintf(&msgout, 0, "[%ld %.8F]: %.*s" PHP_EOL, tp.tv_sec, tp.tv_usec / 1000000., msglen, msg);
|
||||
} else {
|
||||
msgoutlen = FAILURE;
|
||||
}
|
||||
@@ -1453,9 +1453,13 @@ PHPDBG_API int phpdbg_rlog(int fd, const char *fmt, ...) { /* {{{ */
|
||||
char *format = NULL, *buffer = NULL, *outbuf = NULL;
|
||||
const time_t tt = tp.tv_sec;
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
strftime(friendly, 100, "%a %b %d %H.%%04d %Y", localtime(&tt));
|
||||
#else
|
||||
strftime(friendly, 100, "%a %b %d %T.%%04d %Y", localtime(&tt));
|
||||
#endif
|
||||
spprintf(&buffer, 0, friendly, tp.tv_usec/1000);
|
||||
spprintf(&format, 0, "[%s]: %s\n", buffer, fmt);
|
||||
spprintf(&format, 0, "[%s]: %s" PHP_EOL, buffer, fmt);
|
||||
rc = vspprintf(&outbuf, 0, format, args);
|
||||
|
||||
if (outbuf) {
|
||||
|
||||
Reference in New Issue
Block a user