Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix json_encode result on DOMDocument #11840

Closed
wants to merge 2 commits into from
Closed

Commits on Jul 31, 2023

  1. Fix json_encode result on DOMDocument

    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.
    nielsdos committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    9e03423 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6d45369 View commit details
    Browse the repository at this point in the history