rserve-php icon indicating copy to clipboard operation
rserve-php copied to clipboard

PHP notice: Uninitialized string offset: -1 in Parser.php on line 229

Open Skrol29 opened this issue 9 years ago • 2 comments

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);

Skrol29 avatar Dec 08 '16 15:12 Skrol29

This bug happens with version 2.0 too.

Skrol29 avatar Dec 08 '16 15:12 Skrol29

It has been fixed in branch 2.0 in 6396557908bbbd0116a0c9c618300ca84465a6f2

cturbelin avatar Jun 28 '18 16:06 cturbelin