Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error after updating to #55c3f875f08a333848284cdbc1fd3e0cea4e6776 #287

Open
mzampetakis opened this issue Sep 28, 2017 · 22 comments

Comments

@mzampetakis
Copy link

mzampetakis commented Sep 28, 2017

After updating to commit#55c3f875f08a333848284cdbc1fd3e0cea4e6776
I get this error while clearing my cache:

[RuntimeException]                                                                 
  An error occurred when executing the "'cache:clear --no-warmup'" command:          
  
[LogicException]                                                                 
    You must call one of in() or append() methods before iterating over a Finder.

Going back to #4adca6ba4feec25869c16a8af2ade9f20fc62f91 it worked fine.

@greg0ire
Copy link
Contributor

@gremo please help

@greg0ire
Copy link
Contributor

@mzampetakis can you please provide the output of the same command with the -vvv flag? Also, can you show the output of composer outdated --no-ansi?

@mzampetakis
Copy link
Author

php app/console cache:clear --env=prod -vvv

 // Clearing the cache for the prod environment with debug false                                                        

 // Clearing outdated warmup directory...                                                                               

 // Warming up cache...                                                                                                 


                                                                                 
  [LogicException]                                                               
  You must call one of in() or append() methods before iterating over a Finder.  
                                                                                 

Exception trace:
 () at /Applications/MAMP/htdocs/newLoggia/loggiaConsole/vendor/symfony/symfony/src/Symfony/Component/Finder/Finder.php:677
 Symfony\Component\Finder\Finder->getIterator() at /Applications/MAMP/htdocs/newLoggia/loggiaConsole/vendor/jms/di-extra-bundle/HttpKernel/ControllerInjectorsWarmer.php:86
 JMS\DiExtraBundle\HttpKernel\ControllerInjectorsWarmer->findControllerClasses() at /Applications/MAMP/htdocs/newLoggia/loggiaConsole/vendor/jms/di-extra-bundle/HttpKernel/ControllerInjectorsWarmer.php:60
 JMS\DiExtraBundle\HttpKernel\ControllerInjectorsWarmer->warmUp() at /Applications/MAMP/htdocs/newLoggia/loggiaConsole/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php:48
 Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate->warmUp() at /Applications/MAMP/htdocs/newLoggia/loggiaConsole/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:526
 Symfony\Component\HttpKernel\Kernel->initializeContainer() at /Applications/MAMP/htdocs/newLoggia/loggiaConsole/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:133
 Symfony\Component\HttpKernel\Kernel->boot() at /Applications/MAMP/htdocs/newLoggia/loggiaConsole/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php:134
 Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->warmup() at /Applications/MAMP/htdocs/newLoggia/loggiaConsole/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php:96
 Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->execute() at /Applications/MAMP/htdocs/newLoggia/loggiaConsole/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:266
 Symfony\Component\Console\Command\Command->run() at /Applications/MAMP/htdocs/newLoggia/loggiaConsole/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:893
 Symfony\Component\Console\Application->doRunCommand() at /Applications/MAMP/htdocs/newLoggia/loggiaConsole/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:204
 Symfony\Component\Console\Application->doRun() at /Applications/MAMP/htdocs/newLoggia/loggiaConsole/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:93
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /Applications/MAMP/htdocs/newLoggia/loggiaConsole/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:122
 Symfony\Component\Console\Application->run() at /Applications/MAMP/htdocs/newLoggia/loggiaConsole/app/console:29

cache:clear [--no-warmup] [--no-optional-warmers] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-s|--shell] [--process-isolation] [-e|--env ENV] [--no-debug] [--] <command>

@mzampetakis
Copy link
Author

$ composer outdated --no-ansi
bcc/cron-manager-bundle              v2.6.1             v3.1               A cron table manager bundle for Symfony2
cocur/slugify                        v2.5               v3.0.1             Converts a string into a slug.
cspoo/swiftmailer-mailgun-bundle     0.2.1              0.4.0              Swiftmailer Mailgun bundle
firebase/php-jwt                     v3.0.0             v5.0.0             A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.
friendsofsymfony/rest-bundle         1.7.7              2.2.0              This Bundle provides various tools to rapidly develop RESTful API's with Symfony
friendsofsymfony/user-bundle         v1.3.7             v2.0.1             Symfony FOSUserBundle
guzzle/guzzle                        v3.9.3             v3.9.3             PHP HTTP client. This library is deprecated in favor of https://packagist.org/packages/guzzlehttp/guzzle
Package guzzle/guzzle is abandoned, you should avoid using it. Use guzzlehttp/guzzle instead.
mailgun/mailgun-php                  v1.7.2             2.3.4              The Mailgun SDK provides methods for all API functions.
symfony/monolog-bundle               v2.12.1            v3.1.1             Symfony MonologBundle
symfony/phpunit-bridge               v2.8.27            v3.3.9             Symfony PHPUnit Bridge
symfony/swiftmailer-bundle           v2.6.3             v3.0.3             Symfony SwiftmailerBundle
symfony/symfony                      v2.8.27            v3.3.9             The Symfony PHP framework
willdurand/negotiation               1.5.0              v2.3.1             Content Negotiation tools for PHP provided as a standalone library.

@gremo
Copy link
Contributor

gremo commented Sep 28, 2017

@greg0ire are you sure it depends on my commit?

@greg0ire
Copy link
Contributor

greg0ire commented Sep 28, 2017

No I have no clue. @mzampetakis please use git bisect to determine which commit causes this issue. Also, I see you use sf 2.8, maybe there was a bc-break in the finder API ?

@mzampetakis
Copy link
Author

I have never used git bisect. Can you guide me please?

@greg0ire
Copy link
Contributor

If you have access to the sf slack please have a look at this conversation I had about bisecting: https://symfony-devs.slack.com/archives/C3GC7MKM5/p1506013758000022 (I should really write a blog post or something someday).

@greg0ire
Copy link
Contributor

And if you don't, https://symfony.com/slack-invite should get you in

@mzampetakis
Copy link
Author

mzampetakis commented Sep 28, 2017

I will try to bisect it later. However, going back to #4adca6ba4feec25869c16a8af2ade9f20fc62f91 worked fine. I indeed use sf 2.8.

@greg0ire
Copy link
Contributor

Links for the lazy: 55c3f87 482fdb8 (please don't put a # next time)

@greg0ire
Copy link
Contributor

Oh wow that's very weird. One of them is @gremo's commit, the other is the merge commit. Guess that means you are not at fault @gremo , and your PR was based on a still sane version of the branch. Good job!

@greg0ire
Copy link
Contributor

That means you should probably bisect between 4adca6b and 55c3f87

@mzampetakis
Copy link
Author

mzampetakis commented Sep 28, 2017

My mistake 4adca6b is the working one. I didn't try 482fdb8. Editing previous comments.

@adaniloff
Copy link

482fdb8 Seems to be the problematic one.

<?php
namespace JMS\DiExtraBundle\HttpKernel;
...
class ControllerInjectorsWarmer implements CacheWarmerInterface
{
    ...
    private function findControllerClasses()
    {
        ...
        if (!$this->scanAllBundles && !in_array($bundle->getName(), $this->scanBundles, true)) {
            continue;
        }
        ...
    }

If I comment the continue, the error doesn't show up.
I don't have the time to make any test right now, I just wanted to confirm the issue.

@gremo
Copy link
Contributor

gremo commented Sep 28, 2017

@adaniloff maybe because of this https://github.com/symfony/finder/blob/master/Finder.php#L566

@mzampetakis do you have all_bundles: false and bundles: [] in your configuration? In that case there are no directories to scan and Finder component will throw the exception.

Before my commit, all bundles where scanned. That is, the Finder component received at least one directory to scan. Now, this isn't true all the time.

Honestly, I was not aware of exception thrown in case of empty directories to scan.

@mzampetakis
Copy link
Author

mzampetakis commented Sep 28, 2017

@gremo, I don't know what these configurations are (all_bundles: false and bundles: []).
Where can I find them?

@gremo
Copy link
Contributor

gremo commented Sep 28, 2017

@mzampetakis can you past your JMSDiExtraBundle configuration?

@mzampetakis
Copy link
Author

mzampetakis commented Sep 28, 2017

@gremo my config

jms_di_extra:
    automatic_controller_injections:
        properties:
            request: "@request"
            router: "@router"

        method_calls:
            setRouter: ["@router"]

@gremo
Copy link
Contributor

gremo commented Sep 28, 2017

@mzampetakis thank you, I'll look and do some tests ASAP.

@adaniloff
Copy link

@gremo

Can't tell. I cannot check it up rightnow.
But I don't think that I have done the things you mentionned in your comment.

I'll tell as soon as I can.

Thanks for the help anyway.

@gremo
Copy link
Contributor

gremo commented Sep 28, 2017

I made a PR that should fix the error (#288). @greg0ire as new "maintainer" can you please review and check if it's right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants