[xdebug-dev] xdebug xdebug/php_xdebug.h xdebug/xdebug.c - Implemented FR #210: Add a way to stop the debug session without having to

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Wed, 18 Oct 2006 14:04:07 +0200

Date: Wed Oct 18 14:04:07 CEST 2006
User: Derick Rethans
Directory: xdebug

Log Message:
[0.25]
- Implemented FR #210: Add a way to stop the debug session without having to
  execute a script. The GET/POST parameter "XDEBUG_SESSION_STOP_NO_EXEC"
  works in the same way as XDEBUG_SESSION_STOP, except that the script will
  not be executed.

Modified files:
           xdebug/php_xdebug.h (version: 1.120)
           xdebug/xdebug.c (version: 1.357)

[FILE: /xdebug/php_xdebug.h]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -r1.119 -r1.120
--- xdebug/php_xdebug.h:1.119 Wed Oct 11 06:54:30 2006 GMT
+++ xdebug/php_xdebug.h Wed Oct 18 10:04:06 2006 GMT
@@ -189,6 +189,7 @@
         zend_bool breakpoints_allowed;
         xdebug_con context;
         unsigned int breakpoint_count;
+ unsigned int no_exec;
 
         /* profiler settings */
         zend_bool profiler_enable;

[FILE: /xdebug/xdebug.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.356
retrieving revision 1.357
diff -u -r1.356 -r1.357
--- xdebug/xdebug.c:1.356 Wed Oct 18 08:00:34 2006 GMT
+++ xdebug/xdebug.c Wed Oct 18 10:04:06 2006 GMT
@@ -684,15 +684,25 @@
         }
 }
 
+#if PHP_VERSION_ID >= 50200
+#define COOKIE_ENCODE , 1, 0
+#elif PHP_API_VERSION >= 20030820
+#define COOKIE_ENCODE , 1
+#else
+#define COOKIE_ENCODE
+#endif
+
 PHP_RINIT_FUNCTION(xdebug)
 {
         zend_function *orig;
         char *idekey;
+ zval **dummy;
         
         /* get xdebug ini entries from the environment also */
         xdebug_env_config();
         idekey = zend_ini_string("xdebug.idekey", sizeof("xdebug.idekey"), 0);
 
+ XG(no_exec) = 0;
         XG(level) = 0;
         XG(do_trace) = 0;
         XG(do_code_coverage) = 0;
@@ -715,6 +725,24 @@
                 XG(ide_key) = xdstrdup(idekey);
         }
 
+ /* Check if we have this special get variable that stops a debugging
+ * request without executing any code */
+ if (
+ (
+ (
+ PG(http_globals)[TRACK_VARS_GET] &&
+ zend_hash_find(PG(http_globals)[TRACK_VARS_GET]->value.ht, "XDEBUG_SESSION_STOP_NO_EXEC", sizeof("XDEBUG_SESSION_STOP_NO_EXEC"), (void **) &dummy) == SUCCESS
+ ) || (
+ PG(http_globals)[TRACK_VARS_POST] &&
+ zend_hash_find(PG(http_globals)[TRACK_VARS_POST]->value.ht, "XDEBUG_SESSION_STOP_NO_EXEC", sizeof("XDEBUG_SESSION_STOP_NO_EXEC"), (void **) &dummy) == SUCCESS
+ )
+ )
+ && !SG(headers_sent)
+ ) {
+ php_setcookie("XDEBUG_SESSION", sizeof("XDEBUG_SESSION"), "", 0, time(NULL) + 3600, "/", 1, NULL, 0, 0 COOKIE_ENCODE TSRMLS_CC);
+ XG(no_exec) = 1;
+ }
+
         /* Only enabled extended info when it is not disabled */
         CG(extended_info) = XG(extended_info);
 
@@ -1237,14 +1265,6 @@
         return 1;
 }
 
-#if PHP_VERSION_ID >= 50200
-#define COOKIE_ENCODE , 1, 0
-#elif PHP_API_VERSION >= 20030820
-#define COOKIE_ENCODE , 1
-#else
-#define COOKIE_ENCODE
-#endif
-
 void xdebug_execute(zend_op_array *op_array TSRMLS_DC)
 {
         zval **dummy;
@@ -1256,6 +1276,12 @@
         xdebug_llist_element *le;
         int eval_id = 0;
 
+
+ if (XG(no_exec) == 1) {
+ php_printf("DEBUG SESSION ENDED");
+ return;
+ }
+
         if (XG(level) == 0) {
                 /* Set session cookie if requested */
                 if (
Received on Wed Oct 18 2006 - 14:04:11 BST

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