From d27ad5f210d314b216a425c3d6cfe538ab3ee447 Mon Sep 17 00:00:00 2001 From: Dave Longley Date: Sat, 14 Sep 2013 14:19:27 -0400 Subject: [PATCH] Use remote doc documentUrl as base. --- jsonld.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jsonld.php b/jsonld.php index af3d2a5..4e996fc 100644 --- a/jsonld.php +++ b/jsonld.php @@ -833,7 +833,6 @@ class JsonLdProcessor { */ public function expand($input, $options) { self::setdefaults($options, array( - 'base' => is_string($input) ? $input : '', 'keepFreeFloatingNodes' => false, 'documentLoader' => 'jsonld_default_document_loader')); @@ -865,6 +864,9 @@ class JsonLdProcessor { array('remoteDoc' => $remote_doc), $e); } + // set default base + self::setdefault($options, 'base', $remote_doc->documentUrl ?: ''); + // build meta-object and retrieve all @context urls $input = (object)array( 'document' => self::copy($remote_doc->document),