Skip to content
This repository has been archived by the owner on May 5, 2018. It is now read-only.

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

Open
GoogleCodeExporter opened this issue Apr 27, 2015 · 1 comment
Open

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant