Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic.PHP.DeprecatedFunctions return PHP Fatal error: Uncaught ReflectionException #2742

Closed
pokemonhan opened this issue Dec 5, 2019 · 12 comments

Comments

@pokemonhan
Copy link

pokemonhan commented Dec 5, 2019

squizlabs/php_codesniffer version 3.5.3

PHP version

PHP 7.3.11-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Oct 24 2019 18:23:06) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.11-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
with Xdebug v2.7.2, Copyright (c) 2002-2019, by Derick Rethans

Framework Laravel 6.6.1

os version

NAME="Ubuntu"
VERSION="16.04.6 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.6 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

xml file
phpcs.xml.txt

Problem
<rule ref="Generic.PHP.DeprecatedFunctions"/>

PHP Fatal error: Uncaught ReflectionException: Function SjczTDG4TDK0Tweg() does not exist in /var/www/jianghu_entertain/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/DeprecatedFunctionsSniff.php:37
Stack trace:
#0 /var/www/jianghu_entertain/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/DeprecatedFunctionsSniff.php(37): ReflectionFunction->__construct('SjczTDG4TDK0Twe...')
#1 /var/www/jianghu_entertain/vendor/squizlabs/php_codesniffer/src/Ruleset.php(1198): PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\DeprecatedFunctionsSniff->__construct()
#2 /var/www/jianghu_entertain/vendor/squizlabs/php_codesniffer/src/Ruleset.php(218): PHP_CodeSniffer\Ruleset->populateTokenListeners()
#3 /var/www/jianghu_entertain/vendor/squizlabs/php_codesniffer/src/Runner.php(332): PHP_CodeSniffer\Ruleset->__construct(Object(PHP_CodeSniffer\Config))
#4 /var/www/jianghu_entertain/vendor/squizlabs/php_codesniffer/src/Runner.php(70): PHP_CodeSniffer\Runner->init()
#5 /var/www/jianghu_entertain/vendor/squizlabs/php_co in /var/www/jianghu_entertain/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/DeprecatedFunctionsSniff.php on line 37

The file on getting error
BaseModel.php.txt

@gsherwood
Copy link
Member

I don't know why a function returned from get_defined_functions() would not exist when calling ReflectionFunction(). Can you provide short sample code that can reproduce the issue?

@gsherwood gsherwood added this to Idea Bank in PHPCS v3 Development via automation Dec 8, 2019
@gsherwood gsherwood moved this from Idea Bank to Track in PHPCS v3 Development Dec 8, 2019
@pokemonhan
Copy link
Author

BaseModel.php.txt

PHP Fatal error:  Uncaught ReflectionException: Function SjczTDG4TDK0Tweg() does not exist in /var/www/tmp/pre-receive-hook-EFwx2/jianghu_entertain/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/DeprecatedFunctionsSniff.php:37        
Stack trace:        
#0 /var/www/tmp/pre-receive-hook-EFwx2/jianghu_entertain/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/DeprecatedFunctionsSniff.php(37): ReflectionFunction->__construct('SjczTDG4TDK0Twe...')        
#1 /var/www/tmp/pre-receive-hook-EFwx2/jianghu_entertain/vendor/squizlabs/php_codesniffer/src/Ruleset.php(1198): PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\DeprecatedFunctionsSniff->__construct()        
#2 /var/www/tmp/pre-receive-hook-EFwx2/jianghu_entertain/vendor/squizlabs/php_codesniffer/src/Ruleset.php(218): PHP_CodeSniffer\Ruleset->populateTokenListeners()        
#3 /var/www/tmp/pre-receive-hook-EFwx2/jianghu_entertain/vendor/squizlabs/php_codesniffer/src/Runner.php(332): PHP_CodeSniffer\Ruleset->__construct(Object(PHP_CodeSniffer\Config))        
#4 /var/www/tmp/pre-receive-hook in /var/www/tmp/pre-receive-hook-EFwx2/jianghu_entertain/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/DeprecatedFunctionsSniff.php on line 37        
exist status is 255 

@pokemonhan
Copy link
Author

Hello Master, I already uploaded phpxml file and the file which report error on check and the version of os etc to the first comment. Thank you for your help.

@gsherwood
Copy link
Member

I can't replicate any issue with any of the built-in standards. It's possible that one of the external sniffs you are using is causing this issue. I would suggest commenting out all the external sniffs and running PHPCS again.

If it not longer produces an error, uncomment each external sniff until you find the one that is causing the issue.

If it still produces an error with just the included sniffs then I'm not sure what it is.

@pokemonhan
Copy link
Author

pokemonhan commented Dec 16, 2019

I tried it in window docker but it does not show me such error, but in linux I get the above error.
I will try comment out some external package as you guide.

@pokemonhan
Copy link
Author

I tried after upgrated to version 3.54 and tested the file below still have problem.I also uploaded the progress of running detail.
helpers.php.txt
running-detail and error with vvv.txt

@pokemonhan
Copy link
Author

pokemonhan commented Feb 17, 2020

Fail Running logs

running under linux.txt

Success Running Logs
running inside docker under windows error with vvv (2).txt

@pokemonhan
Copy link
Author

@jrfnl
Copy link
Contributor

jrfnl commented Feb 17, 2020

@harrisdt15f That looks like an issue with PHP itself, not with PHPCS. What version of PHP are you using ?

@jrfnl
Copy link
Contributor

jrfnl commented Feb 17, 2020

@harrisdt15f Just for argument's sake and to exclude it: would you be able to test PR #2873 to see if that changes anything for you ?
I don't expect it to fix your issue, but it would be good to get confirmation one way or another.

(and yes, I've tried and failed to reproduce the issue myself, so can't test this)

@pokemonhan
Copy link
Author

pokemonhan commented Feb 17, 2020

php 7.3.13 ,could we have way to exclude like this kinds of functions and not to be exit.

@pokemonhan
Copy link
Author

Let it be ,its because of php itself error. Thank you for all trying to help me.

PHPCS v3 Development automation moved this from Track to Ready for Release Feb 19, 2020
@gsherwood gsherwood removed this from Ready for Release in PHPCS v3 Development Feb 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants