diff -wu b/core/modules/system/system.install b/core/modules/system/system.install --- b/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -648,12 +648,20 @@ } } - // Check if xdebug.max_nesting_level is too low, as it crashes some pages. - $xdebug_nesting_level = 256; - if (extension_loaded('xdebug') && ini_get('xdebug.max_nesting_level') < $xdebug_nesting_level) { - // Report on where the correct ini file is to the user. + // Check xdebug.max_nesting_level, as some pages will not work if it is too + // low. + if (extension_loaded('xdebug')) { + // Setting this value to 256 was considered adequate on Xdebug 2.3 + // (see http://bugs.xdebug.org/bug_view_page.php?bug_id=00001100) + $minimum_nesting_level = 256; + $current_nesting_level = ini_get('xdebug.max_nesting_level'); + + if ($current_nesting_level < $minimum_nesting_level) { + // Locate the correct ini file for Xdebug. $ini_scanned_files = php_ini_scanned_files(); $ini_location = php_ini_loaded_file(); + // If there is a specific ini file for Xdebug, recommend that in place of + // the loaded ini file. if ($ini_scanned_files !== FALSE) { $ini_files = explode(',', $ini_scanned_files); foreach ($ini_files as $value) { @@ -664,18 +672,19 @@ } } - $description = t('A max_nesting_level lower than @level will cause some pages in your Drupal site to crash. To fix this it is recommended to set xdebug.max_nesting_level=@level in your PHP configuration for Xdebug.', array('@level' => $xdebug_nesting_level)); + $description = t('Set xdebug_.max_nesting_level=@level in your PHP configuration as some pages in your Drupal site will not work when this setting is too low.', array('@level' => $minimum_nesting_level)); if ($ini_location !== FALSE) { $description .= ' ' . t('Your Xdebug configuration can be modified in @ini_location.', array('@ini_location' => $ini_location)); } $requirements['xdebug_max_nesting_level'] = array( 'title' => t('Xdebug settings'), - 'value' => t('xdebug.max_nesting_level is set to %value.', array('%value' => ini_get('xdebug.max_nesting_level'))), + 'value' => t('xdebug.max_nesting_level is set to %value.', array('%value' => $current_nesting_level)), 'description' => $description, 'severity' => REQUIREMENT_ERROR, ); } + } return $requirements; }