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

Add handling for undefined rulesets #309

Conversation

aadmathijssen
Copy link
Contributor

When supplying the ruleset option with an unknown ruleset to \Cocur\Slugify\Slugify::__construct, the following error occurs:

Notice: Undefined index: foo in /path/to/vendor/cocur/slugify/src/RuleProvider/DefaultRuleProvider.php on line 8616
PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Cocur\Slugify\Slugify::addRules() must be of the type array, null given, called in /path/to/vendor/cocur/slugify/src/Slugify.php on line 178 and defined in /path/to/vendor/cocur/slugify/src/Slugify.php:162

This PR detects this and throws and OutOfBoundsException instead.

When supplying the 'ruleset' option with an unknown ruleset to \Cocur\Slugify\Slugify::__construct, the following error occurs:

    Notice: Undefined index: foo in /path/to/vendor/cocur/slugify/src/RuleProvider/DefaultRuleProvider.php on line 8616
    PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Cocur\Slugify\Slugify::addRules() must be of the type array, null given, called in /path/to/vendor/cocur/slugify/src/Slugify.php on line 178 and defined in /path/to/vendor/cocur/slugify/src/Slugify.php:162

This PR detects this and throws and OutOfBoundsException instead.
@florianeckerstorfer florianeckerstorfer merged commit c8c58a2 into cocur:main Jun 20, 2022
@florianeckerstorfer
Copy link
Member

@aadmathijssen Thank you very much for the PR 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants