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

DependencyChecker tries to load a class that should not be loaded #124

Closed
enumag opened this issue Aug 9, 2016 · 4 comments
Closed

DependencyChecker tries to load a class that should not be loaded #124

enumag opened this issue Aug 9, 2016 · 4 comments

Comments

@enumag
Copy link
Contributor

@enumag enumag commented Aug 9, 2016

It's probably best to show this on the real case:

  • Kdyby\Events\EventsManager::setPanel() needs argument of Kdyby\Events\Diagnostics\Panel
  • Kdyby\Events\Diagnostics\Panel implements Tracy\IBarPanel
  • kdyby/events has tracy/tracy as an optional dependency
  • => Tracy\IBarPanel may not exist
  • but that does not matter because Kdyby\Events\Diagnostics\Panel is never loaded at all

The problem is that DependencyChecker is still trying to load the Kdyby\Events\Diagnostics\Panel class:

  • DependencyChecker::calculateHash() iterates over all public methods of Kdyby\Events\EventsManager which of course includes the setPanel method
  • calculateHash calls DependencyChecker::hashParameters() which iterates over all parameters of the setPanel() method (which is only the panel parameters).
  • hashParameters calls PhpReflection::getParameterType($param)
  • getParameterType calls) $param->getClass()
  • that will try to autoload the Kdyby\Events\Diagnostics\Panel class
  • which of course fail with Fatal error: Interface 'Tracy\IBarPanel' not found
  • (no ReflectionException to catch, just fatal error)
@dg

This comment has been minimized.

Copy link
Member

@dg dg commented Aug 9, 2016

Seems like PHP 5 bug, can you report it?

(A little bit similar to https://bugs.php.net/bug.php?id=72635)

@enumag

This comment has been minimized.

Copy link
Contributor Author

@enumag enumag commented Aug 9, 2016

I don't think it's a PHP bug... ReflectionClass autoloads the class in question, composer finds the file where the class is and includes it, PHP throws Fatal error because it is unable to execute the file because of the missing interface. Which part is buggy in your opinion? I think all of it is normal. Certainly not ideal but normal nonetheless.

EDIT: probably not relevant but I'm using PHP 5.6.24.

@dg dg closed this in ed1b902 Aug 9, 2016
@enumag

This comment has been minimized.

Copy link
Contributor Author

@enumag enumag commented Aug 9, 2016

@dg That was fast! Thank you. 👍

@enumag

This comment has been minimized.

Copy link
Contributor Author

@enumag enumag commented Aug 10, 2016

Ok, maybe it is a PHP bug. My build on Travis failed on PHP 5.6 but passed on 5.5, 7.0 and 7.1.

enumag added a commit to DeprecatedPackages/ArachneEventDispatcher that referenced this issue Aug 10, 2016
enumag added a commit to Arachne/Doctrine that referenced this issue Aug 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.