Check input for non-array in from_rdf.

This commit is contained in:
Dave Longley 2012-05-09 22:15:28 -04:00
parent aef8eb3e72
commit 00c18e853e
1 changed files with 2 additions and 2 deletions

View File

@ -113,7 +113,7 @@ function jsonld_normalize($input, $options=array()) {
* specified by the format option or an array of the RDF statements * specified by the format option or an array of the RDF statements
* to convert. * to convert.
* @param assoc [$options] the options to use: * @param assoc [$options] the options to use:
* [format] the format if input is a string: * [format] the format if input not an array:
* 'application/nquads' for N-Quads (default). * 'application/nquads' for N-Quads (default).
* [notType] true to use rdf:type, false to use @type (default). * [notType] true to use rdf:type, false to use @type (default).
* *
@ -513,7 +513,7 @@ class JsonLdProcessor {
isset($options['format']) or $options['format'] = 'application/nquads'; isset($options['format']) or $options['format'] = 'application/nquads';
isset($options['notType']) or $options['notType'] = false; isset($options['notType']) or $options['notType'] = false;
if(is_string($statements)) { if(!is_array($statements)) {
// supported formats (processor-specific and global) // supported formats (processor-specific and global)
if(($this->rdfParsers !== null && if(($this->rdfParsers !== null &&
!property_exists($this->rdfParsers, $options['format'])) || !property_exists($this->rdfParsers, $options['format'])) ||