Hi Alison,
thank you very much for your bug fix.
Me and my group currently don't actively maintain RAP, which is sad, but due
to all the other projects like DBpedia, D2R Server, Silk, NG4J we are
currently involved in.
Therefore, I forward your bug fix to the RAP mailing list for archiving and
hope that it is going to be picked up once we or somebody else actively
works on another RAP release again.
Thanks again and best regards,
Chris
-----Ursprüngliche Nachricht-----
Von: Alison Callahan [mailto:ali...@gm...]
Gesendet: Donnerstag, 11. März 2010 18:31
An: ch...@bi...
Betreff: potential fatal error fix for PHP RAP
Hello Chris,
I was working with the N3Parser for RAP, and I encountered the following set
of warnings and a fatal error when I tried to call the $parser->parse
function on a string of valid N3:
***************
Warning: array_slice() expects parameter 2 to be long, string given in
/home/alison/Programs/rdfapi-php/api/syntax/N3Parser.php on line 395
Warning: array_slice() expects parameter 2 to be long, string given in
/home/alison/Programs/rdfapi-php/api/syntax/N3Parser.php on line 395
Fatal error: Prefix not declared: : in
/home/alison/Programs/rdfapi-php/api/syntax/N3Parser.php on line 603
*****************
After looking through the code I noticed a potential error, which, when
changed, allowed the code to work. The change I made is the
following:
In N3Parser.php, the getPrefixes function calls the getSpan function but
seems to provide it with a variable of the wrong type (string instead of
long, hence the error). Namely, on line 508 of the ParseN3.php code, the
variable $pos is defined as:
$pos = current($list)
The 'current' function returns the value of an array at the internal pointer
position, but from my understanding, getSpan requires the index of the
current array element. Thus I changed the line $pos =
current($list) to $pos = key($list) and the code seems to work perfectly. I
thought I should point this out because I don't know if this change will
have unexpected effects later on, or if this is a legitimate bug fix.
Please find attached the n3 file that I used, my simple code, and the
version of N3Parser.php with the above change at line 508.
I would appreciate knowing what you think. Thanks,
Alison Callahan
-----------------------
PhD Candidate
Department of Biology
Carleton University
|