From 2760055bd21939aec7462353b8777108389fd3e3 Mon Sep 17 00:00:00 2001 From: Dave Longley Date: Tue, 12 Jun 2012 20:36:12 -0400 Subject: [PATCH] Update to fix value compaction when there is a default language. --- jsonld.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/jsonld.php b/jsonld.php index c997748..4238b5f 100644 --- a/jsonld.php +++ b/jsonld.php @@ -1146,9 +1146,14 @@ class JsonLdProcessor { if(is_object($element)) { // element is a @value if(self::_isValue($element)) { - // if @value is the only key, return its value + // if @value is the only key if(count(get_object_vars($element)) === 1) { - return $element->{'@value'}; + // if there is no default language, return value of @value + if(!property_exists($ctx, '@language')) { + return $element->{'@value'}; + } + // return full element + return $element; } // get type and language context rules