From 0cbff8c6000e706e435eef35dbb9c64ddcacd73d Mon Sep 17 00:00:00 2001 From: Dave Longley Date: Sat, 7 Feb 2015 20:07:49 -0500 Subject: [PATCH] Drop null `@language` values when expanding. - There's an inconsistency between the syntax spec and the API spec; the API spec throws an error if null is used for a `@language` value on Step 7.4.7 of the Expansion Algorithm, but the syntax spec allows it. When used, it indicates the value has no language -- which is the same as if `@language` were omitted, so it's treated the same way in this patch. --- jsonld.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jsonld.php b/jsonld.php index bcaa2c4..281a3d1 100644 --- a/jsonld.php +++ b/jsonld.php @@ -2382,6 +2382,10 @@ class JsonLdProcessor { // @language must be a string if($expanded_property === '@language') { + if($value === null) { + // drop null @language values, they expand as if they didn't exist + continue; + } if(!is_string($value)) { throw new JsonLdException( 'Invalid JSON-LD syntax; "@language" value must not be a string.',