Skip to content

v4.0.0

Latest

Choose a tag to compare

@tomas-novotny tomas-novotny released this 04 Nov 19:55
· 1 commit to main since this release

Added

  • Breaking: Added withNamespaces parameter to Reader::nextNode
  • Added ReaderException for Reader and ReaderFactory errors
  • Documented XPath, errors, limitations and upgrading from 3.x in README

Changed

  • Breaking: Threw ReaderException instead of \Exception for Reader and ReaderFactory errors
  • Breaking: Threw \DOMException and ReaderException without the PHP error level as exception code
  • Breaking: Changed Node::getTextContent return type to string
  • Breaking: Marked Handler as internal
  • Breaking: Threw \DOMException instead of emitting warnings for invalid Node::addXMLData content
  • Breaking: Returned list of added nodes from Node::addXMLData instead of the emptied fragment node
  • Breaking: Threw \DOMException from Node::xpath on attribute, text and other nodes that are not document or element
  • Breaking: Threw \DOMException instead of emitting warnings and returning null for an invalid Node::xpath expression, so Node::xpath always returns a list
  • Breaking: Threw \DOMException from Node::xpath on a node with undeclared namespace prefixes, such as a node read without namespaces
  • Checked results of DOM and \XMLReader methods through Handler::checkResultForDOMDocument and Handler::checkResultForXMLReader
  • Breaking: Read nodes with \XMLReader::expand(), keeping text, CDATA sections and mixed content order as in the source, about three times faster
  • Breaking: Threw \InvalidArgumentException for element and attribute values that are not null, scalar or \Stringable instead of writing an empty value
  • Breaking: Joined all text of an element in Node::toArray instead of keeping only its last text node
  • Breaking: Threw \DOMException from Node::xpath when the expression returns the document node
  • Required ext-libxml
  • Breaking: Cast only numbers whose value survives the cast with autoCast, keeping values like 0123, 1e3, integers over PHP_INT_MAX or decimals with more than 15 significant digits as strings
  • Breaking: Copied Node::addElementFromNode and Node::createElementFromNode with \DOMDocument::importNode, converting text to CDATA only with forcedEscape
  • Breaking: Required inspirum/arrayable ^2.0
  • Switched CI to the shared inspirum/.github workflow
  • Renamed the default branch from master to main

Removed

  • Breaking: Removed Formatter::namespacesToAttributes
  • Removed local issue and pull request templates, code of conduct and contributing guide in favour of the shared inspirum/.github defaults

Fixed

  • Fixed element name validation for non-ASCII names
  • Breaking: Fixed FlattenConfig with withoutRoot on a node
  • Breaking: Fixed DocumentFactory::createForFile and DocumentFactory::createForContent ignoring version and encoding
  • Fixed Node::addElementFromNode and Node::createElementFromNode losing comments, processing instructions, mixed content order and namespace declarations
  • Fixed Node::toArray including comments and processing instructions as keys
  • Fixed Reader keeping only the last text of an element with mixed content and moving it before child elements
  • Fixed Node::toString and Document::save leaving formatOutput changed on the document
  • Fixed Reader with withNamespaces giving nodes after the first one namespaces from outside their scope
  • Fixed Reader with withNamespaces binding a prefix redeclared inside the node to the outer or a sibling namespace
  • Fixed Reader emitting warnings and returning no node instead of throwing ReaderException for malformed content skipped by a path
  • Fixed Node::xpath on a node of an XML 1.1 document
  • Fixed Node::xpath on a node with namespaces declared on its ancestors
  • Fixed Handler bypassing the application error handler for warnings that are not from DOM or \XMLReader
  • Fixed outdated and broken examples in README