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

IdnaEncoder::encode(): add input validation #592

Merged
merged 1 commit into from
Nov 8, 2021

Commits on Nov 6, 2021

  1. IdnaEncoder::encode(): add input validation

    The `IdnaEncoder::encode()` is the official entry point for this class, even though there are more public methods (of which it is questionable whether they should be public, but changing that now would be a BC-break).
    
    The documented accepted parameter type is `string`, but no input validation was done on the parameter, which could lead to various PHP errors, most notably a "passing null to non-nullable" deprecation notice on PHP 8.1.
    
    This commit adds input validation to the `IdnaEncoder::encode()` method, allowing only for strings and _stringable_ objects.
    
    While this is stricter than previously, only a string could result in a valid return value, so in my opinion, being strict is warranted.
    
    Includes adding perfunctory tests for the new exception.
    jrfnl committed Nov 6, 2021
    Configuration menu
    Copy the full SHA
    fe4bce1 View commit details
    Browse the repository at this point in the history