[BUGFIX] Support parsing of XML files larger than 10 MB
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 (Typo3XmlSerializer / Typo3XmlParser), 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 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/78249 Tested-by:core-ci <typo3@b13.com> Tested-by:
Andreas Fernandez <a.fernandez@scripting-base.de> Reviewed-by:
Andreas Fernandez <a.fernandez@scripting-base.de>
Showing
- Build/phpstan/phpstan-baseline.neon 5 additions, 0 deletionsBuild/phpstan/phpstan-baseline.neon
- typo3/sysext/core/Classes/Serializer/Exception/InvalidDataException.php 27 additions, 0 deletions...ore/Classes/Serializer/Exception/InvalidDataException.php
- typo3/sysext/core/Classes/Serializer/Typo3XmlParser.php 253 additions, 0 deletionstypo3/sysext/core/Classes/Serializer/Typo3XmlParser.php
- typo3/sysext/core/Classes/Serializer/Typo3XmlParserOptions.php 74 additions, 0 deletions.../sysext/core/Classes/Serializer/Typo3XmlParserOptions.php
- typo3/sysext/core/Classes/Serializer/Typo3XmlSerializer.php 340 additions, 0 deletionstypo3/sysext/core/Classes/Serializer/Typo3XmlSerializer.php
- typo3/sysext/core/Classes/Serializer/Typo3XmlSerializerOptions.php 79 additions, 0 deletions...ext/core/Classes/Serializer/Typo3XmlSerializerOptions.php
- typo3/sysext/core/Tests/Unit/Serializer/Fixtures/file.gif 0 additions, 0 deletionstypo3/sysext/core/Tests/Unit/Serializer/Fixtures/file.gif
- typo3/sysext/core/Tests/Unit/Serializer/Typo3XmlParserTest.php 659 additions, 0 deletions.../sysext/core/Tests/Unit/Serializer/Typo3XmlParserTest.php
- typo3/sysext/core/Tests/Unit/Serializer/Typo3XmlSerializerTest.php 522 additions, 0 deletions...ext/core/Tests/Unit/Serializer/Typo3XmlSerializerTest.php
- typo3/sysext/impexp/Classes/Export.php 7 additions, 1 deletiontypo3/sysext/impexp/Classes/Export.php
- typo3/sysext/impexp/Classes/Import.php 47 additions, 22 deletionstypo3/sysext/impexp/Classes/Import.php
Please register or sign in to comment