XmlScheme3.php Error

Hello everyone,

A few days ago I started getting an error that I have not yet figured out. I am using Multi-Vendor 4.16.1

The following error shows up on the addon manage page, or on any page whenever I clean the cache (it goes away when I refresh the page).

Warning : Invalid argument supplied for foreach() in /home/top-dot.com/public_html/app/Tygh/Addons/XmlScheme3.php on line 254

It appears to be related to language files. Here is the function, with the 254 line in bold.

/**
 * Gets original values for language-dependence name/description
 *
 * @return array Original values
 */
public function getOriginals()
{
    $originals = array();

    $addon_id = (string) $this->_xml->id;
    $pack = $this->getPoPath($this->getDefaultLanguage());

    if (file_exists($pack)) {
        $values = Po::getValues($pack, 'Addons');

        **foreach ($values as $value) {**
            if ($value['parent'] == 'name') {
                $originals['name'] = $value['msgid'];
            } elseif ($value['parent'] == 'description') {
                $originals['description'] = $value['msgid'];
            }
        }
    }
    return $originals;
}

Anybody has any idea what this is about?
Thank you very much for your help.

Hi!

It seems like some of the used third party add-ons have incorrect translations in its PO file. You can check what file is causing this issue, by printing out the $pack variable. The last one printed out before PHP Warning will appear, is causing the issue.

Hello @CS-Cart_team Thank you so much, fixed the error.

1 Like