[php-src] PR #11840: Fix json_encode result on DOMDocument

From: Date: Mon, 31 Jul 2023 16:14:17 +0000
Subject: [php-src] PR #11840: Fix json_encode result on DOMDocument
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-23217@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/11840 Author: nielsdos According to https://www.php.net/manual/en/class.domdocument: When using json_encode() on a DOMDocument object the result will be that of encoding an empty object. But this was broken in 8.1. The output was {"config": null}. That's because the config property is defined with a default value of NULL, hence it was included. The other properties are not included because they don't have a default property, and nothing is ever written to their backing field. Hence, the JSON encoder excludes them. Similarly, (array) $doc would yield the same config key in the array.

« previous php.git-pulls (#23217) next »