FAQ
Edit report at https://pear.php.net/bugs/bug.php?id=20101&edit=1

  ID: 20101
  Updated by: slangley@google.com
  Reported By: slangley@google.com
  Summary: CodeSniffer doesn't work when run from a symlink farm
  Status: Feedback
  Type: Feature/Change Request
  Package: PHP_CodeSniffer
  Operating System: linux
  Package Version: 1.5.0RC4
  PHP Version: Irrelevant
  Assigned To: squiz
  Roadmap Versions:
  New Comment:

Sure.

Might want to spin this off into a separate bug.

if (is_file(dirname(__FILE__).'/../CodeSniffer/CLI.php') ===
true) {
     include_once dirname(__FILE__).'/../CodeSniffer/CLI.php';
} else {
     include_once 'PHP/CodeSniffer/CLI.php';
}


The else conditional assumes an install under PHP/ which is not a
requirement, and
is not consistent with the autoloader.


Previous Comments:
------------------------------------------------------------------------

[2013-10-24 06:30:55] squiz

-Type: Bug
+Type: Feature/Change Request
This isn't a bug with how PHP_CodeSniffer functions, but I'll leave this
as a feature
request in case I get some more support for this particular
configuration. If you have
a patch that works for you, please let me know and I'll look at it
again.

------------------------------------------------------------------------

[2013-10-23 05:23:01] slangley

Image all of the files are symlinked back to the original sources, one
by one, not just
the top level directory.

------------------------------------------------------------------------

[2013-10-23 05:12:45] squiz

-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: squiz
I don't know what you mean by a "symlink farm". Is the PEAR directory a
symlink to
somewhere else or is it more complex than that? I'm just trying to
figure out how to
replicate this properly.

------------------------------------------------------------------------

[2013-10-16 05:31:03] slangley

Description:
------------
Because of the liberal use of the __FILE__ magic constant,
which resolves symlinks, PHP code sniffer will not run.

Also, in some places there is code like this ...

if (is_file(dirname(__FILE__).'/../CodeSniffer/CLI.php') ===
true) {
     include_once dirname(__FILE__).'/../CodeSniffer/CLI.php';
} else {
     include_once 'PHP/CodeSniffer/CLI.php';
}

note that there is 'PHP' prefixed in the include_once statement.

But in the autoloader, there is no PHP prefixed to the file name
to be loaded, so you need to add various combinations to the
include_path of the interpreter to try and get this to work.

However, it will finally barf on

Fatal error: Uncaught exception 'UnexpectedValueException'
with message
'DirectoryIterator::__construct(/build/cas/168/CodeSniffer/Sta
ndards): failed to open dir: No such file or directory' in
/build/cas/168/1688b0514f62b3cb072697454fcb2eb0:1858
Stack trace:
#0
/build/cas/168/1688b0514f62b3cb072697454fcb2eb0(1858):
DirectoryIterator->__construct('/build/cas/168/...')
#1
/build/cas/58a/58a6b539749a77da1b2b96646ed2634f(705):
PHP_CodeSniffer::getInstalledStandards()
#2
/build/cas/58a/58a6b539749a77da1b2b96646ed2634f(518):
PHP_CodeSniffer_CLI->validateStandard('google')
#3 /build/cas/834/83498a458876f676802c5ff4e099f7e0(37):
PHP_CodeSniffer_CLI->process()
#4 {main}
   thrown in
/build/cas/168/1688b0514f62b3cb072697454fcb2eb0 on line
1858
)

which cannot be worked around

------------------------------------------------------------------------

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 3 | next ›
Discussion Overview
grouppear-bugs @
categoriesphp
postedOct 24, '13 at 4:23a
activeOct 24, '13 at 4:33a
posts3
users2
websitepear.php.net

2 users in discussion

Gsherwood: 2 posts Slangley: 1 post

People

Translate

site design / logo © 2022 Grokbase