PHP notice: Uninitialized string offset: -1 in Parser.php on line 229
When run a R script, the class Rserve_Parser raises a PHP notice :
Notice: Uninitialized string offset: -1 in ..../Parser.php on line 229 Warning: Cannot use a scalar value as an array in .../Parser.php on line 229
Please note that the R script is executed correctly. I only have a PHP notice. The command I send was:
$connection = new Rserve_Connection($remote_host);
$parser = Rserve_Connection::PARSER_NATIVE;
$cmd = "source('/opt/rcode/my_script.R')";
$data = $connection->evalString($cmd, $parser);
The line 229 of file Parser.php is:
$a[$k] = $levels[ $i -1];
When the notice raises, at that line here are some PHP variables :
$attr = array (
'levels' => '',
'class' => 'factor',
);
$a = 1;
$eoa = 236;
At line 214, the variable was: $a = array (0 => 1);
This bug happens with version 2.0 too.
It has been fixed in branch 2.0 in 6396557908bbbd0116a0c9c618300ca84465a6f2