svn: /pear/pear-core/trunk/PEAR/ RunTest.php

[email protected] (Helgi Þormar Þorbjörnsson) Tue, 16 Nov 2010 01:58:39 +0000
Newsgroups php.pear.cvs,php.pear.core
Message-ID <[email protected]>
dufuz                                    Tue, 16 Nov 2010 01:58:39 +0000

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

Log:
Fixed bug #18001	PEAR/RunTest coverage fails [dufuz]

In rev 297621 Sebastian B. added a fix to make sure the Namespace declaration stays at the top. As a result the coverage code was no longer included in the output .php file - It has been added again.
There is also a PHP Notice fix in the affected code in case the first line is unset (if it's <?php or <?)

Bug: http://pear.php.net/bugs/18001 (unknown) 
      
Changed paths:
    U   pear/pear-core/trunk/PEAR/RunTest.php

Modified: pear/pear-core/trunk/PEAR/RunTest.php
===================================================================
--- pear/pear-core/trunk/PEAR/RunTest.php	2010-11-16 00:31:39 UTC (rev 305392)
+++ pear/pear-core/trunk/PEAR/RunTest.php	2010-11-16 01:58:39 UTC (rev 305393)
@@ -385,7 +385,7 @@
             $text .= "\n" . 'xdebug_stop_code_coverage();' .
                 "\n" . '} // end coverage_shutdown()' .
                 "\n" . 'register_shutdown_function("coverage_shutdown");';
-            $text .= "\n" . 'xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);' . "\n?>";
+            $text .= "\n" . 'xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);' . "\n";

             // Workaround for http://pear.php.net/bugs/bug.php?id=17292
             $lines     = explode("\n", $section_text['FILE']);
@@ -399,14 +399,14 @@
                     unset($lines[$i]);
                 }

-                if (substr($lines[$i], 0, 9) == 'namespace') {
+                if (isset($lines[$i]) && substr($lines[$i], 0, 9) == 'namespace') {
                     $namespace = $lines[$i] . "\n";
                     unset($lines[$i]);
                     break;
                 }
             }

-            $this->save_text($temp_file, "<?php\n" . $namespace . join("\n", $lines));
+            $this->save_text($temp_file, "<?php\n" . $namespace . "\n" . $text  . "\n" . implode("\n", $lines));
         } else {
             $this->save_text($temp_file, $section_text['FILE']);
         }