easyrdf icon indicating copy to clipboard operation
easyrdf copied to clipboard

initXMLParser method breaks in recent php

Open renanrodrigo opened this issue 4 months ago • 0 comments

The initXMLParser function breaks when building with php8.4 and libxml2 v14+

PHP Fatal error: Uncaught ValueError: xml_set_element_handler(): Argument #2 ($start_handler) an object must be set via xml_set_object() to be able to lookup method in /<<PKGBUILDDIR>>/lib/Parser/RdfXml.php:90
Stack trace:
#0 /<<PKGBUILDDIR>>/lib/Parser/RdfXml.php(90): xml_set_element_handler()
#1 /<<PKGBUILDDIR>>/lib/Parser/RdfXml.php(799): EasyRdf\Parser\RdfXml->initXMLParser()
#2 /<<PKGBUILDDIR>>/lib/Graph.php(245): EasyRdf\Parser\RdfXml->parse()
#3 /<<PKGBUILDDIR>>/lib/Graph.php(370): EasyRdf\Graph->parse()
#4 /<<PKGBUILDDIR>>/debian/tests/test.php(15): EasyRdf\Graph->load()
#5 {main}
  thrown in /<<PKGBUILDDIR>>/lib/Parser/RdfXml.php on line 90

This is related to newer PHP (+ newer libxml) not recognizing the methods referenced in the handle setter, because it's missing the set_object call later.

The call exists in the same method a couple lines below. Bringing it up should fix this issue.

Bug found when building in:

  • Debian: https://bugs.debian.org/1082446
  • Ubuntu: https://bugs.launchpad.net/bugs/2125671

renanrodrigo avatar Sep 25 '25 13:09 renanrodrigo