4

I go through this tutorial and my problem consists in the fact that I do not get any function.include error on "The Global Config and Creating The Model" section (when assigning to a variable Mage::getModel('weblog/blogpost'), while the model doesn't exists yet).

At some point I found in /index.php an if statement in which is called the following method: Mage::setIsDeveloperMode(true); To test it, I put it outside the if statement (which I know is not good practice).

The result was that I got this warning message:

Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : XML declaration allowed only at the start of the document  in /home/dowebro/public_html/magento/lib/Varien/Simplexml/Config.php on line 510

#0 [internal function]: mageCoreErrorHandler(2, 'simplexml_load_...', '/home/dowebro/p...', 510, Array)
#1 /home/dowebro/public_html/magento/lib/Varien/Simplexml/Config.php(510): simplexml_load_string('    loadString('    loadFile('/home/dowebro/p...')
#4 /home/dowebro/public_html/magento/app/code/core/Mage/Core/Model/Config.php(318): Mage_Core_Model_Config->loadModulesConfiguration(Array, Object(Mage_Core_Model_Config))
#5 /home/dowebro/public_html/magento/app/code/core/Mage/Core/Model/App.php(414): Mage_Core_Model_Config->loadModules()
#6 /home/dowebro/public_html/magento/app/code/core/Mage/Core/Model/App.php(343): Mage_Core_Model_App->_initModules()
#7 /home/dowebro/public_html/magento/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#8 /home/dowebro/public_html/magento/index.php(91): Mage::run('', 'store')
#9 {main}

but still no error which I would expect.

So, how can I get rid of this Warning message, but more important, how can I see errors in developement mode?

Thank you!

EDIT: While I go on with this tutorial, I see that I don't get any kind of feedback from core classes. Ex: I should get "Can't retrieve entity config: weblog/blogpost" while trying yo get data from a model of which resource definition is incomplete. Well, I don't. :|

4

3 に答える 3

8

Developer mode is a sort of use strict for PHP and Magento. It forces you to fix everything. If looks like the simplexml_load_string function doesn't like one of the XML configuration files in your system. You can find out which one by going to line 510 in

/home/dowebro/public_html/magento/lib/Varien/Simplexml/Config.php

and var dumping the variable that's being passed to loadFile.

Based on the error message

XML declaration allowed only at the start of the document

My guess is your config.xml XML prolog has some whitespace before it

[    ]<?xml version=...

or you've accidentally added a <? somewhere in your XML file.

于 2012-10-05T21:48:01.553 に答える
0

I don't know why my post got deleted. Mods I can't even message you back.

I followed the same tutorial as @Michael did and encountered the same problem.

The solution is going to root of application index.php and remove hash from the front of below statement

#ini_set('display_errors', 1)

to

ini_set('display_errors', 1)
于 2013-10-31T09:54:28.273 に答える
0

I have this problem and i can solve debugging the file app\code\core\Mage\Core\Model\Config.php

In this class search the metod loadModulesConfiguration and im sure that you have the following code:

foreach ($fileName as $configFile) {
    $configFile = $this->getModuleDir('etc', $modName).DS.$configFile;
    if ($mergeModel->loadFile($configFile)) {
         $mergeToObject->extend($mergeModel, true);
    }
}

And this add a block try catch like this :

foreach ($fileName as $configFile) {
    try {
        $configFile = $this->getModuleDir('etc', $modName).DS.$configFile;
        if ($mergeModel->loadFile($configFile)) {
            $mergeToObject->extend($mergeModel, true);
        }
    } catch(Exception $e) {
        Mage::log($configFile);
    }
 }

And then check the log and you will have the name of the file that is the problem

于 2014-03-18T18:02:00.857 に答える