Fix bugs to pass expansion tests.
This commit is contained in:
parent
6fbdfaa3b6
commit
a8ce5ba4a2
|
@ -1750,7 +1750,7 @@ class JsonLdProcessor {
|
|||
// handle index container (skip if value is not an object)
|
||||
else if($container === '@index' && is_object($value)) {
|
||||
$expand_index_map = function($active_property) use (
|
||||
$active_ctx, $active_property, $options, $value) {
|
||||
$active_ctx, $options, $value) {
|
||||
$rval = array();
|
||||
$keys = array_keys((array)$value);
|
||||
sort($keys);
|
||||
|
@ -1779,7 +1779,7 @@ class JsonLdProcessor {
|
|||
$next_active_property = null;
|
||||
}
|
||||
$expanded_value = $this->_expand(
|
||||
$active_ctx, $active_property, $value, $options, $is_list);
|
||||
$active_ctx, $next_active_property, $value, $options, $is_list);
|
||||
if($is_list && self::_isList($expanded_value)) {
|
||||
throw new JsonLdException(
|
||||
'Invalid JSON-LD syntax; lists of lists are not permitted.',
|
||||
|
@ -1899,7 +1899,7 @@ class JsonLdProcessor {
|
|||
!$options['keepFreeFloatingNodes'] && !$inside_list &&
|
||||
($active_property === null || $expanded_active_property === '@graph')) {
|
||||
// drop empty object or top-level @value
|
||||
if($count === 0 || property_exists($rval, '@value')) {
|
||||
if($count === 0 || property_exists($rval, '@value')) {
|
||||
$rval = null;
|
||||
}
|
||||
else {
|
||||
|
@ -1912,7 +1912,7 @@ class JsonLdProcessor {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if(!$has_triples) {
|
||||
if(!$has_triples) {
|
||||
$rval = null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue