[xdebug-dev] svn: /xdebug/trunk/ tests/bug00566-1.phpt xdebug.c xdebug_compat.c

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Tue, 26 Oct 2010 16:34:41 +0000

derick Tue, 26 Oct 2010 16:34:41 +0000

Revision: http://svn.xdebug.org/cgi-bin/viewvc.cgi?view=rev&revision=3355&root=xdebug

Log:
- Fixed issues with PHP trunk related to optimisation of return values for
  both internal and user-land functions.

Changed paths:
    U xdebug/trunk/tests/bug00566-1.phpt
    U xdebug/trunk/xdebug.c
    U xdebug/trunk/xdebug_compat.c

Modified: xdebug/trunk/tests/bug00566-1.phpt
===================================================================
--- xdebug/trunk/tests/bug00566-1.phpt 2010-10-26 16:33:58 UTC (rev 3354)
+++ xdebug/trunk/tests/bug00566-1.phpt 2010-10-26 16:34:41 UTC (rev 3355)
@@ -36,16 +36,19 @@
>=> 4
 %w%f %w%d -> strlen('views') %sbug00566-1.php:14
>=> 5
+ >=> NULL
 %w%f %w%d -> loadMod($module = 'test') %sbug00566-1.php:18
 %w%f %w%d -> strlen('test') %sbug00566-1.php:5
>=> 4
 %w%f %w%d -> strlen('tests') %sbug00566-1.php:7
>=> 5
+ >=> NULL
 %w%f %w%d -> loadMod($module = 'view') %sbug00566-1.php:19
 %w%f %w%d -> strlen('view') %sbug00566-1.php:5
>=> 4
 %w%f %w%d -> strlen('views') %sbug00566-1.php:7
>=> 5
+ >=> NULL
 %w%f %w%d -> xdebug_stop_trace() %sbug00566-1.php:21
 %w%f %w%d
 TRACE END [%d-%d-%d %d:%d:%d]

Modified: xdebug/trunk/xdebug.c
===================================================================
--- xdebug/trunk/xdebug.c 2010-10-26 16:33:58 UTC (rev 3354)
+++ xdebug/trunk/xdebug.c 2010-10-26 16:34:41 UTC (rev 3355)
@@ -1098,7 +1098,8 @@
         int do_return = (XG(do_trace) && XG(trace_file));
         int function_nr = 0;
         xdebug_llist_element *le;
- int eval_id = 0;
+ int eval_id = 0, clear = 0;
+ zval *return_val = NULL;

         /* if we're in a ZEND_EXT_STMT, we ignore this function call as it's likely
            that it's just being called to check for breakpoints with conditions */
@@ -1294,6 +1295,11 @@
         if (XG(profiler_enabled)) {
                 xdebug_profiler_function_user_begin(fse TSRMLS_CC);
         }
+
+ if (!EG(return_value_ptr_ptr)) {
+ EG(return_value_ptr_ptr) = &return_val;
+ clear = 1;
+ }
         xdebug_old_execute(op_array TSRMLS_CC);

         if (XG(profiler_enabled)) {
@@ -1311,6 +1317,10 @@
                         xdfree(t);
                 }
         }
+ if (clear && *EG(return_value_ptr_ptr)) {
+ zval_ptr_dtor(EG(return_value_ptr_ptr));
+ EG(return_value_ptr_ptr) = NULL;
+ }

         /* Check for return breakpoints */
         if (XG(remote_enabled) && XG(breakpoints_allowed)) {

Modified: xdebug/trunk/xdebug_compat.c
===================================================================
--- xdebug/trunk/xdebug_compat.c 2010-10-26 16:33:58 UTC (rev 3354)
+++ xdebug/trunk/xdebug_compat.c 2010-10-26 16:34:41 UTC (rev 3355)
@@ -75,7 +75,7 @@

 zval *xdebug_zval_ptr(int op_type, XDEBUG_ZNODE *node, temp_variable *Ts TSRMLS_DC)
 {
- switch (op_type) {
+ switch (op_type & 0x0F) {
                 case IS_CONST:
 #if PHP_VERSION_ID >= 50399
                         return node->zv;
Received on Tue Oct 26 2010 - 17:34:41 BST

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