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

TagFilter not checking for empty string #250

Closed
magikid opened this issue Apr 26, 2022 · 0 comments
Closed

TagFilter not checking for empty string #250

magikid opened this issue Apr 26, 2022 · 0 comments

Comments

@magikid
Copy link
Contributor

magikid commented Apr 26, 2022

When I run behat --tags="" then I expect no exceptions to be thrown. In the version of behat that I'm running (3.8.1), it throws the following exception:

$ behat --tags="" --list-scenarios

In TagFilter.php line 146:
                                         
  Warning: Uninitialized string offset 0  
                                          

It looks like TagFilter doesn't check for the empty string before exploding the string and attempting to use array access on it.

magikid added a commit to magikid/Gherkin that referenced this issue Apr 26, 2022
If the `filterString` in `TagFilter` is an empty string, an exception
was being thrown because the code was expecting a non-empty string.
This checks if the string is non-empty and returns early if it is.

Issue: Behat#250
magikid added a commit to magikid/Gherkin that referenced this issue Apr 26, 2022
If the `filterString` in `TagFilter` is an empty string, an exception
was being thrown because the code was expecting a non-empty string.
This checks if the string is non-empty and returns early if it is.

Issue: Behat#250
ciaranmcnulty pushed a commit that referenced this issue Jul 7, 2022
* Check for empty Tag filter string

If the `filterString` in `TagFilter` is an empty string, an exception
was being thrown because the code was expecting a non-empty string.
This checks if the string is non-empty and returns early if it is.

Issue: #250

* Use strlen instead of mb_strlen

strlen is O(1) and mb_strlen is O(n).
@magikid magikid closed this as completed Sep 19, 2023
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

No branches or pull requests

1 participant