Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-26557

DB connection error when using legacy functions via Public API

    XMLWordPrintable

Details

    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();
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            nuno.oliveira-obsolete@ez.no Nuno Oliveira (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: