What The *&§$&''' ???
This page explains solutions to common pitfalls in Agavi, especially those people might run into right after they started working with it.
AgaviParseException "XML Schema validation of configuration file '...../config_handlers.xml' failed due to the following error:", "Line 4: Element 'handlers', [lax wildcard]: The namespace of the element is not allowed." or similar (always in config_handlers.xml, always with "namespace of the element not allowed")
This is due to a bug in older libxml versions which cannot validate namespaced documents. A typical version exhibiting this bug is 2.6.16. For most people, this happens in production environments, not during development.
The workaround is to disable config validation in the affected environments. To do that, add
AgaviConfig::set('core.skip_config_validation', true);
to the affected environments, before Agavi::boostrap() is called. As index.php has to be adjusted for each environment anyway, it is recommended you put it there.
If this happens in your development environment, upgrade your libxml (for most people, upgrading PHP to a newer version does just that).
Exception "Configuration file 'C:/Users/Joe Cool/workspace/agavi/0.11.0RC5/src/routing/soap/wsdl.xml' could not be parsed due to the following error that occured while resolving XInclude directives:", "Line 3: failed build URL" or other configuration file paths (especially output_types.xml)
This error thrown by libxml while working through <xi:include /> tags is due to the space in the path name, which apparently, libxml on Windows cannot work with. There are two solutions to this problem:
- Don't use spaces in path names :)
- Don't use dirname(__FILE__) for core.app_dir in app/config.php, but instead specify the full path by hand, but with short forms for directories that contain spaces (use dir /X on the command line to see short names).
Exception "Too many execution runs have been detected for this Context."
You will typically run into this if your layout configuration produced an infinite loop.
Often, slots are set on layers in the layout configuration, but these slots' views also simply load the default layout, which then again loads all the slots, which again load the default layout, and so on.
A good idea is to catch this situation in your setupHtml() method in the base view (you have both of these, don't you?) and make sure that if a view runs as a slot, the default layout does not get loaded, for example:
public function setupHtml(AgaviRequestDataHolder $rd, $layoutName = null)
{
if($layoutName === null && $this->getContainer()->getParameter('is_slot', false)) {
$layoutName = 'slot';
}
$this->loadLayout($layoutName);
}
Of course, you then also need a "slot" layout that only has one content layer.
Fatal Error: domdocument::domdocument() expects at least 1 parameter, 0 given in .../agavi/config/AgaviXmlConfigParser.class.php on line 121
You have the DOMXML extension enabled which is deprecated in PHP5:
Note: This extension has been moved to the PECL repository and is no longer bundled with PHP as of PHP 5.0.0.
Note: This extension is no longer marked experimental. It will, however, never be released with PHP 5, and will only be distributed with PHP 4. If you need DOM XML support with PHP 5 you can use the DOM extension. This domxml extension is not compatible with the DOM extension.
