Skip to content
  • Alexander Nitsche's avatar
    [BUGFIX] Support parsing of XML files larger than 10 MB · 04791227
    Alexander Nitsche authored
    EXT:impexp may run into memory limits when converting XML to PHP
    arrays, even before all PHP memory is used up, because libxml has a
    specific limit of 10 MB. This limit can be turned off by using the
    `XML_PARSE_HUGE` (libxml) or `LIBXML_PARSEHUGE` (PHP) option, but
    only for the DOMDocument implementation of libxml, and not for the
    current XmlParser implementation.
    
    By replacing the XmlParser implementation with a DOMDocument
    implementation, larger XML files can be parsed with lower peak memory
    consumption as a side effect. For example, parsing a 4 MB dummy XML
    file consumes
    
    56.03 MB (memory) / 168.72 MB (memory peak)
    
    with the XmlParser, while using DOMDocument reduces the consumption to
    
    56.15 MB (memory) / 60.08 MB (memory peak).
    
    Besides the replacing of the implementation, XML parsing has been moved
    to separate classes (XmlEncoder / XmlDecoder), fully covered by tests,
    and restructured to reduce the number of required parameters to a
    minimum. The functional scope was not reduced in any way.
    
    Resolves: #83580
    Releases: main, 11.5
    Change-Id: Ic3345d539f028d766b49d01096ec34a6190a6dfe
    04791227