Skip to content

Fix deprecation warnings and null result when text is null - #41

Open
samipuro wants to merge 1 commit into
ConsoleTVs:masterfrom
samipuro:fix/null-text
Open

samipuro wants to merge 1 commit into
ConsoleTVs:masterfrom
samipuro:fix/null-text

Conversation

@samipuro

Copy link
Copy Markdown

Passing null as the text (for example an empty form field) triggers one preg_match(): Passing null to parameter #2 deprecation per dictionary word, which is 2554 warnings per call on PHP 8.1+. filter() also returns null instead of a string.

This casts the text to a string in the constructor and in text(), so clean() returns true and filter() returns "" without warnings.

Fixes #25. This covers the same problem as #35, but fixes it where the text is set, so the strict-mode branch and filter() are covered too.

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.

production WARNING php 8.1

1 participant