MINOR: Add workaround for hitting XDebugs fairly conservative nesting level limit

This commit is contained in:
Hamish Friedlander 2012-02-20 09:18:14 +13:00
parent e4675d7172
commit 407913f2cf

View File

@ -195,6 +195,11 @@ define('PR_LOW',10);
*/
increase_memory_limit_to('64M');
/**
* Ensure we don't run into xdebug's fairly conservative infinite recursion protection limit
*/
increase_xdebug_nesting_level_to(200);
/**
* Set default encoding
*/
@ -433,6 +438,19 @@ function get_increase_memory_limit_max() {
return $_increase_memory_limit_max;
}
/**
* Increases the XDebug parameter max_nesting_level, which limits how deep recursion can go.
* Only does anything if (a) xdebug is installed and (b) the new limit is higher than the existing limit
*
* @param int $limit - The new limit to increase to
*/
function increase_xdebug_nesting_level_to($limit) {
if (function_exists('xdebug_enable')) {
$current = ini_get('xdebug.max_nesting_level');
if ((int)$current < $limit) ini_set('xdebug.max_nesting_level', $limit);
}
}
/**
* Turn a memory string, such as 512M into an actual number of bytes.
*