forked from friendica/php-json-ld
Fixes to pass property CURIE conflict during compact.
This commit is contained in:
parent
25c62ddac1
commit
dbd83f1535
13
jsonld.php
13
jsonld.php
|
@ -690,7 +690,9 @@ function _compact($ctx, $property, $value, $usedCtx)
|
||||||
|
|
||||||
if($value === null)
|
if($value === null)
|
||||||
{
|
{
|
||||||
|
// return null, but check coerce type to add to usedCtx
|
||||||
$rval = null;
|
$rval = null;
|
||||||
|
_getCoerceType($ctx, $property, $usedCtx);
|
||||||
}
|
}
|
||||||
else if(is_array($value))
|
else if(is_array($value))
|
||||||
{
|
{
|
||||||
|
@ -721,10 +723,13 @@ function _compact($ctx, $property, $value, $usedCtx)
|
||||||
{
|
{
|
||||||
if($v !== '@context')
|
if($v !== '@context')
|
||||||
{
|
{
|
||||||
// set object to compacted property
|
// set object to compacted property, only overwrite existing
|
||||||
_setProperty(
|
// properties if the property actually compacted
|
||||||
$rval, _compactIri($ctx, $key, $usedCtx),
|
$p = _compactIri($ctx, $key, $usedCtx);
|
||||||
_compact($ctx, $key, $v, $usedCtx));
|
if($p !== $key or !property_exists($rval, $p))
|
||||||
|
{
|
||||||
|
$rval->$p = _compact($ctx, $key, $v, $usedCtx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue