summaryrefslogtreecommitdiff
path: root/sapi/phpdbg/phpdbg_out.c
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/phpdbg/phpdbg_out.c')
-rw-r--r--sapi/phpdbg/phpdbg_out.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sapi/phpdbg/phpdbg_out.c b/sapi/phpdbg/phpdbg_out.c
index a4793f144f..4d70381533 100644
--- a/sapi/phpdbg/phpdbg_out.c
+++ b/sapi/phpdbg/phpdbg_out.c
@@ -136,7 +136,8 @@ static int format_converter(register buffy *odp, const char *fmt, zend_bool esca
int i;
char *s = NULL, *free_s = NULL;
- int s_len, free_zcopy;
+ size_t s_len;
+ zend_bool free_zcopy;
zval *zvp, zcopy;
int min_width = 0;
@@ -331,8 +332,8 @@ static int format_converter(register buffy *odp, const char *fmt, zend_bool esca
*/
switch (*fmt) {
case 'Z':
- zvp = (zval*) va_arg(ap, zval*);
- zend_make_printable_zval(zvp, &zcopy, &free_zcopy);
+ zvp = (zval *) va_arg(ap, zval *);
+ free_zcopy = zend_make_printable_zval(zvp, &zcopy TSRMLS_CC);
if (free_zcopy) {
zvp = &zcopy;
}
@@ -1021,6 +1022,8 @@ static int phpdbg_process_print(int fd, int type, const char *tag, const char *m
if (msg) {
PHPDBG_G(last_was_newline) = msg[msglen - 1] == '\n';
if (PHPDBG_G(flags) & PHPDBG_WRITE_XML) {
+ zend_string *encoded;
+
if (PHPDBG_G(in_script_xml) != type) {
char *stream_buf;
int stream_buflen = phpdbg_asprintf(&stream_buf, "<stream type=\"%s\">", type == P_STDERR ? "stderr" : "stdout");
@@ -1028,11 +1031,9 @@ static int phpdbg_process_print(int fd, int type, const char *tag, const char *m
efree(stream_buf);
PHPDBG_G(in_script_xml) = type;
}
-#if PHP_VERSION_ID >= 50600
- buf = php_escape_html_entities((unsigned char *) msg, msglen, (size_t *) &buflen, 0, ENT_NOQUOTES, PG(internal_encoding) && PG(internal_encoding)[0] ? PG(internal_encoding) : (SG(default_charset) ? SG(default_charset) : "UTF-8") TSRMLS_CC);
-#else
- buf = php_escape_html_entities((unsigned char *) msg, msglen, (size_t *) &buflen, 0, ENT_NOQUOTES, SG(default_charset) ? SG(default_charset) : "UTF-8" TSRMLS_CC);
-#endif
+ encoded = php_escape_html_entities((unsigned char *) msg, msglen, 0, ENT_NOQUOTES, PG(internal_encoding) && PG(internal_encoding)[0] ? PG(internal_encoding) : (SG(default_charset) ? SG(default_charset) : "UTF-8") TSRMLS_CC);
+ buflen = encoded->len;
+ memcpy(buf = emalloc(buflen + 1), encoded->val, buflen);
phpdbg_encode_ctrl_chars(&buf, &buflen);
phpdbg_mixed_write(fd, buf, buflen TSRMLS_CC);
efree(buf);