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.
This commit is contained in:
Dave Longley 2015-02-07 20:07:49 -05:00
parent 0b0442696d
commit 0cbff8c600

View file

@ -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.',