summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-02-13 15:17:25 +0100
committerChristoph M. Becker <cmbecker69@gmx.de>2020-02-13 15:17:25 +0100
commita957e84c58d870a3975e51642517d35031ad29d1 (patch)
tree0db34ce2440d610b58e0312aa12d1bed8f553521 /ext
parentf3d8ac1d954d4104eebb2ac2d94c46f23e2ab5da (diff)
parentbf8c6519fb7f13462cf902b0d17a02c50f6851c7 (diff)
downloadphp-git-a957e84c58d870a3975e51642517d35031ad29d1.tar.gz
Merge branch 'PHP-7.4'
* PHP-7.4: Fix #77569: Write Acess Violation in DomImplementation
Diffstat (limited to 'ext')
-rw-r--r--ext/dom/document.c2
-rw-r--r--ext/dom/tests/bug77569.phpt14
2 files changed, 15 insertions, 1 deletions
diff --git a/ext/dom/document.c b/ext/dom/document.c
index 473593e8a7..5b227f9393 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.c
@@ -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);
diff --git a/ext/dom/tests/bug77569.phpt b/ext/dom/tests/bug77569.phpt
new file mode 100644
index 0000000000..f0f3566708
--- /dev/null
+++ b/ext/dom/tests/bug77569.phpt
@@ -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