Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GoogleCodeExporter opened this issue Feb 2, 2016 · 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 join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant