[xdebug-dev] xdebug xdebug/php_xdebug.h xdebug/xdebug.c xdebug/xdebug_handler_dbgp.c xdebug/xdebug_xml.c - Fix returning text nodes that contain html tags and such

From: Shane Caraveo <shane[@]caraveo.com>
Date: Sun, 6 Jun 2004 04:03:54 +0200

Date: Sun Jun 6 04:03:54 CEST 2004
User: Shane Caraveo
Directory: xdebug

Log Message:
[1.00]
- Fix returning text nodes that contain html tags and such
- Fix dbgp proxy support by adding the idekey attribute
  Can also use the XDEBUG_SESSION_START var to set the idekey
  New configuration var, xdebug.idekey

Modified files:
           xdebug/php_xdebug.h (version: 1.75)
           xdebug/xdebug.c (version: 1.217)
           xdebug/xdebug_handler_dbgp.c (version: 1.44)
           xdebug/xdebug_xml.c (version: 1.4)

[FILE: /xdebug/php_xdebug.h]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -r1.74 -r1.75
--- xdebug/php_xdebug.h:1.74 Sat May 01 19:25:28 2004 GMT
+++ xdebug/php_xdebug.h Sun Jun 06 00:03:54 2004 GMT
@@ -140,6 +140,8 @@
         int remote_mode; /* XDEBUG_NONE, XDEBUG_JIT, XDEBUG_REQ */
         char *remote_handler; /* php3, gdb, dbgp */
 
+ char *ide_key; /* from environment, USER, USERNAME or empty */
+
         /* remote debugging globals */
         zend_bool remote_enabled;
         zend_bool breakpoints_allowed;

[FILE: /xdebug/xdebug.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.216
retrieving revision 1.217
diff -u -r1.216 -r1.217
--- xdebug/xdebug.c:1.216 Sat May 01 19:25:28 2004 GMT
+++ xdebug/xdebug.c Sun Jun 06 00:03:54 2004 GMT
@@ -215,7 +215,27 @@
         }
         return SUCCESS;
 }
-
+
+static PHP_INI_MH(OnUpdateKey)
+{
+ XG(ide_key) = NULL;
+ if (!new_value || !*new_value) {
+ char *ide_key = getenv("DBGP_IDEKEY");
+ if (!ide_key || !*ide_key) {
+ ide_key = getenv("USER");
+ if (!ide_key || !*ide_key) {
+ ide_key = getenv("USERNAME");
+ }
+ }
+ if (ide_key && *ide_key) {
+ XG(ide_key) = xdstrdup(ide_key);
+ }
+ } else {
+ XG(ide_key) = xdstrdup(new_value);
+ }
+ return SUCCESS;
+}
+
 PHP_INI_BEGIN()
         /* Debugger settings */
         STD_PHP_INI_BOOLEAN("xdebug.auto_trace", "0", PHP_INI_ALL, OnUpdateBool, auto_trace, zend_xdebug_globals, xdebug_globals)
@@ -269,6 +289,7 @@
         STD_PHP_INI_ENTRY("xdebug.remote_port", "9000", PHP_INI_ALL, OnUpdateLong, remote_port, zend_xdebug_globals, xdebug_globals)
 #endif
         PHP_INI_ENTRY("xdebug.allowed_clients", "", PHP_INI_SYSTEM, OnUpdateAllowedClients)
+ STD_PHP_INI_ENTRY("xdebug.idekey", "", PHP_INI_ALL, OnUpdateKey, ide_key, zend_xdebug_globals, xdebug_globals)
 PHP_INI_END()
 
 static void php_xdebug_init_globals (zend_xdebug_globals *xg TSRMLS_DC)
@@ -350,6 +371,9 @@
                 } else
                 if (strcasecmp(envvar, "remote_mode") == 0) {
                         name = "xdebug.remote_mode";
+ } else
+ if (strcasecmp(envvar, "idekey") == 0) {
+ name = "xdebug.idekey";
                 }
 
                 if (name) {
@@ -530,6 +554,10 @@
                 efree(XG(error_handler));
         }
 
+ if (XG(ide_key)) {
+ xdfree(XG(ide_key));
+ }
+
         XG(level) = 0;
         XG(do_trace) = 0;
         XG(do_code_coverage) = 0;
@@ -857,6 +885,7 @@
                 ) {
                         convert_to_string_ex(dummy);
                         magic_cookie = xdstrdup(Z_STRVAL_PP(dummy));
+ XG(ide_key) = xdstrdup(Z_STRVAL_PP(dummy));
                         php_setcookie("XDEBUG_SESSION", sizeof("XDEBUG_SESSION"), Z_STRVAL_PP(dummy), Z_STRLEN_PP(dummy), time(NULL) + 3600, "/", 1, NULL, 0, 0 COOKIE_ENCODE TSRMLS_CC);
                 } else if (
                         PG(http_globals)[TRACK_VARS_COOKIE] &&
@@ -864,9 +893,12 @@
                 ) {
                         convert_to_string_ex(dummy);
                         magic_cookie = xdstrdup(Z_STRVAL_PP(dummy));
+ XG(ide_key) = xdstrdup(Z_STRVAL_PP(dummy));
                 } else if (getenv("XDEBUG_CONFIG")) {
                         magic_cookie = xdstrdup(getenv("XDEBUG_CONFIG"));
- php_setcookie("XDEBUG_SESSION", sizeof("XDEBUG_SESSION"), magic_cookie, strlen(magic_cookie), time(NULL) + 3600, "/", 1, NULL, 0, 0 COOKIE_ENCODE TSRMLS_CC);
+ if (XG(ide_key) && *XG(ide_key)) {
+ php_setcookie("XDEBUG_SESSION", sizeof("XDEBUG_SESSION"), XG(ide_key), strlen(XG(ide_key)), time(NULL) + 3600, "/", 1, NULL, 0, 0 COOKIE_ENCODE TSRMLS_CC);
+ }
                 }
                         
 

[FILE: /xdebug/xdebug_handler_dbgp.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- xdebug/xdebug_handler_dbgp.c:1.43 Sat May 01 09:49:36 2004 GMT
+++ xdebug/xdebug_handler_dbgp.c Sun Jun 06 00:03:54 2004 GMT
@@ -1528,7 +1528,7 @@
 
 char *xdebug_dbgp_get_revision(void)
 {
- return "$Revision: 1.43 $";
+ return "$Revision: 1.44 $";
 }
 
 int xdebug_dbgp_cmdloop(xdebug_con *context TSRMLS_DC)
@@ -1605,6 +1605,10 @@
                 xdebug_xml_add_attribute_ex(response, "session", xdstrdup(getenv("DBGP_COOKIE")), 0, 1);
         }
 
+ if (XG(ide_key) && *XG(ide_key)) {
+ xdebug_xml_add_attribute_ex(response, "idekey", xdstrdup(XG(ide_key)), 0, 1);
+ }
+
         context->buffer = xdmalloc(sizeof(fd_buf));
         context->buffer->buffer = NULL;
         context->buffer->buffer_size = 0;

[FILE: /xdebug/xdebug_xml.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- xdebug/xdebug_xml.c:1.3 Wed Oct 29 09:27:49 2003 GMT
+++ xdebug/xdebug_xml.c Sun Jun 06 00:03:54 2004 GMT
@@ -32,7 +32,16 @@
         }
 
         if (node->text) {
- xdebug_str_add(output, node->text, 0);
+ if (strstr(node->text, "]]>")) {
+ /* if cdata tags are in the text, then we must base64 encode */
+ int new_len = 0;
+ char *encoded_text = xdebug_base64_encode(node->text, strlen(node->text), &new_len);
+ xdebug_str_add(output, encoded_text, 0);
+ } else {
+ xdebug_str_addl(output, "<![CDATA[", 9, 0);
+ xdebug_str_add(output, node->text, 0);
+ xdebug_str_addl(output, "]]>", 3, 0);
+ }
         }
 
         xdebug_str_addl(output, "</", 2, 0);
@@ -95,6 +104,10 @@
                 xdfree(xml->text);
         }
         xml->text = text;
+ if (strstr(xml->text, "]]>")) {
+ /* if cdata tags are in the text, then we must base64 encode */
+ xdebug_xml_add_attribute_ex(xml, "encoding", "base64", 0, 0);
+ }
 }
 
 static void xdebug_xml_attribute_dtor(xdebug_xml_attribute *attr)
Received on Mon Jun 07 2004 - 09:17:30 BST

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:02 BST