Skip to content

Commit

Permalink
- Do not force xdebug.collect_vars=1 because it slows down the execut…
Browse files Browse the repository at this point in the history
…ion.

  If your tests rely on variables that are set in the global scope of
  your test case's source (see http://pear.php.net/bugs/bug.php?id=5053)
  you need to set this in your php.ini configuration file.
  • Loading branch information
sebastianbergmann committed Jan 13, 2007
1 parent e09d155 commit 599ba35
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions PHPUnit/Util/Fileloader.php
Expand Up @@ -48,9 +48,6 @@


PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT'); PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');


// Needed for xdebug_get_declared_vars().
ini_set('xdebug.collect_vars', 1);

/** /**
* *
* *
Expand Down Expand Up @@ -124,13 +121,16 @@ public static function getIncludePaths()
*/ */
protected static function load($filename) protected static function load($filename)
{ {
if (function_exists('xdebug_get_declared_vars')) { $xdebugLoaded = extension_loaded('xdebug');
$xdebugCollectVars = $xdebugLoaded && ini_get('xdebug.collect_vars') == '1';

if ($xdebugCollectVars) {
$variables = array('variables', xdebug_get_declared_vars()); $variables = array('variables', xdebug_get_declared_vars());
} }


include_once $filename; include_once $filename;


if (function_exists('xdebug_get_declared_vars')) { if ($xdebugCollectVars) {
$variables = array_values( $variables = array_values(
array_diff(xdebug_get_declared_vars(), $variables) array_diff(xdebug_get_declared_vars(), $variables)
); );
Expand Down

0 comments on commit 599ba35

Please sign in to comment.