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

WordPress Trac noreply at wordpress.org
Mon Dec 1 05:47:45 UTC 2025


#64323: fetch_rss() uses incorrect function signature for XML
`start_element_handler`
-------------------------------+------------------------------
 Reporter:  avibrender         |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  low                |   Milestone:  Awaiting Review
Component:  Feeds              |     Version:
 Severity:  minor              |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------

Old description:

> 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!

New description:

 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-
 develop/blob/d676a07f9242d98f8d28c4d0064543a58560e304/src/wp-
 includes/rss.php#L112 `feed_start_element` on line 112] :

 {{{
 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-
 develop/blob/d676a07f9242d98f8d28c4d0064543a58560e304/src/wp-
 includes/rss.php#L77-L78 line 78] .

 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!

--

Comment (by sabernhardt):

 > Since MagpieRSS has been deprecated for a long time (since WP v3.0)

 Related: #57107

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


More information about the wp-trac mailing list