Merge branch 'PHP-8.2'

* PHP-8.2:
  Fix json_encode result on DOMDocument
This commit is contained in:
Niels Dossche 2023-08-01 17:35:10 +02:00
commit 8874384921
4 changed files with 16 additions and 5 deletions

View File

@ -707,7 +707,7 @@ class DOMDocument extends DOMNode implements DOMParentNode
* @readonly
* @deprecated
*/
public mixed $config = null;
public mixed $config;
public bool $formatOutput;

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 8bfa8e742552be6f1fb85593dcab2e755f1d5089 */
* Stub hash: ebe9bcbd185e1973b5447beb306bd9d93051f415 */
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)
@ -1581,7 +1581,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);

View File

@ -0,0 +1,11 @@
--TEST--
JSON encoding a DOMDocument
--EXTENSIONS--
dom
--FILE--
<?php
$doc = new DOMDocument;
echo json_encode($doc);
?>
--EXPECT--
{}

View File

@ -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 (41) {
["config"]=>
NULL
["dynamicProperty"]=>
object(stdClass)#2 (0) {
}
@ -46,6 +44,8 @@ object(DOMDocument)#1 (41) {
bool(true)
["documentURI"]=>
string(%d) %s
["config"]=>
NULL
["formatOutput"]=>
bool(false)
["validateOnParse"]=>