diao6898948 / pb4php

Automatically exported from code.google.com/p/pb4php
0 stars 0 forks source link

Fixed a bug of _strip_comments() function in pb_parser.php #5

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
FILE: parser/pb_parser.php
private function _strip_comments(&$string)
{
    $string = preg_replace('/\/\/.+/', '', $string);
    // now replace empty lines and whitespaces in front
    $string = preg_replace('/\\r?\\n\s*/', "\n", $string);
}

The first preg_replace() call in the _strip_comments() function is used to 
strip out comments from a proto message. However, there might be no 
characters after the precending '//'.

Example:
//
// COMMENT
//

So the regular expression should be written in the form of '/\/\/.*/' to 
match any characters (except newline) that has zero or more duplicates.

Original issue reported on code.google.com by che...@gmail.com on 8 Apr 2009 at 1:51

GoogleCodeExporter commented 8 years ago
i got ,your cant  go to https://github.com/yuangu/pb4php;

this Version is Maintenance code by a chinese guy.you can commit your bug !

Original comment by lifuling...@126.com on 10 Jul 2013 at 1:29