diff --git a/core/modules/action/action.module b/core/modules/action/action.module index 596b93a..c7de26a 100644 --- a/core/modules/action/action.module +++ b/core/modules/action/action.module @@ -141,7 +141,8 @@ function actions_do($action_ids, $object = NULL, $context = NULL, $a1 = NULL, $a // $stack tracks the number of recursive calls. static $stack; $stack++; - if ($stack > variable_get('action_max_stack', 35)) { + $config = config('action.settings'); + if ($stack > $config->get('stack_limit')) { watchdog('action', 'Stack overflow: too many calls to actions_do(). Aborting to prevent infinite recursion.', array(), WATCHDOG_ERROR); return; } diff --git a/core/modules/action/config/action.settings.yml b/core/modules/action/config/action.settings.yml new file mode 100644 index 0000000..36d2e8b --- /dev/null +++ b/core/modules/action/config/action.settings.yml @@ -0,0 +1 @@ +stack_limit: '35' diff --git a/core/modules/action/lib/Drupal/action/Tests/LoopTest.php b/core/modules/action/lib/Drupal/action/Tests/LoopTest.php index a185c17..d64af94 100644 --- a/core/modules/action/lib/Drupal/action/Tests/LoopTest.php +++ b/core/modules/action/lib/Drupal/action/Tests/LoopTest.php @@ -48,7 +48,9 @@ class LoopTest extends WebTestBase { // recursion level should be kept low enough to prevent the xdebug // infinite recursion protection mechanism from aborting the request. // See http://drupal.org/node/587634. - variable_set('action_max_stack', 7); + $config = config('action.settings'); + $config->set('action.stack_limit', 7); + $config->save(); $this->triggerActions(); } @@ -61,7 +63,8 @@ class LoopTest extends WebTestBase { $this->drupalGet('', array('query' => array('trigger_action_on_watchdog' => $this->aid))); $expected = array(); $expected[] = 'Triggering action loop'; - for ($i = 1; $i <= variable_get('action_max_stack', 35); $i++) { + $config = config('action.settings'); + for ($i = 1; $i <= $config->get('stack_limit'); $i++) { $expected[] = "Test log #$i"; } $expected[] = 'Stack overflow: too many calls to actions_do(). Aborting to prevent infinite recursion.';