Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Blind stab at implementing issue #794.

  • Loading branch information...
commit 7d743c582a53b6f299a96279c3dc99c8535f8d98 1 parent 03940ba
@derickr authored
Showing with 12 additions and 10 deletions.
  1. +8 −8 xdebug.c
  2. +4 −2 xdebug_stack.c
View
16 xdebug.c
@@ -299,9 +299,7 @@ PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("xdebug.var_display_max_children", "128", PHP_INI_ALL, OnUpdateLong, display_max_children, zend_xdebug_globals, xdebug_globals)
STD_PHP_INI_ENTRY("xdebug.var_display_max_data", "512", PHP_INI_ALL, OnUpdateLong, display_max_data, zend_xdebug_globals, xdebug_globals)
STD_PHP_INI_ENTRY("xdebug.var_display_max_depth", "3", PHP_INI_ALL, OnUpdateLong, display_max_depth, zend_xdebug_globals, xdebug_globals)
-#ifndef PHP_WIN32
STD_PHP_INI_ENTRY("xdebug.cli_color", "0", PHP_INI_ALL, OnUpdateBool, cli_color, zend_xdebug_globals, xdebug_globals)
-#endif
/* Scream support */
STD_PHP_INI_BOOLEAN("xdebug.scream", "0", PHP_INI_ALL, OnUpdateBool, do_scream, zend_xdebug_globals, xdebug_globals)
@@ -443,11 +441,9 @@ void xdebug_env_config()
if (strcasecmp(envvar, "remote_cookie_expire_time") == 0) {
name = "xdebug.remote_cookie_expire_time";
}
-#ifndef PHP_WIN32
else if (strcasecmp(envvar, "cli_color") == 0) {
name = "xdebug.cli_color";
}
-#endif
if (name) {
zend_alter_ini_entry(name, strlen(name) + 1, envval, strlen(envval), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
@@ -1587,13 +1583,15 @@ PHP_FUNCTION(xdebug_var_dump)
PHPWRITE(val, len);
xdfree(val);
}
-#ifndef PHP_WIN32
+#ifdef PHP_WIN32
+ else if ((XG(cli_color) == 1 && getenv("ANSICON")) || (XG(cli_color) == 2)) {
+#else
else if ((XG(cli_color) == 1 && xdebug_is_output_tty(TSRMLS_C)) || (XG(cli_color) == 2)) {
+#endif
val = xdebug_get_zval_value_ansi((zval*) *args[i], 0, NULL);
PHPWRITE(val, strlen(val));
xdfree(val);
}
-#endif
else {
val = xdebug_get_zval_value_text((zval*) *args[i], 0, NULL);
PHPWRITE(val, strlen(val));
@@ -1639,12 +1637,14 @@ PHP_FUNCTION(xdebug_debug_zval)
val = xdebug_get_zval_value_fancy(NULL, debugzval, &len, 1, NULL TSRMLS_CC);
PHPWRITE(val, len);
}
-#ifndef PHP_WIN32
+#ifdef PHP_WIN32
+ else if ((XG(cli_color) == 1 && getenv("ANSICON")) || (XG(cli_color) == 2)) {
+#else
else if ((XG(cli_color) == 1 && xdebug_is_output_tty(TSRMLS_C)) || (XG(cli_color) == 2)) {
+#endif
val = xdebug_get_zval_value_ansi(debugzval, 1, NULL);
PHPWRITE(val, strlen(val));
}
-#endif
else {
val = xdebug_get_zval_value(debugzval, 1, NULL);
PHPWRITE(val, strlen(val));
View
6 xdebug_stack.c
@@ -97,11 +97,13 @@ static char** select_formats(int html TSRMLS_DC) {
if (html) {
return html_formats;
}
-#ifndef PHP_WIN32
+#ifdef PHP_WIN32
+ else if ((XG(cli_color) == 1 && getenv("ANSICON")) || (XG(cli_color) == 2)) {
+#else
else if ((XG(cli_color) == 1 && xdebug_is_output_tty(TSRMLS_C)) || (XG(cli_color) == 2)) {
+#endif
return ansi_formats;
}
-#endif
else {
return text_formats;
}
Please sign in to comment.
Something went wrong with that request. Please try again.