jetpack icon indicating copy to clipboard operation
jetpack copied to clipboard

PHP 7 Compatibility Issues

Open bhubbard opened this issue 10 years ago • 18 comments

I ran the PHP Compatibility Checker Plugin, expected to pass, got the following errors:

FILE: /wp-content/plugins/jetpack/_inc/lib/markdown/extra.php
--------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
--------------------------------------------------------------------------------------------------
 1739 | ERROR | Using a call-time pass-by-reference is prohibited since php 5.4
 2329 | ERROR | Using a call-time pass-by-reference is prohibited since php 5.4
 2439 | ERROR | Using a call-time pass-by-reference is prohibited since php 5.4
 2499 | ERROR | Using a call-time pass-by-reference is prohibited since php 5.4
 2505 | ERROR | Using a call-time pass-by-reference is prohibited since php 5.4
--------------------------------------------------------------------------------------------------


FILE: /wp-content/plugins/jetpack/class.jetpack.php
------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------
 30 | ERROR | Global variable 'HTTP_RAW_POST_DATA' is deprecated since PHP 5.6 and removed since PHP 7.0 - use php://input instead.
------------------------------------------------------------------------------------------------------------------------------------

bhubbard avatar Jul 08 '16 16:07 bhubbard

The Markdown errors might be false positives. See this issue in the original Markdown Extra library to find out more: https://github.com/michelf/php-markdown/issues/163

We could probably switch to php://input though. We already use it in on other places in that file.

@lezama What's your take on this?

jeherve avatar Jul 08 '16 16:07 jeherve

We could probably switch to php://input though. We already use it in on other places in that file.

@lezama What's your take on this?

Probably a good idea, I don't understand how we didn't get complaints from users running PHP7

lezama avatar Jul 09 '16 19:07 lezama

I don't understand how we didn't get complaints from users running PHP7

I'm not sure. This never generated any warnings or errors for me.

jeherve avatar Jul 11 '16 11:07 jeherve

FYI - HTTP_RAW_POST_DATA is also used in Jetpack_Signature, which seems like it could be a problem.

danielbachhuber avatar Jul 18 '16 17:07 danielbachhuber

3056104-t going to have him downgrade to see what happens

aheckler avatar Feb 20 '17 21:02 aheckler

Downgrading did fix the problem for the user in 3056104-t

aheckler avatar Feb 22 '17 18:02 aheckler

I'm the user in 3056104-t. I still use PHP7.0.x now because 7.0.x gives no error. Even if I use PHP7.1.x, there is no error when I disabled OPCache. The information about a few incompatibilities on servers using OPCache was brought to me by jeherve.

But, disabling OPCache is not good for my server. Have anyone had any progress on this particular error?

o6asan avatar Mar 23 '17 01:03 o6asan

The information about a few incompatibilities on servers using OPCache was brought to me by jeherve.

This should be fixed with #6565. @o6asan Would you mind giving that patch a try and let us know there if it works?

Thanks!

jeherve avatar Mar 27 '17 13:03 jeherve

Master issue: #6106

jeherve avatar Mar 27 '17 13:03 jeherve

@jeherve Unfortunately, #6565 did not work well for me. I had the same error on the log of PHP7.1.3 with Jetpack4.7.1 and new jetpack-related-posts.php.

o6asan avatar Mar 28 '17 00:03 o6asan

@o6asan Thanks for giving it a try. We'll get back to you via email to run some more tests!

jeherve avatar Mar 28 '17 11:03 jeherve

@jeherve Today, I updated PHP to 7.1.4 which includes the fixes of https://bugs.php.net/bug.php?id=74213. I already have Jetpack4.8.2 which merged #6565. Under them, I don't have the error anymore. I enabled the feature Related Posts and it works well. Thanks so much.

o6asan avatar Apr 12 '17 12:04 o6asan

PHP Compatibility plugin is again showing following errors regarding PHP 7 Compatibility.

FILE: /var/www/html/wp-content/plugins/jetpack/modules/markdown/easy-markdown.php
------------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
------------------------------------------------------------------------------------------------------------------------------------
 654 | ERROR | Global variable '$HTTP_RAW_POST_DATA' is deprecated since PHP 5.6 and removed since PHP 7.0; Use php://input instead
 655 | ERROR | Global variable '$HTTP_RAW_POST_DATA' is deprecated since PHP 5.6 and removed since PHP 7.0; Use php://input instead
 656 | ERROR | Global variable '$HTTP_RAW_POST_DATA' is deprecated since PHP 5.6 and removed since PHP 7.0; Use php://input instead
 660 | ERROR | Global variable '$HTTP_RAW_POST_DATA' is deprecated since PHP 5.6 and removed since PHP 7.0; Use php://input instead
------------------------------------------------------------------------------------------------------------------------------------

navjotjsingh avatar May 02 '18 07:05 navjotjsingh

Closing this to focus on #9818 as a final task for general PHP 7 compat.

kraftbj avatar Jun 25 '18 16:06 kraftbj

@navjotjsingh thanks for the report! Just for the record: these are false positives. We can not remove every HTTP_RAW_POST_DATA entry from our code because we need to make sure it's PHP 5.2 compatible. Instead we are making sure we are using it in a way that is backwards compatible. This is why compatibility plugins that do not analyze code, but instead match by substrings will always report these. It's fine, you can ignore these matches.

Edit: actually, disregard the above, #9818 looks valid.

zinigor avatar Jun 26 '18 08:06 zinigor

@o6asan . Sorry to bother you! I couldn't find any other way to reach you, not even through your BBS contact (NetOwl security blocked me from commenting there). Your website is down. I can't access your translation for Hyohaku anymore. Or for any domains titled o6asan. It says ERR_ADDRESS_UNREACHABLE. I didn't save your email address either, and since it was on said website, I couldn't email you either, hence I am contacting you here.

At first I thought the issue was with my server, but I realized it would happen regardless of device, browser of computers. I had a bunch of classmates try it with their respective servers, internet, and devices too-issue's with your website. Would you mind fixing it so I can read Hyohaku please?

Again, sorry for hijacking this forum, I couldn't find any other way of contacting you since BBS and your website is down.

angelatwin333 avatar Apr 25 '24 22:04 angelatwin333

@angelatwin333 , Thank you for informing me about my sites down. I had not noticed my web server down until my reading your letter. I fixed it. I think you can reach my sites now.

I apologize to everyone on this forum for our bothering.

o6asan avatar Apr 26 '24 02:04 o6asan

Thank you so, so much!

angelatwin333 avatar Apr 26 '24 03:04 angelatwin333