ezsystems/ezpublish-legacy — pull request #980 by MLoureiro (2014-05-27 12:02:42+00:00)
Title: Instanciate only if needed

When running the firsts tests on BDD to cover commands, I get an error on redeclaring `eZUpdateDebugSettings`:
```
PHP Fatal error: Cannot redeclare eZUpdateDebugSettings() (previously declared in /var/www/html/dev/behat/ezpublish_legacy/kernel/private/classes/global_functions.php:91) in /var/www/html/dev/behat/ezpublish_legacy/kernel/classes/ezscript.php on line 1222
```
with stack trace:
```
PHP 1. {main}() /var/www/html/dev/behat/vendor/behat/behat/bin/behat:0
PHP 2. Symfony\Component\Console\Application->run() /var/www/html/dev/behat/vendor/behat/behat/bin/behat:32
PHP 3. Behat\Behat\Console\BehatApplication->doRun() /var/www/html/dev/behat/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:121
PHP 4. Symfony\Component\Console\Application->doRun() /var/www/html/dev/behat/vendor/behat/behat/src/Behat/Behat/Console/BehatApplication.php:68
PHP 5. Symfony\Component\Console\Application->doRunCommand() /var/www/html/dev/behat/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:191
PHP 6. Symfony\Component\Console\Command\Command->run() /var/www/html/dev/behat/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:901
PHP 7. Behat\Behat\Console\Command\BehatCommand->execute() /var/www/html/dev/behat/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:244
PHP 8. Behat\Behat\Console\Command\BehatCommand->runFeatures() /var/www/html/dev/behat/vendor/behat/behat/src/Behat/Behat/Console/Command/BehatCommand.php:128
PHP 9. Behat\Gherkin\Node\AbstractNode->accept() /var/www/html/dev/behat/vendor/behat/behat/src/Behat/Behat/Console/Command/BehatCommand.php:150
PHP 10. Behat\Behat\Tester\FeatureTester->visit() /var/www/html/dev/behat/vendor/behat/gherkin/src/Behat/Gherkin/Node/AbstractNode.php:42
PHP 11. Behat\Gherkin\Node\AbstractNode->accept() /var/www/html/dev/behat/vendor/behat/behat/src/Behat/Behat/Tester/FeatureTester.php:88
PHP 12. Behat\Behat\Tester\ScenarioTester->visit() /var/www/html/dev/behat/vendor/behat/gherkin/src/Behat/Gherkin/Node/AbstractNode.php:42
PHP 13. Behat\Behat\Tester\ScenarioTester->visitStep() /var/www/html/dev/behat/vendor/behat/behat/src/Behat/Behat/Tester/ScenarioTester.php:87
PHP 14. Behat\Gherkin\Node\AbstractNode->accept() /var/www/html/dev/behat/vendor/behat/behat/src/Behat/Behat/Tester/ScenarioTester.php:148
PHP 15. Behat\Behat\Tester\StepTester->visit() /var/www/html/dev/behat/vendor/behat/gherkin/src/Behat/Gherkin/Node/AbstractNode.php:42
PHP 16. Behat\Behat\Tester\StepTester->executeStep() /var/www/html/dev/behat/vendor/behat/behat/src/Behat/Behat/Tester/StepTester.php:95
PHP 17. Behat\Behat\Tester\StepTester->executeStepDefinition() /var/www/html/dev/behat/vendor/behat/behat/src/Behat/Behat/Tester/StepTester.php:126
PHP 18. Behat\Behat\Definition\Annotation\Definition->run() /var/www/html/dev/behat/vendor/behat/behat/src/Behat/Behat/Tester/StepTester.php:157
PHP 19. call_user_func_array:{/var/www/html/dev/behat/vendor/behat/behat/src/Behat/Behat/Definition/Annotation/Definition.php:155}() /var/www/html/dev/behat/vendor/behat/behat/src/Behat/Behat/Definition/Annotation/Definition.php:155
PHP 20. EzSystems\BehatBundle\Context\CommandContext->iExecuteCommandWith() /var/www/html/dev/behat/vendor/behat/behat/src/Behat/Behat/Definition/Annotation/Definition.php:155
PHP 21. Symfony\Component\Console\Tester\CommandTester->execute() /var/www/html/dev/behat/vendor/ezsystems/behatbundle/EzSystems/BehatBundle/Context/CommandContext.php:63
PHP 22. Symfony\Component\Console\Command\Command->run() /var/www/html/dev/behat/vendor/symfony/symfony/src/Symfony/Component/Console/Tester/CommandTester.php:70
PHP 23. Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->execute() /var/www/html/dev/behat/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:244
PHP 24. Symfony\Component\HttpKernel\CacheClearer\ChainCacheClearer->clear() /var/www/html/dev/behat/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php:70
PHP 25. eZ\Bundle\EzPublishLegacyBundle\Cache\LegacyCachePurger->clear() /var/www/html/dev/behat/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheClearer/ChainCacheClearer.php:42
PHP 26. eZ\Publish\Core\MVC\Legacy\Kernel->runCallback() /var/www/html/dev/behat/vendor/ezsystems/ezpublish-kernel/eZ/Bundle/EzPublishLegacyBundle/Cache/LegacyCachePurger.php:83
PHP 27. ezpKernel->runCallback() /var/www/html/dev/behat/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/MVC/Legacy/Kernel.php:162
PHP 28. ezpKernelWeb->runCallback() /var/www/html/dev/behat/ezpublish_legacy/kernel/private/classes/ezpkernel.php:68
PHP 29. eZ\Bundle\EzPublishLegacyBundle\Cache\{closure}() /var/www/html/dev/behat/ezpublish_legacy/kernel/private/classes/ezpkernelweb.php:1209
PHP 30. ezpAutoloader::autoload() /var/www/html/dev/behat/ezpublish_legacy/kernel/private/classes/ezpkernelweb.php:0
```

This solves the error no sure if it's fixing the problem or an symptom.