Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix GH-13517: Multiple test failures when building with --with-expat
The reflection failure is because the XML extension is used to check the module dependency information, but that extension can be configured to not depend on ext/libxml, resulting in a different output. The solution is to check another extension instead. The test failures in ext/xml/tests are because of different behaviour between libxml2 and Expat error handling. These are expected differences and the solution is to split the tests. Closes GH-13522.
- Loading branch information
Showing
15 changed files
with
209 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
--TEST-- | ||
ReflectionExtension::getDependencies() | ||
--EXTENSIONS-- | ||
xml | ||
dom | ||
--FILE-- | ||
<?php | ||
$ext = new ReflectionExtension("xml"); | ||
$ext = new ReflectionExtension("dom"); | ||
$deps = $ext->getDependencies(); | ||
var_dump($deps); | ||
?> | ||
--EXPECT-- | ||
array(1) { | ||
array(2) { | ||
["libxml"]=> | ||
string(8) "Required" | ||
["domxml"]=> | ||
string(9) "Conflicts" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
/* | ||
this test has different output on libxml2 (even depending on the version) and Expat | ||
further investigation has shown that not only line count | ||
is skippet on CDATA sections but that libxml does also | ||
show different column numbers and byte positions depending | ||
on context and in opposition to what one would expect to | ||
see and what good old Expat reported just fine ... | ||
*/ | ||
|
||
$xmls = array(); | ||
|
||
// Case 1: CDATA Sections | ||
$xmls["CDATA"] ='<?xml version="1.0" encoding="iso-8859-1" ?> | ||
<data> | ||
<![CDATA[ | ||
multi | ||
line | ||
CDATA | ||
block | ||
]]> | ||
</data>'; | ||
|
||
// Case 2: replace some characters so that we get comments instead | ||
$xmls["Comment"] ='<?xml version="1.0" encoding="iso-8859-1" ?> | ||
<data> | ||
<!-- ATA[ | ||
multi | ||
line | ||
CDATA | ||
block | ||
--> | ||
</data>'; | ||
|
||
// Case 3: replace even more characters so that only textual data is left | ||
$xmls["Text"] ='<?xml version="1.0" encoding="iso-8859-1" ?> | ||
<data> | ||
-!-- ATA[ | ||
multi | ||
line | ||
CDATA | ||
block | ||
--- | ||
</data>'; | ||
|
||
function startElement($parser, $name, $attrs) { | ||
printf("<$name> at line %d, col %d (byte %d)\n", | ||
xml_get_current_line_number($parser), | ||
xml_get_current_column_number($parser), | ||
xml_get_current_byte_index($parser)); | ||
} | ||
|
||
function endElement($parser, $name) { | ||
printf("</$name> at line %d, col %d (byte %d)\n", | ||
xml_get_current_line_number($parser), | ||
xml_get_current_column_number($parser), | ||
xml_get_current_byte_index($parser)); | ||
} | ||
|
||
function characterData($parser, $data) { | ||
// dummy | ||
} | ||
|
||
foreach ($xmls as $desc => $xml) { | ||
echo "$desc\n"; | ||
$xml_parser = xml_parser_create(); | ||
xml_set_element_handler($xml_parser, "startElement", "endElement"); | ||
xml_set_character_data_handler($xml_parser, "characterData"); | ||
if (!xml_parse($xml_parser, $xml, true)) | ||
echo "Error: ".xml_error_string(xml_get_error_code($xml_parser))."\n"; | ||
xml_parser_free($xml_parser); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.