Problem/Motivation

Trying to save an entity programmatically on a psy console results in the following warning and error:

WARNING Attempt to read property "attributes" on null in modules/contrib/geocoder/modules/geocoder_field/geocoder_field.module on line 179.
Error Call to a member function get() on null.

Steps to reproduce

Open a drush cli with `drush php`
Create and save a node like this
$node = \Drupal\node\Entity\Node::create(['type' => 'article', 'title' => 'test']);
$node->save();

Related issue (can't add it on d.o):
#3301512: Extend the ability to skip geocoding when processing a large number of entity updates, like migrations or workspace publishing

Proposed resolution

Don't assume there is always a request

Remaining tasks

Code

User interface changes

None

API changes

None

Data model changes

None

Issue fork geocoder-3619252

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

rodrigoaguilera created an issue. See original summary.

rodrigoaguilera’s picture

Status: Active » Needs review
rodrigoaguilera’s picture

Issue summary: View changes
amateescu’s picture

Posted a code suggestion on the MR, otherwise this looks good to me.

itamair’s picture

Status: Needs review » Reviewed & tested by the community

Thx @rodrigoaguilera.
I could reproduce and your MR !83 fixes this issue.
Going to merge into 8.x-4.x, will be parto of next Geocoder release.

itamair’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

tobiasb’s picture

For people who ask themselves, this was never a problem, or project B does not have it.

Drupal Core 11.4 is the source. #2613044: Requests are pushed onto the request stack twice, popped once

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.