Closed (fixed)
Project:
Drupal core
Version:
8.7.x-dev
Component:
user system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Mar 2017 at 00:42 UTC
Updated:
3 Oct 2018 at 13:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
stephsem23 commentedgetting this same error as well when trying to update the address module. This error prevents
drush updb -yfrom completing the address module's db updates. I took a stab at a patch for this.Comment #3
ephod commentedHello I'm Michael,
I've seen that this method is using the chaining methods without checking if the result, which is being returned, is either a null or something else.
Therefore, I have created this patch to solve this issue.
Comment #4
ephod commentedComment #5
RumyanaRuseva commentedThank you for the patch. Here are a few changes:
1. I believe we can safely chain getCurrentRequest()->getSession(), because we should always have a request, so we do not need to check the result of every function.
2. Avoiding the error however may cause another problem - freely getting stored objects with owner NULL. This can be fixed either in get() not to return the object, or in set() so that it's not stored at all.
3. PrivateTempStore has been moved from Drupal\user to Drupal\Core\TempStore.
Comment #6
RumyanaRuseva commentedComment #7
juampynr commentedWorked well for me. I faced this error when running configuration migrations. Here is an screenshot:
I am also uploading another patch where I have updated the phpdoc and made explicit the return value.
Comment #8
juampynr commentedDoh. Removed an unneeded blank line.
Comment #11
heddnLet's see if that has fewer errors.
Comment #12
heddnMore semantic use of the API.
Comment #16
joelpittet@heddn, I'm a bit fussy but$has_sessionimplies a boolean value is stored. There is ahasSession()method that does return a boolean on that object though.Edit, apparently my coffee didn't kick in yet...
Comment #17
heddnThat's what I'm doing, no?
Comment #19
firfin commentedI was until now using the work-around patch from #2976862: PrivateTempStore throws exception if session is not started (drush users) which works spendidly. But tht's just aworkaround, so I thought I would check out this one. Currently testing, it applied without problems and I don't get errors anymore. I have used it with half a dozen custom migration files so far.
Edit:
One question though? Why is this still (again) on NW ?
Ah a failure on testing:
Unfortunately I have no idea how to fix that.
Comment #20
seanbThis should fix the test.
Comment #21
heddnI don't see the interdiff included in the patch? Is it just me?
Comment #22
seanbThe problem was that the patch in #12 removed some code that was still needed. Just the extra
$this->startSession();was added toPrivateTempStore::set().Comment #23
robertom commentedsorry if I disturb the thread with a backport, but I need an equivalent patch for an old 8.4.x and the CI
Comment #25
robertom commentedreset need review for the comment #20 #2860341-20: PrivateTempStore->getOwner Attempts to access possibly unset Request Session
Comment #26
firfin commentedPatch from #20 works fine for me. Applies, fixes my problem (which was that importers weren't running with migrate_tools ), saw no other error. Been using it for 3 days without problems.
Comment #27
alexpott@robertom the last patch on the issue should be the rtbc patch so adding an 8.4.x does upset the issue. If you do this in the future please upload the correct patch again in the next comment.
Comment #28
alexpottUpdating commit credit to credit people who contributed patches which progressed the issue.
Comment #29
alexpottCommitted and pushed 7ae9670d22 to 8.7.x and 590a5e7904 to 8.6.x. Thanks!