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

Bug #19448 Problem with detecting remote standards
Submitted: 2012-06-01 21:46 UTC
From: acp Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.3.4)
PHP Version: 5.3.3 OS:
Roadmaps: (Not assigned)    
Subscription  


 [2012-06-01 21:46 UTC] acp (Aa Pp)
Description: ------------ While trying to use a "remote" (as in not in phpcs' installation path), I got errors indicating that phpcs could not find the Sniff files. Having checked the code, making one small change on line 834 (of the 1.3.4 release) was enough to fix this. Changed: $path = realpath(dirname(__FILE__).'/CodeSniffer/Standards').DIRECTORY_SEPAR ATOR.$path; to $path = realpath(dirname(__FILE__).'/CodeSniffer/Standards'.DIRECTORY_SEPAR ATOR.$path); (see the closing parenthesis of realpath) Since dirname(__FILE__) . '/CodeSniffer/Standards' will in normal circumstances refer to the local standards, this should not return false, therefore the immediatly next line (if ($path === false....) does not really make sense imho. However, including the whole path up to the sniff in realpath() will correctly check for its existence and return false if not found. This problem makes "remote" standards not useable.

Comments

 [2012-06-19 05:43 UTC] squiz (Greg Sherwood)
-Assigned To: +Assigned To: squiz
This was specifically changed in this commit: https://github.com/squizlabs/PHP_CodeSniffer/commit/5de1faaa66730a165e9bb72fa 28780b38d6c30c4 To allow symlinks to work. Reverting this line certainly does fix this issue, but I'm going to have to find another way around the symlink issue first. Thanks for finding the bad line of code for this. Helped a lot.
 [2012-06-19 06:39 UTC] squiz (Greg Sherwood)
-Status: Assigned +Status: Closed
Appears that the symlink issue has been fixed by other changes anyway, so I've been able to revert it and allow this functionality to work again. Committed to Github repo: https://github.com/squizlabs/PHP_CodeSniffer/commit/fbab82e310f76b9e77ca9bcf1d a08f76f16e2de5