[wp-trac] [WordPress Trac] #47920: PHP Warning: Parameter 2 to qtranxf_postsFilter() expected to be a reference

WordPress Trac noreply at wordpress.org
Thu Aug 22 10:47:26 UTC 2019


#47920: PHP Warning:  Parameter 2 to qtranxf_postsFilter() expected to be a
reference
------------------------------+-----------------------------
 Reporter:  blew2             |      Owner:  (none)
     Type:  feature request   |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  General           |    Version:  5.2.2
 Severity:  minor             |   Keywords:
  Focuses:  coding-standards  |
------------------------------+-----------------------------
 Not sure this should be called a bug but

 ubuntu 18.04 apache error.log complains about

 "PHP Warning:  Parameter 2 to qtranxf_postsFilter() expected to be a
 reference, value given in [..]/wp-includes/class-wp-hook.php on line 286"

 php version: 7.2

 changing: public function apply_filters( $value, $args )
 to public function apply_filters( $value, &$args )

 silenced the log

 Clearly this has to do with qTranslate-X plugin.

 Is it a bad idea to pass $args as a reference in function_apply_filters,
 or maybe the plugin creators should change their code to avoid modifying
 data in passed references?

 qtranslate_frontend.php has this definition:

 function qtranxf_postsFilter($posts,&$query)

 and the query is modified inside of the function.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47920>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list