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

Bug #14637 Call to processUnknownArguments() misses second parameter $pos
Submitted: 2008-09-11 13:40 UTC
From: gschuster Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.1.0)
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  


 [2008-09-11 13:40 UTC] gschuster (Gabriel Schuster)
Description: ------------ Processing unknown short arguments (e.g. "-t" for transaction) calls $this->processUnknownArguments() with only 2 parameters ($arg, $values) instead of the expected 3 ($arg, $pos, $values) - this resets $values to an empty array in the delivered pre-commit hook script. Test script: --------------- Quick fix: File PHP/CodeSniffer/CLI.php - function processShortArgument($arg, $values) - lines 165 - 166: default: $values = $this->processUnknownArgument('-'.$arg, 0, $values); Alternative: modify the specified pre-commit-hook to check if 2 or 3 arguments where passed Expected result: ---------------- Should set svnArgs correctly. Actual result: -------------- Resets complete $values.

Comments

 [2008-09-11 16:14 UTC] onemb (Maik Bader)
i solved that problem and will try to provide a patch file later on
 [2008-09-24 14:38 UTC] burci (Peter Buri)
I correct the CLI.php in order to fully support the new $pos parameter in every argument call.
 [2008-10-01 06:03 UTC] squiz (Greg Sherwood)
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. Thanks for the patch Peter. I considered removing the $pos argument all together as it is never used, but decided to support it instead or any future interfaces that may need to use it.