Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is PHP CodeSniffer Freezing?
    text
    copied!<p>I'm a Junior Programmer where I work. Our website was written using PHP 4. We're migrating from PHP 4 to PHP 5.3. There are roughly 5000 PHP files in around 595 directories. So, as you can imagine, the scope of this project is pretty huge.</p> <p>We use Subversion for version control. I have two separate checkouts. I have two VMs that act as separate webhosts - one stack emulates our actual webserver (CentOS 4, PHP4, etc) and the other is a PHP 5.3 stack (Ubuntu 12.04 LTS).</p> <p>I took the time to check the files for basic syntax errors using the following commands:</p> <p>Edit: I ran the following recursive searches from the root of the website.</p> <pre><code>find ./ -type f -name \*.php -exec php -l {} \; &lt; ~/php5_basic_syntax_assessment.txt find ./ -type f -name \*.inc -exec php -l {} \; &lt; ~/php5_basic_syntax_inc_assessment.txt </code></pre> <p>I realize that using php -l to check basic syntax doesn't reveal deprecated code structures/functions and doesn't provide warnings (IE: use preg_slice() instead of slice()). Therefore, I decided to install PHP CodeSniffer.</p> <p>First, I installed PEAR: [I accepted all the default parameters]</p> <pre><code>cd ~/ mkdir pear cd pear wget http://pear.php.net/go-pear.phar php go-pear.phar </code></pre> <p>Next, I installed git:</p> <pre><code>cd ~/ sudo apt-get update sudo apt-get install git </code></pre> <p>Next, I installed PHP Code Sniffer</p> <pre><code>pear install PHP_CodeSniffer </code></pre> <p>Finally, I installed the following PHP 5.3 Compatibility standards for the PHP Code Sniffer:</p> <pre><code>git clone git://github.com/wimg/PHP53Compat_CodeSniffer.git PHP53Compatibility </code></pre> <p>I did all of the above so that I could assess the 5K PHP files in an automated kind of way. It would be extremely tedious and time consuming to go through each file to make sure they manually follow the PHP 5.3 coding standards.</p> <p>Finally, here's the command I used to run the PHP Code Sniffer:</p> <pre><code>phpcs --standard=/home/my_user_name/PHP53Compatibility -p --report-file=/home/my_user_name/php53_assessment.txt /path/to/web/root </code></pre> <p>To make sure that the specific standards aren't the problem, I also ran the PHP Code Sniffer using the default standards:</p> <pre><code>phpcs -p --report-file=/home/my_user_name/php53_assessment.txt /path/to/web/root </code></pre> <p>Either way, the reports freeze in the same place. I've been awake for over 24 hours. I waited for 18 hours before stopping the first run by using CTRL+C. The second is still running and has been running for about an hour and a half.</p> <p>So, what is causing my PHP Code Sniffer to freeze?</p> <p>All help is very much appreciated.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload