[wp-trac] [WordPress Trac] #49700: IXR_Message XML parsing leaks memory in PHP 7.0.0 and above

WordPress Trac noreply at wordpress.org
Wed Mar 25 17:45:31 UTC 2020


#49700: IXR_Message XML parsing leaks memory in PHP 7.0.0 and above
--------------------------+-----------------------------
 Reporter:  procifer      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  XML-RPC       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 `IXR_Message` uses the `xml_parser_free` function after it has parsed an
 XML RPC response.  However, as of PHP 7.0.0, it's also necessary to
 explicitly `unset` the reference to the parser to avoid memory leaks:
 https://www.php.net/manual/en/function.xml-parser-free.php

 I'm including a patch that adds an `unset` after the parser is freed, and
 also adds a `xml_parser_free`/`unset` pair before returning early when the
 parser fails.

 I also see other uses of `xml_parser_free` in a quick search of the
 codebase, so might be good for someone with more knowledge than me to
 review those as well.

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


More information about the wp-trac mailing list