Question

I am running this phpcs command to check one file . I am getting this error.

ubuntu@myip:/var/www/ryapi$ phpcs -n content.php
PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/mcrypt.ini on line 1 in Unknown on line 0
PHP Fatal error:  Uncaught PHP_CodeSniffer_Exception: $stackPtr is not a class member var in /usr/share/php/PHP/CodeSniffer/Standards/PEAR/Sniffs/NamingConventions/ValidVariableNameSniff.php on line 51
#0 /usr/share/php/PHP/CodeSniffer/Standards/PEAR/Sniffs/NamingConventions/ValidVariableNameSniff.php(51): PHP_CodeSniffer_File->getMemberProperties(30)
#1 /usr/share/php/PHP/CodeSniffer/Standards/AbstractVariableSniff.php(154): PEAR_Sniffs_NamingConventions_ValidVariableNameSniff->processMemberVar(Object(PHP_CodeSniffer_File), 30)
#2 /usr/share/php/PHP/CodeSniffer/Standards/AbstractScopeSniff.php(190): PHP_CodeSniffer_Standards_AbstractVariableSniff->processTokenWithinScope(Object(PHP_CodeSniffer_File), 30, 21)
#3 /usr/share/php/PHP/CodeSniffer/File.php(431): PHP_CodeSniffer_Standards_AbstractScopeSniff->process(Object(PHP_CodeSniffer_File), 30)
#4 /usr/share/php/PHP/CodeSniffer.php(900): PHP_CodeSniffer_File->start(NULL)
#5 /usr/share/php/PHP/CodeSniffer.php(815): PHP_CodeSniffer->_processFile('/var/www/ryapi/...', NULL)
Was it helpful?

Solution

When migrating to the PHP 5.3 comments in ini files are no longer allowed to start with the #.

Go into /etc/php5/cli/conf.d/mcrypt.ini and use ; instead of #, this is a default error in the latest ubuntu (5.3.2-1ubuntu4.7).

Or set your error settings in PHP to ignore deprecated notices like this

error_reporting(E_ALL  &~ (E_STRICT|E_NOTICE|E_DEPRECATED));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top