Skip to content

Commit 8ebadd1

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fix #77569: Write Acess Violation in DomImplementation
2 parents 7b464ce + cec8b24 commit 8ebadd1

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ PHP NEWS
99
x86). (cmb)
1010
. Fixed bug #79248 (Traversing empty VT_ARRAY throws com_exception). (cmb)
1111

12+
- DOM:
13+
. Fixed bug #77569: (Write Acess Violation in DomImplementation). (Nikita,
14+
cmb)
15+
1216
- PCRE:
1317
. Fixed bug #79188 (Memory corruption in preg_replace/preg_replace_callback
1418
and unicode). (Nikita)

ext/dom/document.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ int dom_document_encoding_write(dom_object *obj, zval *newval)
339339

340340
str = zval_get_string(newval);
341341

342-
handler = xmlFindCharEncodingHandler(Z_STRVAL_P(newval));
342+
handler = xmlFindCharEncodingHandler(ZSTR_VAL(str));
343343

344344
if (handler != NULL) {
345345
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)