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

Integrate PHPCompatibility sniffs into CI toolchain #8126

Closed
danielbachhuber opened this issue Nov 7, 2017 · 4 comments
Closed

Integrate PHPCompatibility sniffs into CI toolchain #8126

danielbachhuber opened this issue Nov 7, 2017 · 4 comments
Labels
[Pri] Normal [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it Unit Tests

Comments

@danielbachhuber
Copy link
Contributor

The PHPCompatibility sniffs help to identify PHP compatibility issues between versions. It would be helpful to integrate into the CI toolchain so Jetpack developers know when code changes have/introduce incompatible code.

In a data analysis project I'm doing right now, Jetpack is the most common failed plugin. The failure is caused by use of removed $HTTP_RAW_POST_DATA (explanation):

For further reference, here's a cache of Jetpack v5.4 scan results.

Related #4346

@jeherve jeherve added Unit Tests [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Pri] Normal labels Nov 8, 2017
@zinigor
Copy link
Member

zinigor commented Nov 8, 2017

This is great, thanks for letting us know about this! But I have a question: we have been looking at $HTTP_RAW_POST_DATA before when we were figuring out the changes needed to make Jetpack compatible with PHP 7.1. And it turns out that in these cases that global variable warning is a red herring - we repopulate $HTTP_RAW_POST_DATA to make sure we're compatible with PHP versions that still use it.

Do you know if there's a way to mark such occurences as false positives?

@danielbachhuber
Copy link
Contributor Author

And it turns out that in these cases that global variable warning is a red herring - we repopulate $HTTP_RAW_POST_DATA to make sure we're compatible with PHP versions that still use it.

I see this only happening in Jetpack->wp_rest_authenticate():

$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents( 'php://input' );

To my understanding, the two other contexts I identified (jetpack/modules/markdown/easy-markdown.php) and (jetpack/class.jetpack-signature.php) don't necessarily follow this codepath. Is this not the case?

Also, is there a reason you don't simply switch to file_get_contents( 'php://input' );?

Do you know if there's a way to mark such occurences as false positives?

Yes, you have two options:

  • // @codingStandardsIgnoreLine to ignore a single following line.
  • // @codingStandardsIgnoreStart and // @codingStandardsIgnoreEnd to ignore multiple lines.

@stale
Copy link

stale bot commented Jun 30, 2018

This issue has been marked as stale. This happened because:

  • It has been inactive in the past 6 months.
  • It hasn’t been labeled `[Pri] Blocker`, `[Pri] High`.

No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.

@stale stale bot added the [Status] Stale label Jun 30, 2018
@brbrr
Copy link
Contributor

brbrr commented Aug 7, 2018

Fixed in #9905

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Pri] Normal [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it Unit Tests
Projects
None yet
Development

No branches or pull requests

5 participants