[xdebug-dev] svn: /xdebug/trunk/ xdebug.c

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Fri, 01 Jan 2010 16:53:31 +0000

derick Fri, 01 Jan 2010 16:53:31 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=3185

Log:
- Hopefully fixed a threading issue where the headers gathering function would
  create stack overflows.

Changed paths:
    U xdebug/trunk/xdebug.c

Modified: xdebug/trunk/xdebug.c
===================================================================
--- xdebug/trunk/xdebug.c 2009-12-31 15:21:08 UTC (rev 3184)
+++ xdebug/trunk/xdebug.c 2010-01-01 16:53:31 UTC (rev 3185)
@@ -816,10 +816,14 @@
         REGISTER_LONG_CONSTANT("XDEBUG_CC_DEAD_CODE", XDEBUG_CC_OPTION_DEAD_CODE, CONST_CS | CONST_PERSISTENT);

         XG(breakpoint_count) = 0;
+
+ /* Override header generation in SAPI */
+ XG(orig_header_handler) = sapi_module.header_handler;
+ sapi_module.header_handler = xdebug_header_handler;
+ XG(headers) = NULL;
         return SUCCESS;
 }

-
 PHP_MSHUTDOWN_FUNCTION(xdebug)
 {
         if (XG(profiler_aggregate)) {
@@ -1028,9 +1032,6 @@
         XG(orig_set_time_limit_func) = orig->internal_function.handler;
         orig->internal_function.handler = zif_xdebug_set_time_limit;

- /* Override header generation in SAPI */
- XG(orig_header_handler) = sapi_module.header_handler;
- sapi_module.header_handler = xdebug_header_handler;
         XG(headers) = xdebug_llist_alloc(xdebug_llist_string_dtor);
         if (strcmp(sapi_module.name, "cli") == 0) {
                 SG(request_info).no_headers = 1;
@@ -1103,8 +1104,6 @@
         /* Clean up collected headers */
         xdebug_llist_destroy(XG(headers), NULL);

- sapi_module.header_handler = XG(orig_header_handler);
-
         return SUCCESS;
 }

@@ -2790,9 +2789,11 @@

 static int xdebug_header_handler(sapi_header_struct *h XG_SAPI_HEADER_OP_DC, sapi_headers_struct *s TSRMLS_DC)
 {
- xdebug_llist_insert_next(XG(headers), XDEBUG_LLIST_TAIL(XG(headers)), xdstrdup(h->header));
- if (XG(orig_header_handler)) {
- return XG(orig_header_handler)(h XG_SAPI_HEADER_OP_CC, s TSRMLS_CC);
+ if (XG(headers)) {
+ xdebug_llist_insert_next(XG(headers), XDEBUG_LLIST_TAIL(XG(headers)), xdstrdup(h->header));
+ if (XG(orig_header_handler)) {
+ return XG(orig_header_handler)(h XG_SAPI_HEADER_OP_CC, s TSRMLS_CC);
+ }
         }
         return SAPI_HEADER_ADD;
 }
Received on Fri Jan 01 2010 - 16:53:31 GMT

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