0

I installed a script and when I login to admin dashboard am getting this error:

Warning (2): simplexml_load_file(): /app/Plugin/PaypalAdaptive/info.xml:7: parser error : xmlParseEntityRef: no name [APP/Controller/PluginsController.php, line 1151]

I checked the file pluginscontroller.php and this is the code. I copied from part of the entire file.

Line 1151 is: $xml = simplexml_load_file($file);

Full code starts here:

        // get all installed plugins
        $plugins = $this->Plugin->find( 'all', array(
            'order' => 'id DESC'
        ));

        $totalNewVersion = 0;
        if($plugins != null)
        {
            foreach($plugins as $k => $plugin)
            {
                $plugin = $plugin['Plugin'];
                $file = sprintf(PLUGIN_INFO_PATH, $plugin['key']);
                if(file_exists($file))
                {
                    $xml = simplexml_load_file($file);
                    if($xml != null && isset($xml->version))
                    {
                        if((string)$xml->version > $plugin['version'])
                        {
                            $totalNewVersion += 1;
                        }
                    }
                }
            }
        }
        return $totalNewVersion;
    }

    public function admin_do_upgrade( $id )
    {
        if(!$this->Plugin->hasAny(array('id' => $id)))
        {
            $this->Session->setFlash(__('This plugin does not exist'), 'default', array('class' => 'Metronic-alerts alert alert-danger fade in' ));
        }
        else 
        {
Dylan Wheeler
  • 6,928
  • 14
  • 56
  • 80
Haf833
  • 15
  • 7
  • Please show a minimal XML file that generates this error when read in. – Mathias Müller Jul 06 '16 at 20:00
  • Possible duplicate of ['xmlParseEntityRef: no name' warnings while loading xml into a php file](http://stackoverflow.com/questions/7604436/xmlparseentityref-no-name-warnings-while-loading-xml-into-a-php-file) – Devon Bessemer Jul 06 '16 at 20:01

2 Answers2

0

It's telling you the XML is invalid, probably because it contains an "&" character that should have been escaped as &.

Do what you would do with any faulty goods - send it back to the supplier and tell them to fix it.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164
0

I finally solved it, I had made some edits in the code and used "&" instead of "&" thats what caused the problem.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164
Haf833
  • 15
  • 7