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

  ID: 20101
  Updated by: [email protected]
  Reported By: [email protected]
  Summary: CodeSniffer doesn't work when run from a symlink farm
-Status: Open
+Status: Feedback
  Type: Bug
  Package: PHP_CodeSniffer
  Operating System: linux
  Package Version: 1.5.0RC4
  PHP Version: Irrelevant
-Assigned To:
+Assigned To: squiz
  Roadmap Versions:
  New Comment:

-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.


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

[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

  • Slangley at Oct 23, 2013 at 3:15 am
    Edit report at https://pear.php.net/bugs/bug.php?id=20101&edit=1

      ID: 20101
      Updated by: [email protected]
      Reported By: [email protected]
      Summary: CodeSniffer doesn't work when run from a symlink farm
      Status: Feedback
      Type: Bug
      Package: PHP_CodeSniffer
      Operating System: linux
      Package Version: 1.5.0RC4
      PHP Version: Irrelevant
      Assigned To: squiz
      Roadmap Versions:
      New Comment:

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


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

    [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

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedOct 23, '13 at 3:05a
activeOct 23, '13 at 3:15a
posts2
users2
websitepear.php.net

2 users in discussion

Slangley: 1 post Gsherwood: 1 post

People

Translate

site design / logo © 2023 Grokbase