diff --git a/NEWS b/NEWS index 197f59b626a..f1e3dfff6c7 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,7 @@ PHP NEWS . Fix empty argument cases for DOMParentNode methods. (nielsdos) . Fixed bug GH-11791 (Wrong default value of DOMDocument::xmlStandalone). (nielsdos) + . Fix json_encode result on DOMDocument. (nielsdos) - FFI: . Fix leaking definitions when using FFI::cdef()->new(...). (ilutov) diff --git a/ext/dom/php_dom.stub.php b/ext/dom/php_dom.stub.php index 2f26067d1ea..1c3d26cf0b0 100644 --- a/ext/dom/php_dom.stub.php +++ b/ext/dom/php_dom.stub.php @@ -668,7 +668,7 @@ class DOMDocument extends DOMNode implements DOMParentNode * @readonly * @deprecated */ - public mixed $config = null; + public mixed $config; public bool $formatOutput; diff --git a/ext/dom/php_dom_arginfo.h b/ext/dom/php_dom_arginfo.h index d7c6c4496e9..f8f2e5c4b28 100644 --- a/ext/dom/php_dom_arginfo.h +++ b/ext/dom/php_dom_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 4570a3d2e6a74946b0f12353b1136922a2e77072 */ + * Stub hash: 23aa0e35aff077f4a5fba1a6563bb806b3397d29 */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_dom_import_simplexml, 0, 1, DOMElement, 0) ZEND_ARG_TYPE_INFO(0, node, IS_OBJECT, 0) @@ -1480,7 +1480,7 @@ static zend_class_entry *register_class_DOMDocument(zend_class_entry *class_entr zend_string_release(property_documentURI_name); zval property_config_default_value; - ZVAL_NULL(&property_config_default_value); + ZVAL_UNDEF(&property_config_default_value); zend_string *property_config_name = zend_string_init("config", sizeof("config") - 1, 1); zend_declare_typed_property(class_entry, property_config_name, &property_config_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ANY)); zend_string_release(property_config_name); diff --git a/ext/dom/tests/DOMDocument_json_encode.phpt b/ext/dom/tests/DOMDocument_json_encode.phpt new file mode 100644 index 00000000000..ed85ab4f210 --- /dev/null +++ b/ext/dom/tests/DOMDocument_json_encode.phpt @@ -0,0 +1,11 @@ +--TEST-- +JSON encoding a DOMDocument +--EXTENSIONS-- +dom +--FILE-- + +--EXPECT-- +{} diff --git a/ext/dom/tests/domobject_debug_handler.phpt b/ext/dom/tests/domobject_debug_handler.phpt index 5966a27493f..dca787f2b6c 100644 --- a/ext/dom/tests/domobject_debug_handler.phpt +++ b/ext/dom/tests/domobject_debug_handler.phpt @@ -17,8 +17,6 @@ var_dump($d); --EXPECTF-- Deprecated: Creation of dynamic property DOMDocument::$dynamicProperty is deprecated in %s on line %d object(DOMDocument)#1 (39) { - ["config"]=> - NULL ["dynamicProperty"]=> object(stdClass)#2 (0) { } @@ -46,6 +44,8 @@ object(DOMDocument)#1 (39) { bool(true) ["documentURI"]=> string(%d) %s + ["config"]=> + NULL ["formatOutput"]=> bool(false) ["validateOnParse"]=>