PHP Compatibility Checker – warnings
-
Hello,
I found this topic: https://ww.wp.xz.cn/support/topic/php-7-17/. Also, we tested our website with plugin PHP Compatibility Checker (https://ww.wp.xz.cn/plugins/php-compatibility-checker/) for PHP 7.0 compatibility.
We noticed two warnings/errors:
FILE:
wp-content/plugins/woocommerce-pdf-invoices-packing-slips/lib/dompdf/dompdf.php
183 | ERROR | The use of function split is discouraged from PHP version 5.3 and forbidden from PHP version 7.0; use preg_split insteadFILE: wp-content/plugins/woocommerce-pdf-invoices-packing-slips/lib/dompdf/include/page_cache.cls.php
40 | WARNING | Method name “Page_Cache::__query” is discouraged; PHP has reserved all method names with a double underscore prefix for future useI can offer solution for first:
$arr = split(‘,’,$opts[‘t’]);
can be replaced with:
$arr = explode(‘,’,$opts[‘t’]);
explode is simpler than preg_replace.
http://php.net/manual/en/function.explode.php
http://php.net/manual/en/function.split.phpSecond warning it’s related to name of function. You can change __query to something else.
Also, I’ve one performance optimization:
woocommerce-pdf-invoices-packingslips.php – line 108
$site_plugins = get_site_option( ‘active_sitewide_plugins’, array() );
->
$site_plugins = is_multisite() ? (array) maybe_unserialize( get_site_option('active_sitewide_plugins' ) ) : array();On single sites, It saves call of get_option – is_multisite is basically return false. On this way we save one SQL query (because option doesn’t exist and it isn’t in the cache – it’s helpful for shared hostings). On mulisite installation, option active_sitewide_plugins is already cached.
I’ll try plugin on PHP7 in next couple days. What’s current status?
Sasa
The topic ‘PHP Compatibility Checker – warnings’ is closed to new replies.