Closed (fixed)
Project:
Drupal core
Version:
8.1.x-dev
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
12 Jul 2016 at 10:38 UTC
Updated:
12 Sep 2016 at 12:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
lainosantos commentedComment #3
cilefen commentedComment #4
cilefen commentedDid you delete core/ and vendor/ when you upgraded?
Comment #5
alexpottWhat's interesting about this is why isn't DrupalCI failling over with the same fail. Or my own local dev environment - I have the same empty files.
Comment #6
alexpott@ianosantos thanks for the bug report. Any additional information you could give on your environment / steps to reproduce would be fantastic.
Comment #7
alexpottSteps I've taken to try to reproduce the bug:
This error is not seen...
@ianosantos - just wondering - are you doing anything special with the autoloader?
Comment #8
lainosantos commented@alexpott Yes, I do it.
I use the package drupal/core (https://packagist.org/packages/drupal/core) as a dependency, because i created a symfony blundle for use Drupal as CMS to my company's systems. Then, i do core update by 'composer update drupal/core'.
The problem is because I boot and handle DrupalKernel inside my bundle, and at that moment the symfony has added the \Symfony\Component\Debug\DebugClassLoader as class loader (decorates composer autolaod object). This auto load class throws a exception because the file don't have the class definition.
This error only occurs on smfony dev environment, whereas in prod symfony doesn't attach the debug auto loader.
But, this file without class definition violates the PSR-0 and PSR-4.
Comment #9
catchOK that's worth fixing, but doesn't meet our definition of critical bug. Could you try this patch?
Comment #10
alexpottI guess we need to do that for both core/modules/user/src/UserServiceProvider.php and core/modules/user/src/MigratePassword.php
Comment #11
alexpottOne thing of course that is now weird is that the UserServiceProvider does not implement ServiceProviderInterface ... fortunately this works because...
However the patch in #9 is changing the behaviour of D8 HEAD, as regardless of the autoloader, class_exists('\Drupal\User\UserServiceProvider') returns FALSE - and now with this patch it will return TRUE.
Comment #12
lainosantos commentedComment #13
lainosantos commentedComment #14
lainosantos commentedThank you everyone, this patch fixes the problem.
@catch, excuse me. I really tought that composer autolaod broke on violation from PSR-0 or PSR-4, but it was symfony debug autoload.
@alexpott, it return true is the expected value, isn't is? The symfony debug autoload throws an error when the file don't declares the class, but not only symfony, others autoloaders may do this because this is in accordance with PSRs.
Comment #15
alexpott@lainosantos
I've read the PSRs - I'm not sure it is in accordance. This might be splitting hairs but the PSRs are about where a file containing a class in the file system should exist. As far as I can see there is nothing that says if the file exists it has to contain the class. In fact, the autoload standard says that autoloading should not throw errors or exceptions. So the symfony debug autoload is the one breaking the standard :)
Comment #16
lainosantos commented@alexpott, you're right :), this isn't explicit rule, but is implicit that the class definition respects the filesystem.
Symfony throws only in dev, for debug purpose and prevent error.
I think that the user should delete the directories before update core, it's the rule while Drupal don't provides it automatically. And not keep file history in code.
Comment #17
lainosantos commentedThis patch woks.
This issue may be fixed, until they solving drupal core update.
Comment #18
lainosantos commentedComment #19
alexpott@lainosantos did you mean to set this patch to "reviewed and tested by the community"?
Comment #20
lainosantos commented@alexpott, excuse me. I thought "Patch (to be ported)" indecated that the patch works for me.
Comment #21
lainosantos commentedHello everyone, This will be fixed in 8.1.9?
Comment #22
lainosantos commentedPlease, fix this.
Comment #23
alexpott@lainosantos if you provide evidence of testing and set the issue to "reviewed and tested by the community" then we can.
Comment #24
lainosantos commentedComment #25
alexpottCommitted and pushed bfd9b82 to 8.3.x and 482ae50 to 8.2.x and a55f7a2 to 8.1.x. Thanks!
Comment #29
alexpottThis turned out not to be a major bug.