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

Bug #12517 getNewlineAfter() and dos files
Submitted: 2007-11-24 14:55 UTC
From: adviva Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.0.0RC2)
PHP Version: 5.1.2 OS: Linux
Roadmaps: 1.0.0RC3    

 [2007-11-24 14:55 UTC] adviva (Blair Robertson)
Description: ------------ Hi guys, There seems to be a problem with the PHP_CodeSniffer_CommentParser_CommentElement::getNewlineAfter() function and dos files. I have the attached test script that is causing errors from the PEAR_Sniffs_Commenting_FunctionCommentSniff sniff. The error the sniff produces is "There must be exactly one blank line before the tags in function comment". As soon as I convert this file to a unix formatted file it runs through fine. cheers Blair Test script: --------------- <?php class Timer { /** * Set the timezone for a specific network. * * @param integer $int_network_id - Network ID * * @return void */ public static function set_timezone($int_network_id) { switch($int_network_id) { case 2: date_default_timezone_set('Europe/Paris'); // France break; case 3: date_default_timezone_set('Europe/Berlin'); // Germany break; case 1: default: date_default_timezone_set('Europe/London'); // Default to UK break; } } }//end class ?> Actual result: -------------- -------------------------------------------------------------------------------- FOUND 2 ERROR(S) AND 0 WARNING(S) AFFECTING 2 LINE(S) -------------------------------------------------------------------------------- 3 | ERROR | Missing class doc comment 6 | ERROR | There must be exactly one blank line before the tags in function | | comment --------------------------------------------------------------------------------


 [2007-11-25 03:00 UTC] squiz (Greg Sherwood)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the 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. Was caused by counting both \r and \n as a newline due to the way strspn() works.