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

PublicAPI : bootstrap.php : PHP Fatal error: Cannot redeclare class Composer\Autoload\ClassLoader

    Details

      Description

      Hi

      When we now run bootstrap in the API tests we get following error:

      PHP Fatal error:  Cannot redeclare class Composer\Autoload\ClassLoader in /var/www/apache2php53/ezpublish5/vendor/ezsystems/ezpublish/vendor/composer/ClassLoader.php on line 44
       
      Fatal error: Cannot redeclare class Composer\Autoload\ClassLoader in /var/www/apache2php53/ezpublish5/vendor/ezsystems/ezpublish/vendor/composer/ClassLoader.php on line 44
       
      
      

        Activity

        Hide
        André Rømcke added a comment -

        No such issue with unit tests that also use bootstrap, much more info on how it is used and what kind of stack trace you have is needed here.

        Show
        André Rømcke added a comment - No such issue with unit tests that also use bootstrap, much more info on how it is used and what kind of stack trace you have is needed here.
        Hide
        Vidar Langseid added a comment -

        After some investigation I have found the cause of the problem.
        The testsystem now uses the YAML classes in symfony, and in order to do this we load vendor/composer/ClassLoader.php
        And that will obviously crash with vendor/ezsystems/ezpublish/vendor/composer/ClassLoader.php

        Closing issue as invalid

        Show
        Vidar Langseid added a comment - After some investigation I have found the cause of the problem. The testsystem now uses the YAML classes in symfony, and in order to do this we load vendor/composer/ClassLoader.php And that will obviously crash with vendor/ezsystems/ezpublish/vendor/composer/ClassLoader.php Closing issue as invalid
        Hide
        Vidar Langseid added a comment -

        Something that would fix this in the testsystem is:

        • do not require vendor/composer/ClassLoader.php, but instead require vendor/ezsystems/ezpublish/vendor/composer/ClassLoader.php when doing the YAML stuff

        Then we'll at least use the same class loader here as in bootstrap.php
        However, loading bootstrap will still fail because in /var/www/apache2php53/ezpublish5/vendor/ezsystems/ezpublish/vendor/composer/autoload_real.php we have:

        require __DIR__ . '/ClassLoader.php';

        Is it possible to do this change in that autoload_real.php?:

        -require __DIR__ . '/ClassLoader.php';
        +require_once __DIR__ . '/ClassLoader.php';

        Show
        Vidar Langseid added a comment - Something that would fix this in the testsystem is: do not require vendor/composer/ClassLoader.php, but instead require vendor/ezsystems/ezpublish/vendor/composer/ClassLoader.php when doing the YAML stuff Then we'll at least use the same class loader here as in bootstrap.php However, loading bootstrap will still fail because in /var/www/apache2php53/ezpublish5/vendor/ezsystems/ezpublish/vendor/composer/autoload_real.php we have: require __DIR__ . '/ClassLoader.php'; Is it possible to do this change in that autoload_real.php?: -require __DIR__ . '/ClassLoader.php'; +require_once __DIR__ . '/ClassLoader.php';
        Hide
        André Rømcke added a comment -

        > Is it possible to do this change in that autoload_real.php?:
        No, this is auto generated code from composer.

        Show
        André Rømcke added a comment - > Is it possible to do this change in that autoload_real.php?: No, this is auto generated code from composer.
        Hide
        André Rømcke added a comment -

        But you can try commenting out this part in bootstrap.php:

        $classLoader = require_once __DIR__ . "/vendor/autoload.php";
         
        if ( $classLoader instanceof Composer\Autoload\ClassLoader )
            $classLoader->register();

        Unsure how much it is needed.

        Show
        André Rømcke added a comment - But you can try commenting out this part in bootstrap.php: $classLoader = require_once __DIR__ . "/vendor/autoload.php";   if ( $classLoader instanceof Composer\Autoload\ClassLoader ) $classLoader->register(); Unsure how much it is needed.
        Hide
        André Rømcke added a comment -

        But this issue will surface again as soon as we switch to using composer and Symfony in bootstrap, hopefully sometime next week.

        Show
        André Rømcke added a comment - But this issue will surface again as soon as we switch to using composer and Symfony in bootstrap, hopefully sometime next week.
        Hide
        Vidar Langseid added a comment -

        Yes, commenting out the part you refere to above fixes the problem

        Show
        Vidar Langseid added a comment - Yes, commenting out the part you refere to above fixes the problem

          People

          • Assignee:
            Unassigned
            Reporter:
            Vidar Langseid
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: