Skip to content

Commit 6c4528e

Browse files
committed
Merge branch 'PHP-7.3'
* PHP-7.3: Fixed bug #76777 and added test
2 parents fc8d6b6 + 138671f commit 6c4528e

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

ext/libxml/libxml.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -589,12 +589,12 @@ static xmlParserInputPtr _php_libxml_external_entity_loader(const char *URL,
589589
if (ID != NULL) {
590590
ZVAL_STRING(&params[0], ID);
591591
} else {
592-
ZVAL_UNDEF(&params[0]);
592+
ZVAL_NULL(&params[0]);
593593
}
594594
if (URL != NULL) {
595595
ZVAL_STRING(&params[1], URL);
596596
} else {
597-
ZVAL_UNDEF(&params[1]);
597+
ZVAL_NULL(&params[1]);
598598
}
599599
ctxzv = &params[2];
600600
array_init_size(ctxzv, 4);

ext/libxml/tests/bug76777.phpt

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
--TEST--
2+
Bug #76777 (first parameter of libxml_set_external_entity_loader callback undefined)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('libxml')) die('skip');
6+
if (getenv("SKIP_ONLINE_TESTS")) die('skip online test');
7+
?>
8+
--FILE--
9+
<?php
10+
$xml=<<<EOF
11+
<?xml version="1.0"?>
12+
<test/>
13+
EOF;
14+
15+
$xsd=<<<EOF
16+
<?xml version="1.0"?>
17+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
18+
<xs:include schemaLocation="nonexistent.xsd"/>
19+
<xs:element name="test"/>
20+
</xs:schema>
21+
EOF;
22+
23+
libxml_set_external_entity_loader(function($p,$s,$c) {
24+
var_dump($p,$s,$c);
25+
die();
26+
});
27+
28+
$dom=new DOMDocument($xml);
29+
$dom->schemaValidateSource($xsd);
30+
?>
31+
--EXPECTF--
32+
NULL
33+
string(15) "nonexistent.xsd"
34+
array(4) {
35+
["directory"]=>
36+
NULL
37+
["intSubName"]=>
38+
NULL
39+
["extSubURI"]=>
40+
NULL
41+
["extSubSystem"]=>
42+
NULL
43+
}

0 commit comments

Comments
 (0)