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

8.0.x
Nathaniel Catchpole 2014-02-14 12:35:19 +00:00
parent 541527079f
commit e3dfcf9371
3 changed files with 9 additions and 12 deletions

View File

@ -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);
}

View File

@ -181,8 +181,8 @@ class FormBuilder implements FormBuilderInterface {
$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);

View File

@ -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)) {