Details
-
Bug
-
Resolution: Fixed
-
High
-
5.3.9
-
None
Description
When using some legacy functions in the Public API, DB commection errors are generated.
Steps to reproduce:
1. Prepare a test eZ Publish 5.3 installation, fully updated via composer;
2. Create a bundle for testing purposes;
3. Pleace the attached "LegacyInitCommand.php" command inside the "Command" folder in the newly created test bundle;
4. Change the command's namespace as necessary to reflect your own test environment;
5. Run command:
$ ezpublish/console legacy:init-failure -vvv [2016-11-07 17:32:01] event.DEBUG: Notified event "console.command" to listener "Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::configure". [2016-11-07 17:32:01] event.DEBUG: Notified event "console.command" to listener "Symfony\Bridge\Monolog\Handler\ConsoleHandler::onCommand". [2016-11-07 17:32:01] event.DEBUG: Notified event "console.command" to listener "Symfony\Bridge\Monolog\Handler\ConsoleHandler::onCommand". [2016-11-07 17:32:01] event.DEBUG: Notified event "console.exception" to listener "FOS\HttpCacheBundle\EventListener\InvalidationSubscriber::onConsoleTerminate". [eZDBNoConnectionException] Unable to connect to the database server 'localhost' Error #1045: Access denied for user 'root'@'localhost' (using password: NO) Exception trace: () at /var/www/54ezdemo.com/ezpublish_legacy/lib/ezdb/classes/ezmysqlidb.php:135 eZMySQLiDB->connect() at /var/www/54ezdemo.com/ezpublish_legacy/lib/ezdb/classes/ezmysqlidb.php:50 eZMySQLiDB->eZMySQLiDB() at n/a:n/a ReflectionClass->newInstanceArgs() at /var/www/54ezdemo.com/ezpublish_legacy/lib/ezutils/classes/ezextension.php:554 eZExtension::getHandlerClass() at /var/www/54ezdemo.com/ezpublish_legacy/lib/ezdb/classes/ezdb.php:268 eZDB::instance() at /var/www/54ezdemo.com/ezpublish_legacy/extension/ezflow/classes/ezflowpool.php:162 eZFlowPool::insertItems() at /var/www/54ezdemo.com/src/Nuno/TestBundle/Command/LegacyInitCommand.php:39 Nuno\TestBundle\Command\LegacyInitCommand->execute() at /var/www/54ezdemo.com/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:256 Symfony\Component\Console\Command\Command->run() at /var/www/54ezdemo.com/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:855 Symfony\Component\Console\Application->doRunCommand() at /var/www/54ezdemo.com/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:190 Symfony\Component\Console\Application->doRun() at /var/www/54ezdemo.com/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:90 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/54ezdemo.com/vendor/ezsystems/ezpublish-kernel/eZ/Bundle/EzPublishCoreBundle/Console/Application.php:41 eZ\Bundle\EzPublishCoreBundle\Console\Application->doRun() at /var/www/54ezdemo.com/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:121 Symfony\Component\Console\Application->run() at /var/www/54ezdemo.com/ezpublish/console:27 legacy:init-failure
Note: the following code is a workaround, to verify it uncomment those lines in the command and run it again:
$closure = $this->getContainer()->get('ezpublish_legacy.kernel'); $legacyKernel = $closure();