diff options
| author | Christoph M. Becker <cmbecker69@gmx.de> | 2018-08-22 12:52:11 +0200 | 
|---|---|---|
| committer | Christoph M. Becker <cmbecker69@gmx.de> | 2018-08-22 12:52:41 +0200 | 
| commit | 7ad05957120ad2c8ee9471aabeceb5d7fa559e5f (patch) | |
| tree | f36891e1365375dbe9392adcb8ba8e993f4c5108 | |
| parent | 73a8f7261720067dbec913487039ccde0fb1deb6 (diff) | |
| parent | cf2fc66b0289dc7a34a0d9c0e67bccb8e97472bd (diff) | |
| download | php-git-7ad05957120ad2c8ee9471aabeceb5d7fa559e5f.tar.gz | |
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #76777 and added test
| -rw-r--r-- | NEWS | 4 | ||||
| -rw-r--r-- | ext/libxml/libxml.c | 4 | ||||
| -rw-r--r-- | ext/libxml/tests/bug76777.phpt | 43 | 
3 files changed, 49 insertions, 2 deletions
| @@ -17,6 +17,10 @@ PHP                                                                        NEWS    . Fixed bug #74484 (MessageFormatter::formatMessage memory corruption with      11+ named placeholders). (Anatol) +- libxml: +  . Fixed bug #76777 ("public id" parameter of libxml_set_external_entity_loader +    callback undefined). (Ville Hukkamäki) +  - mbstring:    . Fixed bug #76704 (mb_detect_order return value varies based on argument      type). (cmb) diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index c2fe822455..068b3a248d 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -591,12 +591,12 @@ static xmlParserInputPtr _php_libxml_external_entity_loader(const char *URL,  	if (ID != NULL) {  		ZVAL_STRING(¶ms[0], ID);  	} else { -		ZVAL_UNDEF(¶ms[0]); +		ZVAL_NULL(¶ms[0]);  	}  	if (URL != NULL) {  		ZVAL_STRING(¶ms[1], URL);  	} else { -		ZVAL_UNDEF(¶ms[1]); +		ZVAL_NULL(¶ms[1]);  	}  	ctxzv = ¶ms[2];  	array_init_size(ctxzv, 4); diff --git a/ext/libxml/tests/bug76777.phpt b/ext/libxml/tests/bug76777.phpt new file mode 100644 index 0000000000..ba9fd698e0 --- /dev/null +++ b/ext/libxml/tests/bug76777.phpt @@ -0,0 +1,43 @@ +--TEST-- +Bug #76777 (first parameter of libxml_set_external_entity_loader callback undefined) +--SKIPIF-- +<?php +if (!extension_loaded('libxml')) die('skip'); +if (getenv("SKIP_ONLINE_TESTS")) die('skip online test'); +?> +--FILE-- +<?php +$xml=<<<EOF +<?xml version="1.0"?> +<test/> +EOF; + +$xsd=<<<EOF +<?xml version="1.0"?> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> +  <xs:include schemaLocation="nonexistent.xsd"/> +  <xs:element name="test"/> +</xs:schema> +EOF; + +libxml_set_external_entity_loader(function($p,$s,$c) { +    var_dump($p,$s,$c); +    die(); +}); + +$dom=new DOMDocument($xml); +$dom->schemaValidateSource($xsd); +?> +--EXPECTF-- +NULL +string(15) "nonexistent.xsd" +array(4) { +  ["directory"]=> +  NULL +  ["intSubName"]=> +  NULL +  ["extSubURI"]=> +  NULL +  ["extSubSystem"]=> +  NULL +} | 
