Skip to content

Commit

Permalink
Objects no longer need to be explicitly passed by ref to call_user_fu…
Browse files Browse the repository at this point in the history
…nc*() to be callable. Props wonderboymusic. fixes #21865

git-svn-id: http://core.svn.wordpress.org/trunk@22118 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
Ryan Boren committed Oct 4, 2012
1 parent 1f9d02a commit 77518e9
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion wp-includes/cache.php
Expand Up @@ -635,7 +635,7 @@ function __construct() {
* @todo This should be moved to the PHP4 style constructor, PHP5
* already calls __destruct()
*/
register_shutdown_function( array( &$this, '__destruct' ) );
register_shutdown_function( array( $this, '__destruct' ) );
}

/**
Expand Down
6 changes: 3 additions & 3 deletions wp-includes/capabilities.php
Expand Up @@ -725,7 +725,7 @@ function get_role_caps() {

//Filter out caps that are not role names and assign to $this->roles
if ( is_array( $this->caps ) )
$this->roles = array_filter( array_keys( $this->caps ), array( &$wp_roles, 'is_role' ) );
$this->roles = array_filter( array_keys( $this->caps ), array( $wp_roles, 'is_role' ) );

//Build $allcaps from role caps, overlay user's $caps
$this->allcaps = array();
Expand Down Expand Up @@ -1331,7 +1331,7 @@ function author_can( $post, $capability ) {
$args = array_slice( func_get_args(), 2 );
$args = array_merge( array( $capability ), $args );

return call_user_func_array( array( &$author, 'has_cap' ), $args );
return call_user_func_array( array( $author, 'has_cap' ), $args );
}

/**
Expand All @@ -1353,7 +1353,7 @@ function user_can( $user, $capability ) {
$args = array_slice( func_get_args(), 2 );
$args = array_merge( array( $capability ), $args );

return call_user_func_array( array( &$user, 'has_cap' ), $args );
return call_user_func_array( array( $user, 'has_cap' ), $args );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/class-http.php
Expand Up @@ -1109,7 +1109,7 @@ function request($url, $args = array()) {
}

if ( true === $r['blocking'] )
curl_setopt( $handle, CURLOPT_HEADERFUNCTION, array( &$this, 'stream_headers' ) );
curl_setopt( $handle, CURLOPT_HEADERFUNCTION, array( $this, 'stream_headers' ) );

curl_setopt( $handle, CURLOPT_HEADER, false );

Expand Down
2 changes: 1 addition & 1 deletion wp-includes/class-oembed.php
Expand Up @@ -53,7 +53,7 @@ function __construct() {
) );

// Fix any embeds that contain new lines in the middle of the HTML which breaks wpautop().
add_filter( 'oembed_dataparse', array(&$this, '_strip_newlines'), 10, 3 );
add_filter( 'oembed_dataparse', array($this, '_strip_newlines'), 10, 3 );
}

/**
Expand Down
8 changes: 4 additions & 4 deletions wp-includes/class-wp-walker.php
Expand Up @@ -126,7 +126,7 @@ function display_element( $element, &$children_elements, $max_depth, $depth=0, $
if ( is_array( $args[0] ) )
$args[0]['has_children'] = ! empty( $children_elements[$element->$id_field] );
$cb_args = array_merge( array(&$output, $element, $depth), $args);
call_user_func_array(array(&$this, 'start_el'), $cb_args);
call_user_func_array(array($this, 'start_el'), $cb_args);

$id = $element->$id_field;

Expand All @@ -139,7 +139,7 @@ function display_element( $element, &$children_elements, $max_depth, $depth=0, $
$newlevel = true;
//start the child delimiter
$cb_args = array_merge( array(&$output, $depth), $args);
call_user_func_array(array(&$this, 'start_lvl'), $cb_args);
call_user_func_array(array($this, 'start_lvl'), $cb_args);
}
$this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
}
Expand All @@ -149,12 +149,12 @@ function display_element( $element, &$children_elements, $max_depth, $depth=0, $
if ( isset($newlevel) && $newlevel ){
//end the child delimiter
$cb_args = array_merge( array(&$output, $depth), $args);
call_user_func_array(array(&$this, 'end_lvl'), $cb_args);
call_user_func_array(array($this, 'end_lvl'), $cb_args);
}

//end this element
$cb_args = array_merge( array(&$output, $element, $depth), $args);
call_user_func_array(array(&$this, 'end_el'), $cb_args);
call_user_func_array(array($this, 'end_el'), $cb_args);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/class-wp.php
Expand Up @@ -606,7 +606,7 @@ public static function apply($subject, $matches) {
* @return string
*/
function _map() {
$callback = array(&$this, 'callback');
$callback = array($this, 'callback');
return preg_replace_callback($this->_pattern, $callback, $this->_subject);
}

Expand Down
12 changes: 6 additions & 6 deletions wp-includes/default-widgets.php
Expand Up @@ -536,9 +536,9 @@ function __construct() {
parent::__construct('recent-posts', __('Recent Posts'), $widget_ops);
$this->alt_option_name = 'widget_recent_entries';

add_action( 'save_post', array(&$this, 'flush_widget_cache') );
add_action( 'deleted_post', array(&$this, 'flush_widget_cache') );
add_action( 'switch_theme', array(&$this, 'flush_widget_cache') );
add_action( 'save_post', array($this, 'flush_widget_cache') );
add_action( 'deleted_post', array($this, 'flush_widget_cache') );
add_action( 'switch_theme', array($this, 'flush_widget_cache') );
}

function widget($args, $instance) {
Expand Down Expand Up @@ -637,10 +637,10 @@ function __construct() {
$this->alt_option_name = 'widget_recent_comments';

if ( is_active_widget(false, false, $this->id_base) )
add_action( 'wp_head', array(&$this, 'recent_comments_style') );
add_action( 'wp_head', array($this, 'recent_comments_style') );

add_action( 'comment_post', array(&$this, 'flush_widget_cache') );
add_action( 'transition_comment_status', array(&$this, 'flush_widget_cache') );
add_action( 'comment_post', array($this, 'flush_widget_cache') );
add_action( 'transition_comment_status', array($this, 'flush_widget_cache') );
}

function recent_comments_style() {
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/nav-menu-template.php
Expand Up @@ -475,7 +475,7 @@ function walk_nav_menu_tree( $items, $depth, $r ) {
$walker = ( empty($r->walker) ) ? new Walker_Nav_Menu : $r->walker;
$args = array( $items, $depth, $r );

return call_user_func_array( array(&$walker, 'walk'), $args );
return call_user_func_array( array($walker, 'walk'), $args );
}

/**
Expand Down
4 changes: 2 additions & 2 deletions wp-includes/post-template.php
Expand Up @@ -937,7 +937,7 @@ function walk_page_tree($pages, $depth, $current_page, $r) {
$walker = $r['walker'];

$args = array($pages, $depth, $r, $current_page);
return call_user_func_array(array(&$walker, 'walk'), $args);
return call_user_func_array(array($walker, 'walk'), $args);
}

/**
Expand All @@ -954,7 +954,7 @@ function walk_page_dropdown_tree() {
else
$walker = $args[2]['walker'];

return call_user_func_array(array(&$walker, 'walk'), $args);
return call_user_func_array(array($walker, 'walk'), $args);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/taxonomy.php
Expand Up @@ -1410,7 +1410,7 @@ function get_terms($taxonomies, $args = '') {
if ( $child_of ) {
$children = _get_term_hierarchy($taxonomies[0]);
if ( ! empty($children) )
$terms = & _get_term_children($child_of, $terms, $taxonomies[0]);
$terms = _get_term_children($child_of, $terms, $taxonomies[0]);
}

// Update term counts to include children.
Expand Down
8 changes: 4 additions & 4 deletions wp-includes/widgets.php
Expand Up @@ -152,15 +152,15 @@ function _set($number) {
}

function _get_display_callback() {
return array(&$this, 'display_callback');
return array($this, 'display_callback');
}

function _get_update_callback() {
return array(&$this, 'update_callback');
return array($this, 'update_callback');
}

function _get_form_callback() {
return array(&$this, 'form_callback');
return array($this, 'form_callback');
}

/** Generate the actual widget content.
Expand Down Expand Up @@ -317,7 +317,7 @@ class WP_Widget_Factory {
var $widgets = array();

function WP_Widget_Factory() {
add_action( 'widgets_init', array( &$this, '_register_widgets' ), 100 );
add_action( 'widgets_init', array( $this, '_register_widgets' ), 100 );
}

function register($widget_class) {
Expand Down
4 changes: 2 additions & 2 deletions wp-includes/wp-db.php
Expand Up @@ -534,7 +534,7 @@ class wpdb {
* @param string $dbhost MySQL database host
*/
function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) {
register_shutdown_function( array( &$this, '__destruct' ) );
register_shutdown_function( array( $this, '__destruct' ) );

if ( WP_DEBUG )
$this->show_errors();
Expand Down Expand Up @@ -1000,7 +1000,7 @@ function prepare( $query = null ) { // ( $query, *$args )
$query = str_replace( '"%s"', '%s', $query ); // doublequote unquoting
$query = str_replace( '%f' , '%F', $query ); // Force floats to be locale unaware
$query = preg_replace( '|(?<!%)%s|', "'%s'", $query ); // quote the strings, avoiding escaped strings like %%s
array_walk( $args, array( &$this, 'escape_by_ref' ) );
array_walk( $args, array( $this, 'escape_by_ref' ) );
return @vsprintf( $query, $args );
}

Expand Down
2 changes: 1 addition & 1 deletion wp-includes/wp-diff.php
Expand Up @@ -422,7 +422,7 @@ function compute_string_distance( $string1, $string2 ) {
$chars2 = count_chars($string2);

// L1-norm of difference vector.
$difference = array_sum( array_map( array(&$this, 'difference'), $chars1, $chars2 ) );
$difference = array_sum( array_map( array($this, 'difference'), $chars1, $chars2 ) );

// $string1 has zero length? Odd. Give huge penalty by not dividing.
if ( !$string1 )
Expand Down

0 comments on commit 77518e9

Please sign in to comment.