Merge branch 'PHP-8.1' into PHP-8.2

* PHP-8.1:
  Fix json_encode result on DOMDocument
This commit is contained in:
Niels Dossche 2023-08-01 17:31:55 +02:00
commit 82eda28616
5 changed files with 17 additions and 5 deletions

1
NEWS
View file

@ -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)

View file

@ -668,7 +668,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: 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);

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 (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"]=>