Skip to content

Commit 0cbff8c

Browse files
committed
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.
1 parent 0b04426 commit 0cbff8c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

jsonld.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2382,6 +2382,10 @@ protected function _expand(
23822382

23832383
// @language must be a string
23842384
if($expanded_property === '@language') {
2385+
if($value === null) {
2386+
// drop null @language values, they expand as if they didn't exist
2387+
continue;
2388+
}
23852389
if(!is_string($value)) {
23862390
throw new JsonLdException(
23872391
'Invalid JSON-LD syntax; "@language" value must not be a string.',

0 commit comments

Comments
 (0)