View Single Post
  #7  
Old 02-27-2019, 12:04 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: PHP 5.6 and 7.0 Discontinued: How It Affects Your X-Cart 4 Store

Keep in mind the patches are not complete and do not fully address all issues older XC versions will have with PHP 7.2+

One example is the use of each() - this has been removed in XC 4.7.9 and later but every version before that has it. And the patches do not address this.

each() has been deprecated since PHP 7.2 and most likely will be removed with 7.4 or whatever version they decide on. Cart still works but logs will be full of warnings and XC 4.7.9+ and the patches are not consistent in what they fix.

As PHP puts it: This function has been DEPRECATED as of PHP 7.2.0. Relying on this function is highly discouraged.

There are other warnings and notices as well that will show after the patches but not with newest XC4 version.

So to me the patches are incomplete.

And while looking at this (the below code is from 4.7.10) it just doesn't make sense

PHP Code:
if (
        empty(
$product['meta_description'])
        || empty(
$product['meta_keywords'])
    ) {

        
$ids array_reverse(func_get_category_path($product['categoryid']));

        
$parents func_query_hash("SELECT categoryid, meta_description, meta_keywords FROM $sql_tbl[categories] WHERE categoryid IN ('".implode("', '"$ids)."') AND override_child_meta = 'Y'""categoryid"false);

        foreach (
$ids as $cid) {
            if (
                !empty(
$product['meta_description'])
                && !empty(
$product['meta_keywords'])
            ) {
                break;
            }
. . . . . . . . . . . 
   }


The "if" will run if meta_description OR keta_meywords are empty but then the following "foreach" breaks only if meta_description AND meta_keywords are not empty?!
The code will never get to the "foreach" if both are not empty in the first place....
The second "if" is absolutely unnecessary.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote