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.1: Ensure PHPCS doesn't warn on the now harmless ini_set #355

Merged

Conversation

philipjohn
Copy link
Contributor

Description of the Change

While #327 resolved a deprecation warning, the code is still flagged by PHPCS as being problematic. This change builds on #327 to add the phpcs:ignore statement so that the code doesn't hold up any processes unnecessarily by flagging something that's no longer an issue.

Closes #283

How to test the Change

  1. Run PHPCS using PHP 8.1 (e.g. with <config name="testVersion" value="8.1" /> in phpcs.xml)
  2. Observe that PHPCS produces a warning for inc/functions.php:415
  3. Apply this patch and re-run PHPCS, there will be no warning

Changelog Entry

Added - phpcs:ignore on the now safe ini_set()

Credits

Props @philipjohn

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@philipjohn philipjohn requested a review from a team as a code owner October 31, 2023 13:22
@philipjohn philipjohn requested review from ravinderk and removed request for a team October 31, 2023 13:22
@jeffpaul jeffpaul added this to the 2.2.0 milestone Oct 31, 2023
Copy link
Contributor

@ravinderk ravinderk left a comment

Choose a reason for hiding this comment

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

@philipjohn I ran phpcs, and I still see a warning.

image

@philipjohn
Copy link
Contributor Author

@ravinderk Are you referring to the "Silencing errors..." warning? If so, that's not the PHPCS issue this PR is addressing.

Without this PR, PHP 8.2 compatibility checks with PHPCS report the following:

FILE: safe-redirect-manager/inc/functions.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 336 | WARNING | INI directive 'auto_detect_line_endings' is deprecated since PHP 8.1
     |         | (PHPCompatibility.IniDirectives.RemovedIniDirectives.auto_detect_line_endingsDeprecated)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

After this change, that deprecation warning is gone.

@jeffpaul jeffpaul merged commit 479ed26 into 10up:develop Jan 2, 2024
@dkotter dkotter modified the milestones: 2.2.0, 2.1.1 Jan 5, 2024
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.

auto_detect_line_endings is deprecated as of PHP 8.1
4 participants