[wp-trac] [WordPress Trac] #64323: fetch_rss() uses incorrect function signature for XML `start_element_handler`

WordPress Trac noreply at wordpress.org
Sun Nov 30 19:08:39 UTC 2025


#64323: fetch_rss() uses incorrect function signature for XML
`start_element_handler`
--------------------------+-----------------------------
 Reporter:  avibrender    |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Feeds         |    Version:  trunk
 Severity:  minor         |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 We have a plugin that relies on `fetch_rss`, which uses MagpieRSS.  We
 found this warning in the logs


 {{{
 [30-Nov-2025 18:44:05 UTC] PHP Warning:  MagpieRSS::feed_start_element():
 Argument #3 ($attrs) must be passed by reference, value given in
 /path/to/web/wp-includes/rss.php on line 81
 }}}

 We tracked this warning down to
 https://github.com/WordPress/WordPress/blob/master/wp-
 includes/rss.php#L112:

 {{{
 function feed_start_element($p, $element, &$attrs) {
 }}}

 This is the `start_handler` that is passed to `xml_set_element_handler` at
 https://github.com/WordPress/WordPress/blob/master/wp-includes/rss.php#L78
 .

 However the PHP documentation at https://www.php.net/manual/en/function
 .xml-set-element-handler.php shows:

 "The signature of the handler must be:"

 {{{
 start_element_handler(XMLParser $parser, string $name, array $attributes):
 void
 }}}

 Perhaps the 3rd parameter of `feed_start_element` should be `$attrs`
 instead of `&$attrs` ?

 Thanks!

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


More information about the wp-trac mailing list