Ticket #21865: call-time-pass-by.diff

File call-time-pass-by.diff, 19.0 KB (added by wonderboymusic, 8 months ago)
Line 
1Index: wp-includes/post-template.php
2===================================================================
3--- wp-includes/post-template.php       (revision 21801)
4+++ wp-includes/post-template.php       (working copy)
5@@ -934,7 +934,7 @@
6                $walker = $r['walker'];
7 
8        $args = array($pages, $depth, $r, $current_page);
9-       return call_user_func_array(array(&$walker, 'walk'), $args);
10+       return call_user_func_array(array($walker, 'walk'), $args);
11 }
12 
13 /**
14@@ -951,7 +951,7 @@
15        else
16                $walker = $args[2]['walker'];
17 
18-       return call_user_func_array(array(&$walker, 'walk'), $args);
19+       return call_user_func_array(array($walker, 'walk'), $args);
20 }
21 
22 /**
23Index: wp-includes/nav-menu-template.php
24===================================================================
25--- wp-includes/nav-menu-template.php   (revision 21801)
26+++ wp-includes/nav-menu-template.php   (working copy)
27@@ -469,7 +469,7 @@
28        $walker = ( empty($r->walker) ) ? new Walker_Nav_Menu : $r->walker;
29        $args = array( $items, $depth, $r );
30 
31-       return call_user_func_array( array(&$walker, 'walk'), $args );
32+       return call_user_func_array( array($walker, 'walk'), $args );
33 }
34 
35 /**
36Index: wp-includes/category.php
37===================================================================
38--- wp-includes/category.php    (revision 21801)
39+++ wp-includes/category.php    (working copy)
40@@ -185,7 +185,7 @@
41  */
42 function get_cat_name( $cat_id ) {
43        $cat_id = (int) $cat_id;
44-       $category = &get_category( $cat_id );
45+       $category = get_category( $cat_id );
46        if ( ! $category || is_wp_error( $category ) )
47                return '';
48        return $category->name;
49@@ -319,18 +319,18 @@
50  */
51 function _make_cat_compat( &$category ) {
52        if ( is_object( $category ) ) {
53-               $category->cat_ID = &$category->term_id;
54-               $category->category_count = &$category->count;
55-               $category->category_description = &$category->description;
56-               $category->cat_name = &$category->name;
57-               $category->category_nicename = &$category->slug;
58-               $category->category_parent = &$category->parent;
59+               $category->cat_ID = $category->term_id;
60+               $category->category_count = $category->count;
61+               $category->category_description = $category->description;
62+               $category->cat_name = $category->name;
63+               $category->category_nicename = $category->slug;
64+               $category->category_parent = $category->parent;
65        } elseif ( is_array( $category ) && isset( $category['term_id'] ) ) {
66-               $category['cat_ID'] = &$category['term_id'];
67-               $category['category_count'] = &$category['count'];
68-               $category['category_description'] = &$category['description'];
69-               $category['cat_name'] = &$category['name'];
70-               $category['category_nicename'] = &$category['slug'];
71-               $category['category_parent'] = &$category['parent'];
72+               $category['cat_ID'] = $category['term_id'];
73+               $category['category_count'] = $category['count'];
74+               $category['category_description'] = $category['description'];
75+               $category['cat_name'] = $category['name'];
76+               $category['category_nicename'] = $category['slug'];
77+               $category['category_parent'] = $category['parent'];
78        }
79 }
80Index: wp-includes/taxonomy.php
81===================================================================
82--- wp-includes/taxonomy.php    (revision 21801)
83+++ wp-includes/taxonomy.php    (working copy)
84@@ -1408,7 +1408,7 @@
85        if ( $child_of ) {
86                $children = _get_term_hierarchy($taxonomies[0]);
87                if ( ! empty($children) )
88-                       $terms = & _get_term_children($child_of, $terms, $taxonomies[0]);
89+                       $terms = _get_term_children($child_of, $terms, $taxonomies[0]);
90        }
91 
92        // Update term counts to include children.
93@@ -2981,9 +2981,9 @@
94 
95        if ( !is_object($term) ) {
96                if ( is_int($term) ) {
97-                       $term = &get_term($term, $taxonomy);
98+                       $term = get_term($term, $taxonomy);
99                } else {
100-                       $term = &get_term_by('slug', $term, $taxonomy);
101+                       $term = get_term_by('slug', $term, $taxonomy);
102                }
103        }
104 
105Index: wp-includes/class-http.php
106===================================================================
107--- wp-includes/class-http.php  (revision 21801)
108+++ wp-includes/class-http.php  (working copy)
109@@ -1113,7 +1113,7 @@
110                }
111 
112                if ( true === $r['blocking'] )
113-                       curl_setopt( $handle, CURLOPT_HEADERFUNCTION, array( &$this, 'stream_headers' ) );
114+                       curl_setopt( $handle, CURLOPT_HEADERFUNCTION, array( $this, 'stream_headers' ) );
115 
116                curl_setopt( $handle, CURLOPT_HEADER, false );
117 
118Index: wp-includes/post.php
119===================================================================
120--- wp-includes/post.php        (revision 21801)
121+++ wp-includes/post.php        (working copy)
122@@ -3655,7 +3655,7 @@
123        update_post_cache( $pages );
124 
125        if ( $child_of || $hierarchical )
126-               $pages = & get_page_children($child_of, $pages);
127+               $pages = get_page_children($child_of, $pages);
128 
129        if ( !empty($exclude_tree) ) {
130                $exclude = (int) $exclude_tree;
131Index: wp-includes/default-widgets.php
132===================================================================
133--- wp-includes/default-widgets.php     (revision 21801)
134+++ wp-includes/default-widgets.php     (working copy)
135@@ -536,9 +536,9 @@
136                parent::__construct('recent-posts', __('Recent Posts'), $widget_ops);
137                $this->alt_option_name = 'widget_recent_entries';
138 
139-               add_action( 'save_post', array(&$this, 'flush_widget_cache') );
140-               add_action( 'deleted_post', array(&$this, 'flush_widget_cache') );
141-               add_action( 'switch_theme', array(&$this, 'flush_widget_cache') );
142+               add_action( 'save_post', array($this, 'flush_widget_cache') );
143+               add_action( 'deleted_post', array($this, 'flush_widget_cache') );
144+               add_action( 'switch_theme', array($this, 'flush_widget_cache') );
145        }
146 
147        function widget($args, $instance) {
148@@ -626,10 +626,10 @@
149                $this->alt_option_name = 'widget_recent_comments';
150 
151                if ( is_active_widget(false, false, $this->id_base) )
152-                       add_action( 'wp_head', array(&$this, 'recent_comments_style') );
153+                       add_action( 'wp_head', array($this, 'recent_comments_style') );
154 
155-               add_action( 'comment_post', array(&$this, 'flush_widget_cache') );
156-               add_action( 'transition_comment_status', array(&$this, 'flush_widget_cache') );
157+               add_action( 'comment_post', array($this, 'flush_widget_cache') );
158+               add_action( 'transition_comment_status', array($this, 'flush_widget_cache') );
159        }
160 
161        function recent_comments_style() {
162Index: wp-includes/wp-diff.php
163===================================================================
164--- wp-includes/wp-diff.php     (revision 21801)
165+++ wp-includes/wp-diff.php     (working copy)
166@@ -422,7 +422,7 @@
167                $chars2 = count_chars($string2);
168 
169                // L1-norm of difference vector.
170-               $difference = array_sum( array_map( array(&$this, 'difference'), $chars1, $chars2 ) );
171+               $difference = array_sum( array_map( array($this, 'difference'), $chars1, $chars2 ) );
172 
173                // $string1 has zero length? Odd. Give huge penalty by not dividing.
174                if ( !$string1 )
175Index: wp-includes/l10n.php
176===================================================================
177--- wp-includes/l10n.php        (revision 21801)
178+++ wp-includes/l10n.php        (working copy)
179@@ -65,7 +65,7 @@
180  * @return string Translated text
181  */
182 function translate( $text, $domain = 'default' ) {
183-       $translations = &get_translations_for_domain( $domain );
184+       $translations = get_translations_for_domain( $domain );
185        return apply_filters( 'gettext', $translations->translate( $text ), $text, $domain );
186 }
187 
188@@ -78,7 +78,7 @@
189 }
190 
191 function translate_with_gettext_context( $text, $context, $domain = 'default' ) {
192-       $translations = &get_translations_for_domain( $domain );
193+       $translations = get_translations_for_domain( $domain );
194        return apply_filters( 'gettext_with_context', $translations->translate( $text, $context ), $text, $context, $domain );
195 }
196 
197@@ -236,7 +236,7 @@
198  * @return string Either $single or $plural translated text
199  */
200 function _n( $single, $plural, $number, $domain = 'default' ) {
201-       $translations = &get_translations_for_domain( $domain );
202+       $translations = get_translations_for_domain( $domain );
203        $translation = $translations->translate_plural( $single, $plural, $number );
204        return apply_filters( 'ngettext', $translation, $single, $plural, $number, $domain );
205 }
206@@ -249,7 +249,7 @@
207  *
208  */
209 function _nx($single, $plural, $number, $context, $domain = 'default') {
210-       $translations = &get_translations_for_domain( $domain );
211+       $translations = get_translations_for_domain( $domain );
212        $translation = $translations->translate_plural( $single, $plural, $number, $context );
213        return apply_filters( 'ngettext_with_context', $translation, $single, $plural, $number, $context, $domain );
214 }
215Index: wp-includes/comment-template.php
216===================================================================
217--- wp-includes/comment-template.php    (revision 21801)
218+++ wp-includes/comment-template.php    (working copy)
219@@ -894,7 +894,7 @@
220        update_comment_cache($wp_query->comments);
221 
222        if ( $separate_comments ) {
223-               $wp_query->comments_by_type = &separate_comments($comments);
224+               $wp_query->comments_by_type = separate_comments($comments);
225                $comments_by_type = &$wp_query->comments_by_type;
226        }
227 
228@@ -1428,7 +1428,7 @@
229                if ( empty($comments) )
230                        return;
231                if ( 'all' != $r['type'] ) {
232-                       $comments_by_type = &separate_comments($comments);
233+                       $comments_by_type = separate_comments($comments);
234                        if ( empty($comments_by_type[$r['type']]) )
235                                return;
236                        $_comments = $comments_by_type[$r['type']];
237@@ -1440,7 +1440,7 @@
238                        return;
239                if ( 'all' != $r['type'] ) {
240                        if ( empty($wp_query->comments_by_type) )
241-                               $wp_query->comments_by_type = &separate_comments($wp_query->comments);
242+                               $wp_query->comments_by_type = separate_comments($wp_query->comments);
243                        if ( empty($wp_query->comments_by_type[$r['type']]) )
244                                return;
245                        $_comments = $wp_query->comments_by_type[$r['type']];
246Index: wp-includes/media.php
247===================================================================
248--- wp-includes/media.php       (revision 21801)
249+++ wp-includes/media.php       (working copy)
250@@ -1054,20 +1054,20 @@
251         */
252        function __construct() {
253                // Hack to get the [embed] shortcode to run before wpautop()
254-               add_filter( 'the_content', array(&$this, 'run_shortcode'), 8 );
255+               add_filter( 'the_content', array($this, 'run_shortcode'), 8 );
256 
257                // Shortcode placeholder for strip_shortcodes()
258                add_shortcode( 'embed', '__return_false' );
259 
260                // Attempts to embed all URLs in a post
261                if ( get_option('embed_autourls') )
262-                       add_filter( 'the_content', array(&$this, 'autoembed'), 8 );
263+                       add_filter( 'the_content', array($this, 'autoembed'), 8 );
264 
265                // After a post is saved, invalidate the oEmbed cache
266-               add_action( 'save_post', array(&$this, 'delete_oembed_caches') );
267+               add_action( 'save_post', array($this, 'delete_oembed_caches') );
268 
269                // After a post is saved, cache oEmbed items via AJAX
270-               add_action( 'edit_form_advanced', array(&$this, 'maybe_run_ajax_cache') );
271+               add_action( 'edit_form_advanced', array($this, 'maybe_run_ajax_cache') );
272        }
273 
274        /**
275@@ -1092,7 +1092,7 @@
276                $orig_shortcode_tags = $shortcode_tags;
277                remove_all_shortcodes();
278 
279-               add_shortcode( 'embed', array(&$this, 'shortcode') );
280+               add_shortcode( 'embed', array($this, 'shortcode') );
281 
282                // Do the shortcode (only the [embed] one is registered)
283                $content = do_shortcode( $content );
284@@ -1282,7 +1282,7 @@
285         * @return string Potentially modified $content.
286         */
287        function autoembed( $content ) {
288-               return preg_replace_callback( '|^\s*(https?://[^\s"]+)\s*$|im', array(&$this, 'autoembed_callback'), $content );
289+               return preg_replace_callback( '|^\s*(https?://[^\s"]+)\s*$|im', array($this, 'autoembed_callback'), $content );
290        }
291 
292        /**
293Index: wp-includes/cache.php
294===================================================================
295--- wp-includes/cache.php       (revision 21801)
296+++ wp-includes/cache.php       (working copy)
297@@ -623,7 +623,7 @@
298                 * @todo This should be moved to the PHP4 style constructor, PHP5
299                 * already calls __destruct()
300                 */
301-               register_shutdown_function( array( &$this, '__destruct' ) );
302+               register_shutdown_function( array( $this, '__destruct' ) );
303        }
304 
305        /**
306Index: wp-includes/link-template.php
307===================================================================
308--- wp-includes/link-template.php       (revision 21801)
309+++ wp-includes/link-template.php       (working copy)
310@@ -974,7 +974,7 @@
311  * @return string
312  */
313 function get_edit_comment_link( $comment_id = 0 ) {
314-       $comment = &get_comment( $comment_id );
315+       $comment = get_comment( $comment_id );
316 
317        if ( !current_user_can( 'edit_comment', $comment->comment_ID ) )
318                return;
319Index: wp-includes/wp-db.php
320===================================================================
321--- wp-includes/wp-db.php       (revision 21801)
322+++ wp-includes/wp-db.php       (working copy)
323@@ -534,7 +534,7 @@
324         * @param string $dbhost MySQL database host
325         */
326        function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) {
327-               register_shutdown_function( array( &$this, '__destruct' ) );
328+               register_shutdown_function( array( $this, '__destruct' ) );
329 
330                if ( WP_DEBUG )
331                        $this->show_errors();
332@@ -1000,7 +1000,7 @@
333                $query = str_replace( '"%s"', '%s', $query ); // doublequote unquoting
334                $query = str_replace( '%f' , '%F', $query ); // Force floats to be locale unaware
335                $query = preg_replace( '|(?<!%)%s|', "'%s'", $query ); // quote the strings, avoiding escaped strings like %%s
336-               array_walk( $args, array( &$this, 'escape_by_ref' ) );
337+               array_walk( $args, array( $this, 'escape_by_ref' ) );
338                return @vsprintf( $query, $args );
339        }
340 
341Index: wp-includes/class-wp-walker.php
342===================================================================
343--- wp-includes/class-wp-walker.php     (revision 21801)
344+++ wp-includes/class-wp-walker.php     (working copy)
345@@ -126,7 +126,7 @@
346                if ( is_array( $args[0] ) )
347                        $args[0]['has_children'] = ! empty( $children_elements[$element->$id_field] );
348                $cb_args = array_merge( array(&$output, $element, $depth), $args);
349-               call_user_func_array(array(&$this, 'start_el'), $cb_args);
350+               call_user_func_array(array($this, 'start_el'), $cb_args);
351 
352                $id = $element->$id_field;
353 
354@@ -139,7 +139,7 @@
355                                        $newlevel = true;
356                                        //start the child delimiter
357                                        $cb_args = array_merge( array(&$output, $depth), $args);
358-                                       call_user_func_array(array(&$this, 'start_lvl'), $cb_args);
359+                                       call_user_func_array(array($this, 'start_lvl'), $cb_args);
360                                }
361                                $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
362                        }
363@@ -149,12 +149,12 @@
364                if ( isset($newlevel) && $newlevel ){
365                        //end the child delimiter
366                        $cb_args = array_merge( array(&$output, $depth), $args);
367-                       call_user_func_array(array(&$this, 'end_lvl'), $cb_args);
368+                       call_user_func_array(array($this, 'end_lvl'), $cb_args);
369                }
370 
371                //end this element
372                $cb_args = array_merge( array(&$output, $element, $depth), $args);
373-               call_user_func_array(array(&$this, 'end_el'), $cb_args);
374+               call_user_func_array(array($this, 'end_el'), $cb_args);
375        }
376 
377        /**
378Index: wp-includes/class-wp.php
379===================================================================
380--- wp-includes/class-wp.php    (revision 21801)
381+++ wp-includes/class-wp.php    (working copy)
382@@ -604,7 +604,7 @@
383         * @return string
384         */
385        function _map() {
386-               $callback = array(&$this, 'callback');
387+               $callback = array($this, 'callback');
388                return preg_replace_callback($this->_pattern, $callback, $this->_subject);
389        }
390 
391Index: wp-includes/capabilities.php
392===================================================================
393--- wp-includes/capabilities.php        (revision 21801)
394+++ wp-includes/capabilities.php        (working copy)
395@@ -725,7 +725,7 @@
396 
397                //Filter out caps that are not role names and assign to $this->roles
398                if ( is_array( $this->caps ) )
399-                       $this->roles = array_filter( array_keys( $this->caps ), array( &$wp_roles, 'is_role' ) );
400+                       $this->roles = array_filter( array_keys( $this->caps ), array( $wp_roles, 'is_role' ) );
401 
402                //Build $allcaps from role caps, overlay user's $caps
403                $this->allcaps = array();
404@@ -1317,7 +1317,7 @@
405        $args = array_slice( func_get_args(), 2 );
406        $args = array_merge( array( $capability ), $args );
407 
408-       return call_user_func_array( array( &$author, 'has_cap' ), $args );
409+       return call_user_func_array( array( $author, 'has_cap' ), $args );
410 }
411 
412 /**
413@@ -1339,7 +1339,7 @@
414        $args = array_slice( func_get_args(), 2 );
415        $args = array_merge( array( $capability ), $args );
416 
417-       return call_user_func_array( array( &$user, 'has_cap' ), $args );
418+       return call_user_func_array( array( $user, 'has_cap' ), $args );
419 }
420 
421 /**
422Index: wp-includes/class-oembed.php
423===================================================================
424--- wp-includes/class-oembed.php        (revision 21801)
425+++ wp-includes/class-oembed.php        (working copy)
426@@ -51,7 +51,7 @@
427                ) );
428 
429                // Fix any embeds that contain new lines in the middle of the HTML which breaks wpautop().
430-               add_filter( 'oembed_dataparse', array(&$this, '_strip_newlines'), 10, 3 );
431+               add_filter( 'oembed_dataparse', array($this, '_strip_newlines'), 10, 3 );
432        }
433 
434        /**
435Index: wp-includes/widgets.php
436===================================================================
437--- wp-includes/widgets.php     (revision 21801)
438+++ wp-includes/widgets.php     (working copy)
439@@ -152,15 +152,15 @@
440        }
441 
442        function _get_display_callback() {
443-               return array(&$this, 'display_callback');
444+               return array($this, 'display_callback');
445        }
446 
447        function _get_update_callback() {
448-               return array(&$this, 'update_callback');
449+               return array($this, 'update_callback');
450        }
451 
452        function _get_form_callback() {
453-               return array(&$this, 'form_callback');
454+               return array($this, 'form_callback');
455        }
456 
457        /** Generate the actual widget content.
458@@ -317,7 +317,7 @@
459        var $widgets = array();
460 
461        function WP_Widget_Factory() {
462-               add_action( 'widgets_init', array( &$this, '_register_widgets' ), 100 );
463+               add_action( 'widgets_init', array( $this, '_register_widgets' ), 100 );
464        }
465 
466        function register($widget_class) {
467Index: wp-includes/category-template.php
468===================================================================
469--- wp-includes/category-template.php   (revision 21801)
470+++ wp-includes/category-template.php   (working copy)
471@@ -41,7 +41,7 @@
472  */
473 function get_category_parents( $id, $link = false, $separator = '/', $nicename = false, $visited = array() ) {
474        $chain = '';
475-       $parent = &get_category( $id );
476+       $parent = get_category( $id );
477        if ( is_wp_error( $parent ) )
478                return $parent;
479 
480@@ -135,7 +135,7 @@
481  */
482 function get_the_category_by_ID( $cat_ID ) {
483        $cat_ID = (int) $cat_ID;
484-       $category = &get_category( $cat_ID );
485+       $category = get_category( $cat_ID );
486        if ( is_wp_error( $category ) )
487                return $category;
488        return $category->name;
489@@ -735,7 +735,7 @@
490        else
491                $walker = $args[2]['walker'];
492 
493-       return call_user_func_array(array( &$walker, 'walk' ), $args );
494+       return call_user_func_array(array( $walker, 'walk' ), $args );
495 }
496 
497 /**
498@@ -753,7 +753,7 @@
499        else
500                $walker = $args[2]['walker'];
501 
502-       return call_user_func_array(array( &$walker, 'walk' ), $args );
503+       return call_user_func_array(array( $walker, 'walk' ), $args );
504 }
505 
506 /**
507Index: wp-admin/includes/ajax-actions.php
508===================================================================
509--- wp-admin/includes/ajax-actions.php  (revision 21801)
510+++ wp-admin/includes/ajax-actions.php  (working copy)
511@@ -331,7 +331,7 @@
512                $term_id = $parent->term_id;
513 
514                while ( $parent->parent ) { // get the top parent
515-                       $parent = &get_term( $parent->parent, $taxonomy->name );
516+                       $parent = get_term( $parent->parent, $taxonomy->name );
517                        if ( is_wp_error( $parent ) )
518                                break;
519                        $term_id = $parent->term_id;