1

我正在运行这个 phpcs 命令来检查一个文件。我收到此错误。

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)
4

1 回答 1

4

当迁移到 PHP 5.3 时,ini 文件中的注释不再允许以#.

进入/etc/php5/cli/conf.d/mcrypt.ini并使用,;而不是#,这是最新的ubuntu(5.3.2-1ubuntu4.7)中的默认错误。

或者在 PHP 中设置您的错误设置以忽略这样的弃用通知

error_reporting(E_ALL  &~ (E_STRICT|E_NOTICE|E_DEPRECATED));
于 2011-01-20T09:31:46.543 回答