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

PHP 8 fixes #52

Merged
merged 3 commits into from
Oct 11, 2021
Merged

PHP 8 fixes #52

merged 3 commits into from
Oct 11, 2021

Conversation

rdohms
Copy link
Owner

@rdohms rdohms commented Oct 11, 2021

I'm in the process of upgrading our app to PHP8 and ran into a few issues with the DMS Filter bundle. I've written some fixes that work for my use case, I thought I would raise a PR for them in case it would be useful for them to be incorporated?

The following are changed:

Updated filters to support nullable fields

With PHP8 functions such as strip_tags() can throw when a non-string value is provided. I've wrapped the affected function calls in is_string() checks to provide a graceful fallback, and updated the unit tests accordingly. This has allowed me to continue using the filters on fields that are nullable.

Fixed a crash on the RegExp filter

When the unicodeEnabled static property is not set against the RegExp class, the existing null check in the checkUnicodeSupport method would result in an Error being thrown. I've changed the null check for an isset() call to resolve this.

Added Laminas rule/filter

This is to support the move from Zend to Laminas. I've not made any changes to the existing Zend classes for this. If there is another, better solution for this I'm happy to remove the new classes, or indeed make changes to any of the above.

Thanks, Kieran

Moved here so I could fix some styling issues, thanks @kdadler

@rdohms rdohms added Feature New feature or request Bug Something isn't working labels Oct 11, 2021
@rdohms rdohms added this to the v4.0.1 milestone Oct 11, 2021
@rdohms rdohms mentioned this pull request Oct 11, 2021
@rdohms rdohms merged commit 2ca1a5f into master Oct 11, 2021
@rdohms rdohms deleted the kdadler-php8-nullable-fields branch October 11, 2021 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants