Commit e3dfcf93 authored by catch's avatar catch

Issue #1217840 by tim.plunkett: Use unset() instead of array_shift() to remove...

Issue #1217840 by tim.plunkett: Use unset() instead of array_shift() to remove arguments from func_get_args().
parent 54152707
......@@ -1899,7 +1899,7 @@ function module_invoke($module, $hook) {
function module_invoke_all($hook) {
$args = func_get_args();
// Remove $hook from the arguments.
array_shift($args);
unset($args[0]);
return \Drupal::moduleHandler()->invokeAll($hook, $args);
}
......@@ -2498,7 +2498,8 @@ function &drupal_register_shutdown_function($callback = NULL) {
register_shutdown_function('_drupal_shutdown_function');
}
$args = func_get_args();
array_shift($args);
// Remove $callback from the arguments.
unset($args[0]);
// Save callback and arguments
$callbacks[] = array('callback' => $callback, 'arguments' => $args);
}
......
......@@ -181,8 +181,8 @@ public function getForm($form_arg) {
$args = func_get_args();
// Remove $form_arg from the arguments.
array_shift($args);
$form_state['build_info']['args'] = $args;
unset($args[0]);
$form_state['build_info']['args'] = array_values($args);
$form_id = $this->getFormId($form_arg, $form_state);
return $this->buildForm($form_id, $form_state);
......
......@@ -1050,10 +1050,8 @@ function _views_query_tag_alter_condition(AlterableInterface $query, &$condition
*/
function views_embed_view($name, $display_id = 'default') {
$args = func_get_args();
array_shift($args); // remove $name
if (count($args)) {
array_shift($args); // remove $display_id
}
// Remove $name and $display_id from the arguments.
unset($args[0], $args[1]);
$view = views_get_view($name);
if (!$view || !$view->access($display_id)) {
......@@ -1082,10 +1080,8 @@ function views_embed_view($name, $display_id = 'default') {
*/
function views_get_view_result($name, $display_id = NULL) {
$args = func_get_args();
array_shift($args); // remove $name
if (count($args)) {
array_shift($args); // remove $display_id
}
// Remove $name and $display_id from the arguments.
unset($args[0], $args[1]);
$view = views_get_view($name);
if (is_object($view)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment