Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MINOR: Add workaround for hitting XDebugs fairly conservative nesting…

… level limit
  • Loading branch information...
commit 407913f2cf943cccccab3d6353325a15c03bdf8f 1 parent e4675d7
@hafriedlander hafriedlander authored
Showing with 18 additions and 0 deletions.
  1. +18 −0 core/Core.php
View
18 core/Core.php
@@ -196,6 +196,11 @@ function array_fill_keys($keys,$value) {
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
*/
if(function_exists('mb_http_output')) {
@@ -434,6 +439,19 @@ function get_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.
*
* @param A memory limit string, such as "64M"
Please sign in to comment.
Something went wrong with that request. Please try again.