Fixed built-in json number/bool check.

This commit is contained in:
Dave Longley 2011-07-18 16:22:57 -04:00
parent fd37e95a19
commit 1e79de1c41
1 changed files with 11 additions and 10 deletions

View File

@ -912,13 +912,14 @@ function _expand($ctx, $property, $value, $expandSubjects)
$coerce = _getCoerceType($ctx, $property, null); $coerce = _getCoerceType($ctx, $property, null);
// automatic coercion for basic JSON types // automatic coercion for basic JSON types
if($coerce === null and (is_numeric($value) or is_bool($value))) if($coerce === null and !is_string($value) &&
(is_numeric($value) or is_bool($value)))
{ {
if(is_bool($value)) if(is_bool($value))
{ {
$coerce = JSONLD_XSD_BOOLEAN; $coerce = JSONLD_XSD_BOOLEAN;
} }
else if(strpos('' . $value, '.') === false) else if(is_int($value))
{ {
$coerce = JSONLD_XSD_INTEGER; $coerce = JSONLD_XSD_INTEGER;
} }