Fix bug with parsing @base.

This commit is contained in:
Dave Longley 2013-03-01 11:21:29 -05:00
parent 5847ac58b1
commit 9a760ef766
1 changed files with 3 additions and 5 deletions

View File

@ -1,7 +1,7 @@
<?php <?php
/** /**
* PHP implementation of the JSON-LD API. * PHP implementation of the JSON-LD API.
* Version: 0.0.12 * Version: 0.0.13
* *
* @author Dave Longley * @author Dave Longley
* *
@ -2645,7 +2645,7 @@ class JsonLdProcessor {
if(property_exists($ctx, '@base')) { if(property_exists($ctx, '@base')) {
$base = $ctx->{'@base'}; $base = $ctx->{'@base'};
if($base === null) { if($base === null) {
$rval->{'@base'} = jsonld_parse_url($options['base']); $base = $options['base'];
} }
else if(!is_string($base)) { else if(!is_string($base)) {
throw new JsonLdException( throw new JsonLdException(
@ -2659,9 +2659,7 @@ class JsonLdProcessor {
'@context must be an absolute IRI or the empty string.', '@context must be an absolute IRI or the empty string.',
'jsonld.SyntaxError', array('context' => $ctx)); 'jsonld.SyntaxError', array('context' => $ctx));
} }
else { $rval->{'@base'} = jsonld_parse_url($base);
$rval->{'@base'} = $base;
}
$defined->{'@base'} = true; $defined->{'@base'} = true;
} }