Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.1.7

Bug #9346 lots of PHP warnings instead of syntax error
Submitted: 2006-11-15 18:51 UTC Modified: 2006-11-20 16:30 UTC
From: hholzgra Assigned: cellog
Status: Closed Package: PHP_ParserGenerator (version CVS)
PHP Version: 5.2.0 RC4 OS: *
Roadmaps: (Not assigned)    
Subscription  


 [2006-11-15 18:51 UTC] hholzgra (Hartmut Holzgraefe)
Description: ------------ This is something i ran into in CodeGen_PECL, i've stripped it down to the following simple grammer: proto ::= returns NAME PAR_OPEN PAR_CLOSE. returns ::= RESOURCE NAME. which is supposed to parse prototype strings like resource res_name func_name() now consider an invalid input like resource name() with the res_name (or the func_name) missing. This is expected to trigger a syntax error, instead it leads to a "Undefined offset: -1" and a lot of follow up warnings Test script: --------------- ---------- ProtoParser.y ------- %name ProtoParser_ %declare_class {class ProtoParser} %syntax_error { error_log("SYNTAX ERROR"); } proto ::= returns NAME PAR_OPEN PAR_CLOSE. returns ::= RESOURCE NAME. ----------- test.php ---------------- <?php require_once("ProtoParser.php"); $tokens = array( array("token"=>ProtoParser::RESOURCE, "value"=>"resource"), //array("token"=>ProtoParser::NAME, "value"=>"some_res"), array("token"=>ProtoParser::NAME, "value"=>"some_function"), array("token"=>ProtoParser::PAR_OPEN, "value"=>"("), array("token"=>ProtoParser::PAR_CLOSE, "value"=>")"), ); $parser = new ProtoParser(); foreach ($tokens as $token) { $parser->doParse($token["token"], $token["value"]); } $parser->doParse(0, 0); Expected result: ---------------- SYNTAX ERROR Actual result: -------------- Notice: Undefined offset: -1 in /home/hartmut/projects/php/pear/CodeGen_PECL/bug/ProtoParser.php on line 757 Notice: Trying to get property of non-object in /home/hartmut/projects/php/pear/CodeGen_PECL/bug/ProtoParser.php on line 757 Notice: Undefined index: in /home/hartmut/projects/php/pear/CodeGen_PECL/bug/ProtoParser.php on line 605 Notice: Undefined index: in /home/hartmut/projects/php/pear/CodeGen_PECL/bug/ProtoParser.php on line 563 Notice: Undefined index: in /home/hartmut/projects/php/pear/CodeGen_PECL/bug/ProtoParser.php on line 484 Warning: in_array(): Wrong datatype for second argument in /home/hartmut/projects/php/pear/CodeGen_PECL/bug/ProtoParser.php on line 484 Notice: Undefined index: in /home/hartmut/projects/php/pear/CodeGen_PECL/bug/ProtoParser.php on line 563 Notice: Undefined index: in /home/hartmut/projects/php/pear/CodeGen_PECL/bug/ProtoParser.php on line 563 Notice: Undefined index: in /home/hartmut/projects/php/pear/CodeGen_PECL/bug/ProtoParser.php on line 484 Warning: in_array(): Wrong datatype for second argument in /home/hartmut/projects/php/pear/CodeGen_PECL/bug/ProtoParser.php on line 484 Notice: Undefined index: in /home/hartmut/projects/php/pear/CodeGen_PECL/bug/ProtoParser.php on line 563 Notice: Undefined index: in /home/hartmut/projects/php/pear/CodeGen_PECL/bug/ProtoParser.php on line 563 Notice: Undefined index: in /home/hartmut/projects/php/pear/CodeGen_PECL/bug/ProtoParser.php on line 563 Notice: Undefined index: in /home/hartmut/projects/php/pear/CodeGen_PECL/bug/ProtoParser.php on line 563 Notice: Undefined index: in /home/hartmut/projects/php/pear/CodeGen_PECL/bug/ProtoParser.php on line 563 Notice: Undefined index: in /home/hartmut/projects/php/pear/CodeGen_PECL/bug/ProtoParser.php on line 563 Notice: Undefined index: in /home/hartmut/projects/php/pear/CodeGen_PECL/bug/ProtoParser.php on line 563 Notice: Undefined index: in /home/hartmut/projects/php/pear/CodeGen_PECL/bug/ProtoParser.php on line 563 Notice: Undefined index: in /home/hartmut/projects/php/pear/CodeGen_PECL/bug/ProtoParser.php on line 563 Notice: Undefined index: in /home/hartmut/projects/php/pear/CodeGen_PECL/bug/ProtoParser.php on line 563

Comments

 [2006-11-20 16:30 UTC] cellog (Greg Beaver)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.