PayPal-PHP-SDK icon indicating copy to clipboard operation
PayPal-PHP-SDK copied to clipboard

fix:Compatiblity for PHP7.3

Open shisiying opened this issue 6 years ago • 8 comments

shisiying avatar Jul 22 '19 03:07 shisiying

Both of these changes are based on errors in the php7.3 production environment

  • empty

if $searchKey == NULL,It also executes the following code.But it shouldn't have been.

  • strstr

Compatiblity for PHP7.3

If needle is not a string, it is converted to an integer and applied as the ordinal value of a character. This behavior is deprecated as of PHP 7.3.0, and relying on it is highly discouraged. Depending on the intended behavior, the needle should either be explicitly cast to string, or an explicit call to chr() should be performed.

shisiying avatar Jul 22 '19 03:07 shisiying

Any ideas in which release this is going to be merged?

stafot avatar Sep 11 '19 08:09 stafot

I also have this issue. Is this the official PHP Paypal SDK ?

Are we only a few people having the issue ?

antoinegomez avatar Sep 12 '19 14:09 antoinegomez

There is a workaround through ignoring E_DEPRECATED on your php.ini or in your app @antoinegomez. Bur it should be fixed because in next php versions it will break.

stafot avatar Sep 12 '19 14:09 stafot

There is a workaround through ignoring E_DEPRECATED on your php.ini or in your app @antoinegomez. Bur it should be fixed because in next php versions it will break.

Yes this is what I ended up doing. But I do not understand why this fix is still pending. It is not like PHP and PayPal were small players ...

antoinegomez avatar Sep 12 '19 14:09 antoinegomez

It'd be great to have this merged.

We have upgraded to PHP 7.3 but this Paypal SDK issue is forcing us to write code like this for our test system:

    // Configure app to be "vocal" when in debug mode
    if (date('Y-m-d') < '2019-12-01') {
        // During the PHP upgrade from 7.2 to 7.3 we are having some DEPRECATION errors with external dependencies
        // Example: https://github.com/paypal/PayPal-PHP-SDK/pull/1282
        // Give us some time for these deprecations to be fixed without making Staging unusable for developers
        ini_set('error_reporting', E_ALL ^ E_DEPRECATED);
    } else {
        ini_set('error_reporting', E_ALL); // Use strict error reporting when in debug mode. (E_ALL includes E_STRICT as of PHP 5.4.0)
    }

tomfotherby avatar Nov 04 '19 09:11 tomfotherby

This is seriously a pain and looking like they're not going to merge in this fix :/

waynehaffenden avatar Mar 23 '20 11:03 waynehaffenden

I agree. We had to fork the repo and pull in the fixes. I'd prefer to use the official paypal repo if we could.

tomfotherby avatar Mar 23 '20 11:03 tomfotherby