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

Generators: add tests for handling <standard> element + use consistent encoding cross-PHP #717

Merged
merged 2 commits into from
Nov 23, 2024

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Nov 23, 2024

Description

Generators: add tests for handling element

This adds dedicated tests for specific issues which can be encountered in a <standard> XML element.

This initial set of tests for this documents the current behaviour. This behaviour may not always be the desired behaviour, in which case, this will be fixed in follow-up commits.

Generators HTML/Markdown: consistent encoding cross-PHP

The default value for the $flags parameter of the htmlspecialchars() function changed in PHP 8.1.0.
Previously, the default was ENT_COMPAT. Now the default is ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401.

The most notable differences are:

  • Single quotes will be encoded.
  • Invalid code unit sequences will be replace by a Unicode Replacement Character.

For consistent output cross-version PHP, it is advised to always explicitly pass the $flags parameter` and not rely on the default value.

Fixed now and using the new $flags default value as the parameter value.

This commit allows for the tests to have the same output expectations cross-version PHP. For end-users, the differences shouldn't have been noticeable.

Suggested changelog entry

N/A

Related issues/external references

This PR is part of a series of PRs which will add a complete set of tests for the Generator feature.

Related to #146

This adds dedicated tests for specific issues which can be encountered in a `<standard>` XML element.

This initial set of tests for this documents the current behaviour. This behaviour may not always be the desired behaviour, in which case, this will be fixed in follow-up commits.
The default value for the `$flags` parameter of the `htmlspecialchars()` function changed in PHP 8.1.0.
Previously, the default was `ENT_COMPAT`. Now the default is `ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401`.

The most notable differences are:
* Single quotes will be encoded.
* Invalid code unit sequences will be replace by a Unicode Replacement Character.

For consistent output cross-version PHP, it is advised to always explicitly pass the `$flags` parameter` and not rely on the default value.

Fixed now and using the _new_ `$flags` default value as the parameter value.

This commit allows for the tests to have the same output expectations cross-version PHP. For end-users, the differences shouldn't have been noticeable.
@jrfnl jrfnl added this to the 3.11.2 milestone Nov 23, 2024
@jrfnl jrfnl merged commit a2de7e1 into master Nov 23, 2024
72 checks passed
@jrfnl jrfnl deleted the feature/generators-add-tests-standard-elements branch November 23, 2024 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant