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

Issue-864: Resolve PHP Deprecations #866

Merged
merged 18 commits into from
Mar 21, 2024

Conversation

anubisthejackle
Copy link
Contributor

Description

While running the unit tests, I run into several PHP deprecations. It'd be great if those issues were resolved since they create noice in logs.


PHP Deprecated:  strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/wordpress/wp-content/plugins/wordpress-fieldmanager/php/class-fieldmanager-group.php on line 406

PHP Deprecated:  strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /var/www/wordpress-develop/src/wp-includes/functions.php on line 7127

PHP Deprecated:  strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/wordpress/wp-content/plugins/wordpress-fieldmanager/php/class-fieldmanager-field.php on line 992

... more ...

Also, consider using convertDeprecationsToExceptions="true" in the phpunit.xml so that a test fails if it contains PHP deprecations.

Use Case

Testing the test suite returns no PHP deprecations.

Acceptance Criteria

  • Add checks to ensure that values are strings before running them through string functions in the three locations identified above
  • Update the unit test configuration so that deprecations are converted to exceptions and require resolution before merging a PR

@anubisthejackle anubisthejackle marked this pull request as ready for review February 29, 2024 18:13
Copy link
Member

@kevinfodness kevinfodness left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few things to address before merge, otherwise 🍣

tests/php/test-fieldmanager-context-post.php Outdated Show resolved Hide resolved
tests/php/test-fieldmanager-richtextarea-field.php Outdated Show resolved Hide resolved
@mogmarsh mogmarsh merged commit a63b186 into main Mar 21, 2024
5 checks passed
@mogmarsh mogmarsh deleted the fix/issue-864/resolve-php-deprecations-in-tests branch March 21, 2024 16:29
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.

3 participants