Problem/Motivation

In some cases export contains references to a null objects, e.g. when referring to a parent of a zero-level taxonomy term.
Later, when import occurs, this results in a "Trying to access array offset on value of type null" warning, which generally passes silently except for some specific cases such as test env setup for PHPUnit.

Steps to reproduce

Create and export taxonomy term, try importing it on another env(or after deleting, so that import actually works).

Proposed resolution

Check contents of the $decoded['_embedded'] items before using them.

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

Temoor created an issue. See original summary.

temoor’s picture

Status: Active » Needs review
StatusFileSize
new667 bytes
temoor’s picture

Version: 8.x-1.x-dev » 2.0.x-dev
StatusFileSize
new687 bytes

Rerolled for 2.0.x version.
While yml export of 2.0.x isn't affected, hal+json from 8.x-1.x is still supported and can cause the same issue.

mlncn’s picture

Status: Needs review » Reviewed & tested by the community

Very nice, thank you! A few fewer notices in the log.

Rajeshreeputra made their first commit to this issue’s fork.

andypost’s picture

Assigned: Unassigned » berdir

I find it ready but probably missing test

berdir’s picture

Yes, haven't seen this appearing in tests, I think we have term test too? ^

Checking the input doesn't hurt, but I think I'd prefer to not export NULL dependencies in the first place.

berdir’s picture

Status: Reviewed & tested by the community » Fixed

A bit pointless now I feel, per #3 this only affects deprecated hal+json import, and I hope nobody is still using that at this point.

Status: Fixed » Closed (fixed)

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