Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
jstoller reports on IRC that pointing update.php to a D7 database results in "PHP Fatal error: Call to a member function isScopeActive() on a non-object in /path/to/site/core/includes/bootstrap.inc on line 2610".
Call chain of the bug:
- update_prepare_d8_bootstrap()
- drupal_install_config_directories()
- install_ensure_config_directory
- file_prepare_directory
- file_stream_wrapper_valid_scheme <= we need to make this not be called.
Comment | File | Size | Author |
---|---|---|---|
#33 | 1874562_33.patch | 6.31 KB | chx |
#33 | interdiff.txt | 525 bytes | chx |
#31 | 1874562_31.patch | 6.74 KB | chx |
#31 | interdiff.txt | 824 bytes | chx |
#30 | drupal-upgrade_path-1874562-29.patch | 6.81 KB | plach |
Comments
Comment #1
jstoller@chx, per your request, I inserted the following at line 2610 in bootstrap.inc:
This had no effect. Nothing in the error log.
If I put the backtrace in there without wrapping it in an if statement, then the error log reads:
Comment #2
jstollerInserted the following into bootstrap.inc at line 2588:
After running update.php, my Apache log contained the following error:
Comment #3
chx CreditAttribution: chx commentedQuite often we check the scheme separately before calling file_stream_wrapper_valid_scheme:
so I have enrolled using this pattern. Alternatively we could make file_stream_wrapper_valid_scheme(FALSE) return FALSE and make the code that much shorter for all of the above.
Comment #4
jstollerI applied the patch. When I load update.php, I get a WSOD and the following in my php error log:
[27-Dec-2012 04:39:39 UTC] PHP Fatal error: Call to a member function isScopeActive() on a non-object in /Users/jeremy/Sites/drupal-8.x/core/includes/bootstrap.inc on line 2622
However, if I reload the page a couple times, then it works.
The first time I load update.php, the
/sites/default/files/config_<…>/active/
directory is created, but nothing is in it.When I reload the browser,
/sites/default/files/config_<…>/active/README.txt
appears, along with an empty/sites/default/files/config_<…>/staging/
directory.Reload the browser one more time and everything works as expected. I also see four .yml files show up in
/sites/default/files/config_<…>/active/
, and/sites/default/files/php/
appears.I'd guess there's something about that README.txt file that's gumming up the works.
Comment #5
chx CreditAttribution: chx commentedMoar!
Comment #6
jstollerIt works! Updates ran as expected.
Comment #7
Alonzo Villanueva CreditAttribution: Alonzo Villanueva commentedit worked for me as well
Comment #9
chx CreditAttribution: chx commentedSo, previously getting system_list() primed by the call collecting the wrappers. Now this is removed. The following call chain happens:
but prepareEnvironment put an empty container in drupal_container so there is no container, no config factory, it just blows up -- and it only blows up in the simpletest test because you need drupal_valid_test_ua() inside prepareEnvironment(). We can safely just ignore that error.
Edit: note that drupal_static_reset and the setting of parent profile happens a bit later.
Comment #10
chx CreditAttribution: chx commentedComment #11
plach@chx:
I think an alternative fix is the index.php hunk of #1862202-17: Objectify the language system, would it make sense to try and get it in here?
Comment #12
plachBtw, looking at the stack trace in #2 the problem seems to lie in t(), which tries to get the language manager from an empty container. I think having the container in place earlier should fix things here.
In any case I think we need tests.
Comment #13
chx CreditAttribution: chx commentedWe need tests against... what? I am glad to write tests but the current upgrade tests pass and I am at a complete loss of why they would do that when all the code patched up here needs to run during an upgrade test anyways and it should totally blow up. I can only chalk it up to differences in environment (like system_list being primed as seen in #9). So, while in theory I agree with the needs tests tag I am at a complete loss of what to write.
That index.php won't solve anything. In general, update must not fire hooks and getting stream wrappers fires hooks. So, that needed to be shut down.
Comment #14
plachWe are two, then :)
I agree fixing the stream-wrapper hook invocation is the proper fix, thanks.
Comment #15
chx CreditAttribution: chx commentedCan we perhaps then go ahead with committing this and writing a test when we figure out what we can? Cos we have two people here confirming that the bug exists and the patch helps.
Comment #16
plachYes, sounds good, although I am afraid also the follow-up would be marked as critical...
Will try to review the patch ASAP.
Comment #17
plachI manually tested #19 and it fixes the issue reported in the OP. However I had to perform an additional fix + apply #1871032-4: Taxonomy module fails to install on MyISAM due to too long schema index to complete the upgrade successfully. I still don't get why upgrade path tests don't fail. If we want to skip tests until commit then I'd say this is RTBC.
Comment #18
plachForgot the interdiff. I am attaching also the D7 DB I used for testing the upgrade.
Comment #19
chx CreditAttribution: chx commentedExcept we do not want the SystemListingInfo change and now that the theme init is gone from TestBase, I am curious whether this patch works.
Comment #20
aspilicious CreditAttribution: aspilicious commentedIs this related?
Comment #21
plachYes, the upgrade does not complete without that hunk.
Comment #22
chx CreditAttribution: chx commentedNote: the only difference from #5 is the hunk mentioned in #20 which, as mentioned in #17 comes from #1871032: Taxonomy module fails to install on MyISAM due to too long schema index. The reason the patch passed now but not before is because we removed a broken
drupal_theme_initalize
inTestBase::setUp
in #1874694: Plugins broke mysteriously.Comment #23
chx CreditAttribution: chx commentedComment #24
plach@chx:
I think I didn't explain myself correctly: the
user.install
hunk is a missing part of #347988: Move $user->data into own table. To succesfully complete the upgrade we need this patch and #1871032: Taxonomy module fails to install on MyISAM due to too long schema index. We can keep trying to make tests fail here, but we will need that one to be committed before this one otherwise we will have failing tests in HEAD.Comment #25
plachI think I found the reason why tests are not failing: in the first access to update.php config directories and the service container are created for the first time, but in the upgrade tests these are initialized before accessing update.php. This hides the problems we are having here because the config directories are already in place and the stream wrappers do not need to be collected.
The attached interdiff fixes tests to initialize config directories and service container only after the first update.php access. This is supposed to fail to prove the tests capture the bug, while the full patch is supposed to come back green :)
Locally the upgrade path tests are failing due to the user data bug. No idea why the testbots do no fail, are they running tests on MySQL with InnoDB? Anyhow this does not need to be postponed on #1871032: Taxonomy module fails to install on MyISAM due to too long schema index.
Comment #26
plachThis comment needs to be fixed.
Comment #28
plachThis should fix language upgrade tests.
Comment #30
plachWrong patch... this one is what I mean to upload in #27.
Comment #31
chx CreditAttribution: chx commentedI would rather explicitly check whether the config.factory exists -- most of the time it doesn't.
Comment #32
plachDefinitely better :)
Comment #33
chx CreditAttribution: chx commentedMeanwhile, a simplification to file_stream_wrapper_valid_scheme went through so one of the hunks is no longer necessary. Doesn't affect functionality.
Comment #34
catch#33: 1874562_33.patch queued for re-testing.
Comment #35
catchCommitted/pushed to 8.x, thanks!
Comment #36
BerdirThe condition seems to be backwards here. $this->upgradedSite is initially FALSE and then set to TRUE after the upgrade run through. This seems to reset the variables while the site is not upgraded but not anymore afterwards. Note: The condition has not changed in this patch, it has been like this since this class was added ?!
I noticed this in #1825450: Use lock service in lock() which now tries to use the lock service right after the first call to update.php, but it is not yet defined.
Inverting the check results runs further but then produces the following notice, although it otherwise passes fine:
Which I confirmed also happens in 8.x with that condition is changed.
Comment #37
BerdirThe notice is from
'filepath' => $module_files[$name]
. Looks like the config cache got cleared and now contains minimal but state has not been updated?Comment #38
TechNikh CreditAttribution: TechNikh commentedI am getting the error when I run drush.
Comment #39.0
(not verified) CreditAttribution: commentedUpdated issue summary.