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

Not automatically using the autoloader in GlobalState.php during class_exists #754

Closed
wants to merge 1 commit into from

Conversation

brobie
Copy link

@brobie brobie commented Dec 17, 2012

We found this need because:

  1. We do not have PHP_Invoker installed.
  2. We have multiple autoloaders registered
  3. When the class_exists was checking for "PHP_Invoker" it was
    automatically trying to autoload it and failing in a way that fatally
    ended our phpunit tests.

We found this need because:
1. We do now have PHP_Invoker installed.
2. We have multiple autoloaders registered
3. When the class_exists was checking for "PHP_Invoker" it was
automatically trying to autoload it and failing in a way that fatally
ended our phpunit tests.
@edorian
Copy link
Contributor

edorian commented Dec 19, 2012

While we don't grantee that PHPUnit never ever calls the autoloader and suggest to not have a autoloader that dies when it doesn't find a file this case seems like something that is avoidable. I'm not sure when those files are loaded but I assume it's before code coverage and in that case everything that has been executed can be blacklisted and the rest can be safely ignored.

Thanks for the PR!

@tohann
Copy link

tohann commented Dec 19, 2012

We're interested in this fix, too. Does that mean this pull request will be accepted?

@edorian
Copy link
Contributor

edorian commented Dec 19, 2012

@tohann I currently don't oversee the implications of this and don't have time to regression test it so my plan was to leave it for Sebastian to decide.

If it doesn't break anything or cause other issues I don't see why it shouldn't be merged. We already try to avoid autoloader calls where possible.

@tohann
Copy link

tohann commented Jan 2, 2013

Cool, thanks for the update!

@jasonevans1
Copy link

I am interested in having this pull request accepted too.

@simonrjones
Copy link

I too would like to see this pull request accepted. I've been writing some phpunit tests and came across this issue when I'm using the spl autoloader to autoload classes.

thanks,
Simon

@sebastianbergmann
Copy link
Owner

I am against this. Autoloaders are stackable (as in: you can have more than one registered). An autoloader should do NOTHING when it is not responsible for a class.

@spencer-aerian
Copy link

Come on Sebastian. Invoker is an optional package (according to the documentation) but you are making it a prerequisite. This is breaking lots of developers if its not loaded (and if you do load it you then have to muck about installing an optional php extension locally and on integration servers.)
I think the patch 'should be applied'.

@sebastianbergmann
Copy link
Owner

I agree that the current situation is not ideal and am open to suggestion for how to improve it. Messing with the autoloader, however, because of broken autoloaders (see my comment in #754 (comment)) is not an option.

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

Successfully merging this pull request may close these issues.

8 participants