Skip to content

Commit 9a337a8

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Fix GH-14834: Error installing PHP when --with-pear is used
2 parents a1bcaf0 + 67259e4 commit 9a337a8

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ PHP NEWS
4646

4747
- XML:
4848
. Move away from to-be-deprecated libxml fields. (nielsdos)
49+
. Fixed bug GH-14834 (Error installing PHP when --with-pear is used).
50+
(nielsdos)
4951

5052
20 Jun 2024, PHP 8.3.9
5153

ext/xml/compat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ _get_entity(void *user, const xmlChar *name)
375375
if (ret == NULL)
376376
ret = xmlGetDocEntity(parser->parser->myDoc, name);
377377

378-
if (ret == NULL || (parser->parser->instate != XML_PARSER_ENTITY_VALUE && parser->parser->instate != XML_PARSER_ATTRIBUTE_VALUE)) {
378+
if (ret == NULL || parser->parser->instate == XML_PARSER_CONTENT) {
379379
if (ret == NULL || ret->etype == XML_INTERNAL_GENERAL_ENTITY || ret->etype == XML_INTERNAL_PARAMETER_ENTITY || ret->etype == XML_INTERNAL_PREDEFINED_ENTITY) {
380380
/* Predefined entities will expand unless no cdata handler is present */
381381
if (parser->h_default && ! (ret && ret->etype == XML_INTERNAL_PREDEFINED_ENTITY && parser->h_cdata)) {

ext/xml/tests/gh14834.phpt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
--TEST--
2+
GH-14834 (Error installing PHP when --with-pear is used)
3+
--EXTENSIONS--
4+
xml
5+
--FILE--
6+
<?php
7+
$xml = <<<XML
8+
<?xml version="1.0" encoding="UTF-8"?>
9+
<!DOCTYPE root [
10+
<!ENTITY foo "ent">
11+
]>
12+
<root>
13+
<element hint="hello&apos;world">&foo;<![CDATA[ &amp; ]]><?x &amp; ?></element>
14+
</root>
15+
XML;
16+
17+
$parser = xml_parser_create();
18+
xml_set_character_data_handler($parser, function($_, $data) {
19+
var_dump($data);
20+
});
21+
xml_parse($parser, $xml, true);
22+
?>
23+
--EXPECT--
24+
string(3) "
25+
"
26+
string(3) "ent"
27+
string(7) " &amp; "
28+
string(1) "
29+
"

0 commit comments

Comments
 (0)