syndication icon indicating copy to clipboard operation
syndication copied to clipboard

PHP 7.2 Compat - mcrypt_decrypt() is REMOVED

Open rogertheriault opened this issue 6 years ago • 1 comments

mcrypt_decrypt() (and similar functions) is removed in 7.2, deprecated in 7.1

Result: the Add Site page breaks on PHP 7.2

image

Fatal error: Uncaught Error: Call to undefined function mcrypt_decrypt() in (stack trace...) 
plugins/syndication/includes/push-syndicate-encryption.php on line 12

(It may also cause folks to go looking for the module)

When opening the Add Site interface, with PHP 7.1 a deprecation warning is issued:

image

rogertheriault avatar Mar 29 '18 21:03 rogertheriault

This would be good to get patched, as it causes fatals on all non-VIP sites running up to date versions of PHP.

The only uses of these two functions can be found here: https://github.com/Automattic/syndication/blob/374adf60d73afc739dd6fb406243a80ebf54a8db/includes/push-syndicate-encryption.php. These functions are seemingly only used for encrypting the syndicated site password & syndicated site token before saving to post meta, and then decrypting before displaying in settings and being used in API calls.

Possible Solutions:

Use the openssl_* library if available:

  • http://php.net/manual/en/function.openssl-encrypt.php
  • http://php.net/manual/en/function.openssl-decrypt.php

Use the defuse/php-encryption library:

  • https://github.com/defuse/php-encryption

Workarounds

In the mean time, I suppose the available workarounds are:

  • Add the ext/mcrypt PECL package to your PHP build.
  • Use PHP 7.1 rather than 7.2.
  • Per the above section, replace the two uses of mcrypt_* with openssl_*.

WPprodigy avatar Sep 05 '18 21:09 WPprodigy