Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-11415

Accessing phpbb_migrations table from index page (or other pages)

    Details

    • Type: Bug
    • Status: Unverified Fix
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.1.0-dev
    • Fix Version/s: 3.1.0-a1
    • Component/s: None
    • Labels:
      None

      Description

      Index page performs

      SELECT *
      FROM phpbb_migrations

      See https://area51.phpbb.com/phpBB/viewtopic.php?p=251655#p251655

        Activity

        Hide
        bantu Andreas Fischer added a comment - - edited

        With debug:

        #0  phpbb_db_migrator->__construct()
        #1  ReflectionClass->newInstanceArgs() called at [/var/www/projects/phpbb3/phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:764]
        #2  Symfony\Component\DependencyInjection\ContainerBuilder->createService() called at [/var/www/projects/phpbb3/phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:353]
        #3  Symfony\Component\DependencyInjection\ContainerBuilder->get() called at [/var/www/projects/phpbb3/phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:831]
        #4  Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() called at [/var/www/projects/phpbb3/phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:828]
        #5  Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() called at [/var/www/projects/phpbb3/phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:749]
        #6  Symfony\Component\DependencyInjection\ContainerBuilder->createService() called at [/var/www/projects/phpbb3/phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:353]
        #7  Symfony\Component\DependencyInjection\ContainerBuilder->get() called at [/var/www/projects/phpbb3/phpBB/includes/functions_container.php:91]
        #8  phpbb_create_compiled_container() called at [/var/www/projects/phpbb3/phpBB/includes/functions_container.php:161]
        #9  phpbb_create_dumped_container_unless_debug() called at [/var/www/projects/phpbb3/phpBB/includes/functions_container.php:186]
        #10 phpbb_create_default_container() called at [/var/www/projects/phpbb3/phpBB/common.php:91]
        #11 include(/var/www/projects/phpbb3/phpBB/common.php) called at [/var/www/projects/phpbb3/phpBB/index.php:19]
        

        Without debug:

        #0  phpbb_db_migrator->__construct()
        #1  ReflectionClass->newInstanceArgs() called at [/var/www/projects/phpbb3/phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:764]
        #2  Symfony\Component\DependencyInjection\ContainerBuilder->createService() called at [/var/www/projects/phpbb3/phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:353]
        #3  Symfony\Component\DependencyInjection\ContainerBuilder->get() called at [/var/www/projects/phpbb3/phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:831]
        #4  Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() called at [/var/www/projects/phpbb3/phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:828]
        #5  Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() called at [/var/www/projects/phpbb3/phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:749]
        #6  Symfony\Component\DependencyInjection\ContainerBuilder->createService() called at [/var/www/projects/phpbb3/phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:353]
        #7  Symfony\Component\DependencyInjection\ContainerBuilder->get() called at [/var/www/projects/phpbb3/phpBB/includes/functions_container.php:91]
        #8  phpbb_create_compiled_container() called at [/var/www/projects/phpbb3/phpBB/includes/functions_container.php:128]
        #9  phpbb_create_dumped_container() called at [/var/www/projects/phpbb3/phpBB/includes/functions_container.php:161]
        #10 phpbb_create_dumped_container_unless_debug() called at [/var/www/projects/phpbb3/phpBB/includes/functions_container.php:186]
        #11 phpbb_create_default_container() called at [/var/www/projects/phpbb3/phpBB/common.php:91]
        #12 include(/var/www/projects/phpbb3/phpBB/common.php) called at [/var/www/projects/phpbb3/phpBB/index.php:19]
        

        Show
        bantu Andreas Fischer added a comment - - edited With debug: #0 phpbb_db_migrator->__construct() #1 ReflectionClass->newInstanceArgs() called at [/var/www/projects/phpbb3/phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:764] #2 Symfony\Component\DependencyInjection\ContainerBuilder->createService() called at [/var/www/projects/phpbb3/phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:353] #3 Symfony\Component\DependencyInjection\ContainerBuilder->get() called at [/var/www/projects/phpbb3/phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:831] #4 Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() called at [/var/www/projects/phpbb3/phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:828] #5 Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() called at [/var/www/projects/phpbb3/phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:749] #6 Symfony\Component\DependencyInjection\ContainerBuilder->createService() called at [/var/www/projects/phpbb3/phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:353] #7 Symfony\Component\DependencyInjection\ContainerBuilder->get() called at [/var/www/projects/phpbb3/phpBB/includes/functions_container.php:91] #8 phpbb_create_compiled_container() called at [/var/www/projects/phpbb3/phpBB/includes/functions_container.php:161] #9 phpbb_create_dumped_container_unless_debug() called at [/var/www/projects/phpbb3/phpBB/includes/functions_container.php:186] #10 phpbb_create_default_container() called at [/var/www/projects/phpbb3/phpBB/common.php:91] #11 include(/var/www/projects/phpbb3/phpBB/common.php) called at [/var/www/projects/phpbb3/phpBB/index.php:19] Without debug: #0 phpbb_db_migrator->__construct() #1 ReflectionClass->newInstanceArgs() called at [/var/www/projects/phpbb3/phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:764] #2 Symfony\Component\DependencyInjection\ContainerBuilder->createService() called at [/var/www/projects/phpbb3/phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:353] #3 Symfony\Component\DependencyInjection\ContainerBuilder->get() called at [/var/www/projects/phpbb3/phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:831] #4 Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() called at [/var/www/projects/phpbb3/phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:828] #5 Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() called at [/var/www/projects/phpbb3/phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:749] #6 Symfony\Component\DependencyInjection\ContainerBuilder->createService() called at [/var/www/projects/phpbb3/phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:353] #7 Symfony\Component\DependencyInjection\ContainerBuilder->get() called at [/var/www/projects/phpbb3/phpBB/includes/functions_container.php:91] #8 phpbb_create_compiled_container() called at [/var/www/projects/phpbb3/phpBB/includes/functions_container.php:128] #9 phpbb_create_dumped_container() called at [/var/www/projects/phpbb3/phpBB/includes/functions_container.php:161] #10 phpbb_create_dumped_container_unless_debug() called at [/var/www/projects/phpbb3/phpBB/includes/functions_container.php:186] #11 phpbb_create_default_container() called at [/var/www/projects/phpbb3/phpBB/common.php:91] #12 include(/var/www/projects/phpbb3/phpBB/common.php) called at [/var/www/projects/phpbb3/phpBB/index.php:19]
        Hide
        EXreaction EXreaction [X] (Inactive) added a comment -

        So if I understand that correctly, the container builder instantiates all classes right away? Is this due to the migrator being a requirement for something else or is this just something the container does?

        If someone could write up a quick test by creating a new class and registering it with the container to see if its constructor is called that would be really helpful (also see what happens if it's a dependency for something else that is or isn't used).

        Show
        EXreaction EXreaction [X] (Inactive) added a comment - So if I understand that correctly, the container builder instantiates all classes right away? Is this due to the migrator being a requirement for something else or is this just something the container does? If someone could write up a quick test by creating a new class and registering it with the container to see if its constructor is called that would be really helpful (also see what happens if it's a dependency for something else that is or isn't used).
        Hide
        nickvergessen Joas Schilling added a comment -

        I just added a class with

        	function __construct()
        	{
        		var_dump('foo');
        	}

        And it didnt get executed, until I get('foo') or get('depends_on_foo')

        So the problem is indeed, that phpbb_extension_manager depends on phpbb_db_migrator, what it shouldn't

        Show
        nickvergessen Joas Schilling added a comment - I just added a class with function __construct() { var_dump('foo'); } And it didnt get executed, until I get('foo') or get('depends_on_foo') So the problem is indeed, that phpbb_extension_manager depends on phpbb_db_migrator, what it shouldn't
        Hide
        nickvergessen Joas Schilling added a comment -

        The manager depends on the container anyway, so we can get the migrator only when needed.
        So I did that in my PR

        Show
        nickvergessen Joas Schilling added a comment - The manager depends on the container anyway, so we can get the migrator only when needed. So I did that in my PR
        Hide
        nickvergessen Joas Schilling added a comment -

        <naderman> nickvergessen: no that is bad too
        <naderman> the dependency is still there
        <naderman> now you have just hidden it which is even worse
        <naderman> there is an architectural problem that the extension manager deals with migrations
        <naderman> this is what the base extension was supposed to be used for
        <nickvergessen> well the other thing i had in mind was
        <nickvergessen> to remove $this->load_migration_state(); from migrator constrcut

        however that means we have to call it manually where required.

        Show
        nickvergessen Joas Schilling added a comment - <naderman> nickvergessen: no that is bad too <naderman> the dependency is still there <naderman> now you have just hidden it which is even worse <naderman> there is an architectural problem that the extension manager deals with migrations <naderman> this is what the base extension was supposed to be used for <nickvergessen> well the other thing i had in mind was <nickvergessen> to remove $this->load_migration_state(); from migrator constrcut however that means we have to call it manually where required.

          People

          • Assignee:
            EXreaction EXreaction [X] (Inactive)
            Reporter:
            bantu Andreas Fischer
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development