3

I have mirrored an EE 1.14 site to my local server to work on. I've followed my normal procedure for doing so - change base urls, modify local.xml, dump caches and session.

However, when I try to navigate to the site, or even to the magicento eval.php (/home/user_name/public_html/site_new/site/html/var/magicento/eval.php), I get this error:

Fatal error: Call to a member function setParent() on a non-object in /home/user_name/public_html/site_new/site/html/lib/Varien/Simplexml/Element.php on line 444

Looking at the code in that area, I can see that Magento is trying to set the parent on a newly created child :

if (is_null($targetChild)) {
        // if child target is not found create new and descend
        $targetChild = $this->addChild($sourceName);
        $targetChild->setParent($this); //Line 444 which throws error.
        foreach ($source->attributes() as $key=>$value) {
            $targetChild->addAttribute($key, $this->xmlentities($value));
        }
    }

In system.log, I am getting this error :

Warning: SimpleXMLElement::addChild() [simplexmlelement.addchild.html]: Element name is required in /home/user_name/public_html/site_new/site/html/lib/Varien/Simplexml/Element.php on line 443

So I looked back in the extendChild function a bit and added some debugging code :

// name of the source node
        $sourceName = $source->getName(); // Standard Magento call
       //Debug code follows :
        if(!$sourceName){ 
            echo "<pre>";
            echo print_r($source);
            echo "</pre>";
        }

The if(!$sourceName) check gets hit once per load. The output I get from the print_r is this, including the '1' at the end:

Mage_Core_Model_Config_Element Object
(
    [192.168.5.112] => Mage_Core_Model_Config_Element Object
        (
            [~user_name] => Mage_Core_Model_Config_Element Object
                (
                    [site_new] => Mage_Core_Model_Config_Element Object
                        (
                            [site] => Mage_Core_Model_Config_Element Object
                                (
                                    [html] => Mage_Core_Model_Config_Element Object
                                        (
                                        )

                                )

                        )

                )

        )

)
1

I'm at a loss as to why this is happening. I've turned off rewrites, js and css compilation, set ownership to webserver:webserver, and a few different permission configurations (settled on 755/644).

2
  • I see you are using 2 different documents roots here: /var/magicento/ and the error comes from /home/user_name/public_html. I wonder how your webserver is set up? Is your /var directory writeable? Commented Jan 17, 2016 at 10:07
  • Hi Anna, actually, it's the magento_root/var folder I was referring to. Poorly worded in the original question, sorry about that. Edited to reflect the actual path.
    – AreDubya
    Commented Jan 17, 2016 at 18:52

2 Answers 2

1

I suspect there can be some syntax error in your XML config files.

Assuming you are running on a *nix OS, try to validate your config.xml files launching the following command from your Magento root:

find . -type f -name 'config.xml' -exec xmllint --noout {} \;

To widen your search you can replace config.xml with *.xml; note that in that case some false negatives may occur (e.g.: while checking wsdl files).

Hope it helps.

2
  • Thanks Alessandro. All the xml checks out, so while this wasn't the fix it is incredibly helpful!
    – AreDubya
    Commented Jan 17, 2016 at 18:53
  • 1
    Had the exact same issue again, and this was what I needed to find the issue. Thanks again!
    – AreDubya
    Commented Jan 30, 2017 at 21:29
0

Other than an error in a config XML file, it can be an error in core_config_data table. Exact same warning and error messages:

Warning in lib/Varien/Simplexml/Element.php on line 443

Fatal error in lib/Varien/Simplexml/Element.php on line 444

are shown on an instance where someone set by mistake an url in the path field instead of value field, when trying to change the base_url's: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.