Skip to content

Add handling for undefined rulesets - #309

Merged
florianeckerstorfer merged 1 commit into
cocur:mainfrom
aadmathijssen:fix/add-handling-for-undefined-rulesets
Jun 20, 2022
Merged

florianeckerstorfer merged 1 commit into
cocur:mainfrom
aadmathijssen:fix/add-handling-for-undefined-rulesets

Conversation

@aadmathijssen

Copy link
Copy Markdown
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
Copy Markdown
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.

2 participants