Skip to content

Commit a957e84

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Fix #77569: Write Acess Violation in DomImplementation
2 parents f3d8ac1 + bf8c651 commit a957e84

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

ext/dom/document.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ int dom_document_encoding_write(dom_object *obj, zval *newval)
194194
return FAILURE;
195195
}
196196

197-
handler = xmlFindCharEncodingHandler(Z_STRVAL_P(newval));
197+
handler = xmlFindCharEncodingHandler(ZSTR_VAL(str));
198198

199199
if (handler != NULL) {
200200
xmlCharEncCloseFunc(handler);

ext/dom/tests/bug77569.phpt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
Bug #77569 (Write Acess Violation in DomImplementation)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('dom')) die('skip dom extension not available');
6+
?>
7+
--FILE--
8+
<?php
9+
$imp = new DOMImplementation;
10+
$dom = $imp->createDocument("", "");
11+
$dom->encoding = null;
12+
?>
13+
--EXPECTF--
14+
Warning: main(): Invalid Document Encoding in %s on line %d

0 commit comments

Comments
 (0)