[xdebug-dev] svn: /xdebug/trunk/ tests/bug00639.phpt tests/bug00643-t1.inc tests/bug00643-t2.inc tests/bug00643.phpt xdebug_profiler.c

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Mon, 21 Mar 2011 20:09:21 +0000

derick Mon, 21 Mar 2011 20:09:20 +0000

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

Log:
- Fixed bug #643: Profiler gets line numbers wrong

Changed paths:
    U xdebug/trunk/tests/bug00639.phpt
    A xdebug/trunk/tests/bug00643-t1.inc
    A xdebug/trunk/tests/bug00643-t2.inc
    A xdebug/trunk/tests/bug00643.phpt
    U xdebug/trunk/xdebug_profiler.c

Modified: xdebug/trunk/tests/bug00639.phpt
===================================================================
--- xdebug/trunk/tests/bug00639.phpt 2011-03-21 20:09:20 UTC (rev 3413)
+++ xdebug/trunk/tests/bug00639.phpt 2011-03-21 20:09:20 UTC (rev 3414)
@@ -39,7 +39,7 @@

 fl=%sbug00639-2.inc
 fn=func2
-6 %d
+2 %d
 cfl=php:internal
 cfn=php::strlen
 calls=1 0 0
@@ -51,7 +51,7 @@

 fl=%sbug00639-2.inc
 fn=func2
-7 %d
+2 %d
 cfl=php:internal
 cfn=php::strlen
 calls=1 0 0
@@ -59,7 +59,7 @@

 fl=%sbug00639.php
 fn=func1
-10 %d
+4 %d
 cfl=%sbug00639-2.inc
 cfn=func2
 calls=1 0 0
@@ -75,7 +75,7 @@

 fl=%sbug00639-2.inc
 fn=func2
-11 %d
+2 %d
 cfl=php:internal
 cfn=php::strlen
 calls=1 0 0
@@ -87,7 +87,7 @@

 fl=%sbug00639-2.inc
 fn=func2
-12 %d
+2 %d
 cfl=php:internal
 cfn=php::strlen
 calls=1 0 0
@@ -99,7 +99,7 @@

 fl=%sbug00639-2.inc
 fn=func2
-13 %d
+2 %d
 cfl=php:internal
 cfn=php::strlen
 calls=1 0 0

Added: xdebug/trunk/tests/bug00643-t1.inc
===================================================================
--- xdebug/trunk/tests/bug00643-t1.inc (rev 0)
+++ xdebug/trunk/tests/bug00643-t1.inc 2011-03-21 20:09:20 UTC (rev 3414)
@@ -0,0 +1,29 @@
+<?php
+require_once('bug00643-t2.inc');
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+function t1()
+{
+ global $a;
+ if (count($a) && errors_fatal($a))
+ {
+ echo "ok";
+ }
+ return TRUE;
+}
+?>

Added: xdebug/trunk/tests/bug00643-t2.inc
===================================================================
--- xdebug/trunk/tests/bug00643-t2.inc (rev 0)
+++ xdebug/trunk/tests/bug00643-t2.inc 2011-03-21 20:09:20 UTC (rev 3414)
@@ -0,0 +1,15 @@
+<?php
+
+
+
+
+
+
+
+
+function errors_fatal($a)
+{
+ count($a) && is_array($a);
+ return FALSE;
+}
+?>

Added: xdebug/trunk/tests/bug00643.phpt
===================================================================
--- xdebug/trunk/tests/bug00643.phpt (rev 0)
+++ xdebug/trunk/tests/bug00643.phpt 2011-03-21 20:09:20 UTC (rev 3414)
@@ -0,0 +1,73 @@
+--TEST--
+Test for bug #643: Profiler gets line numbers wrong
+--INI--
+xdebug.profiler_enable=1
+--FILE--
+<?php
+require_once('bug00643-t1.inc');
+
+$a = array("testing");
+
+t1();
+echo file_get_contents(xdebug_get_profiler_filename());
+?>
+--EXPECTF--
+version: 1
+creator: xdebug 2.%s
+cmd: %sbug00643.php
+part: 1
+positions: line
+
+events: Time
+
+fl=%sbug00643-t2.inc
+fn=require_once::%sbug00643-t2.inc
+1 %d
+
+fl=%sbug00643-t1.inc
+fn=require_once::%sbug00643-t1.inc
+1 %d
+cfl=%sbug00643-t2.inc
+cfn=require_once::%sbug00643-t2.inc
+calls=1 0 0
+2 %d
+
+fl=php:internal
+fn=php::count
+23 %d
+
+fl=php:internal
+fn=php::count
+12 %d
+
+fl=php:internal
+fn=php::is_array
+12 %d
+
+fl=%sbug00643-t2.inc
+fn=errors_fatal
+10 %d
+cfl=php:internal
+cfn=php::count
+calls=1 0 0
+12 %d
+cfl=php:internal
+cfn=php::is_array
+calls=1 0 0
+12 %d
+
+fl=%sbug00643-t1.inc
+fn=t1
+20 %d
+cfl=php:internal
+cfn=php::count
+calls=1 0 0
+23 %d
+cfl=%sbug00643-t2.inc
+cfn=errors_fatal
+calls=1 0 0
+23 %d
+
+fl=php:internal
+fn=php::xdebug_get_profiler_filename
+7 %d

Modified: xdebug/trunk/xdebug_profiler.c
===================================================================
--- xdebug/trunk/xdebug_profiler.c 2011-03-21 20:09:20 UTC (rev 3413)
+++ xdebug/trunk/xdebug_profiler.c 2011-03-21 20:09:20 UTC (rev 3414)
@@ -154,9 +154,16 @@
                         break;

                 default:
- default_lineno = fse->lineno;
+ if (op_array) {
+ default_lineno = op_array->line_start;
+ } else {
+ default_lineno = fse->lineno;
+ }
                         break;
         }
+ if (default_lineno == 0) {
+ default_lineno = 1;
+ }

         if (fse->prev) {
                 xdebug_call_entry *ce = xdmalloc(sizeof(xdebug_call_entry));
Received on Mon Mar 21 2011 - 20:09:21 GMT

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