Skip to content

Commit bf8c651

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #77569: Write Acess Violation in DomImplementation
2 parents 61e7692 + 8ebadd1 commit bf8c651

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
@@ -17,6 +17,10 @@ PHP NEWS
1717
- CURL:
1818
. Fixed bug #79019 (Copied cURL handles upload empty file). (cmb)
1919

20+
- DOM:
21+
. Fixed bug #77569: (Write Acess Violation in DomImplementation). (Nikita,
22+
cmb)
23+
2024
- PCRE:
2125
. Fixed bug #79188 (Memory corruption in preg_replace/preg_replace_callback
2226
and unicode). (Nikita)

ext/dom/document.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ int dom_document_encoding_write(dom_object *obj, zval *newval)
342342
return FAILURE;
343343
}
344344

345-
handler = xmlFindCharEncodingHandler(Z_STRVAL_P(newval));
345+
handler = xmlFindCharEncodingHandler(ZSTR_VAL(str));
346346

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