Skip to content

Commit

Permalink
Merge branch 'PHP-7.4'
Browse files Browse the repository at this point in the history
* PHP-7.4:
  Fix #77569: Write Acess Violation in DomImplementation
  • Loading branch information
cmb69 committed Feb 13, 2020
2 parents f3d8ac1 + bf8c651 commit a957e84
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ext/dom/document.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ int dom_document_encoding_write(dom_object *obj, zval *newval)
return FAILURE;
}

handler = xmlFindCharEncodingHandler(Z_STRVAL_P(newval));
handler = xmlFindCharEncodingHandler(ZSTR_VAL(str));

if (handler != NULL) {
xmlCharEncCloseFunc(handler);
Expand Down
14 changes: 14 additions & 0 deletions ext/dom/tests/bug77569.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--TEST--
Bug #77569 (Write Acess Violation in DomImplementation)
--SKIPIF--
<?php
if (!extension_loaded('dom')) die('skip dom extension not available');
?>
--FILE--
<?php
$imp = new DOMImplementation;
$dom = $imp->createDocument("", "");
$dom->encoding = null;
?>
--EXPECTF--
Warning: main(): Invalid Document Encoding in %s on line %d

0 comments on commit a957e84

Please sign in to comment.