sarfraznawaz2005 / php-compatibility-checker

php-compatibility-checker
3 stars 1 forks source link

output.php not processing #1

Closed qriouslad closed 2 years ago

qriouslad commented 2 years ago

Hi @sarfraznawaz2005

Thank you for creating this library. I'm trying it out at https://compatibility-checker.dev.bowo.io/phpcs/ and removed 'target="_blank"' on the form element. However, output.php is not processing anything. Is something broken, or am I doing something wrong?

Thanks! Bowo

sarfraznawaz2005 commented 2 years ago

can u tell which php version are you using ? Also if you could add screenshot.

qriouslad commented 2 years ago

@sarfraznawaz2005 PHP 7.3. What screenshot do you need? I have it up at https://compatibility-checker.dev.bowo.io/phpcs/

sarfraznawaz2005 commented 2 years ago

I have never run it online, it works locally for me. Here are few suggestions you can try

qriouslad commented 2 years ago

This is what I get now:

./vendor/bin/phpcs -psvn /home/{{username}}/webapps/compatibility-checker/wp-content/plugins/plugin-logic/. -d memory_limit=-1 --report=code --extensions=php --parallel=2 --standard=./vendor/phpcompatibility/php-compatibility/PHPCompatibility,./vendor/phpcompatibility/phpcompatibility-symfony/PHPCompatibilitySymfonyPolyfillPHP73,./vendor/phpcompatibility/phpcompatibility-passwordcompat/PHPCompatibilityPasswordCompat,./vendor/phpcompatibility/phpcompatibility-paragonie/PHPCompatibilityParagonieRandomCompat,./vendor/phpcompatibility/phpcompatibility-paragonie/PHPCompatibilityParagonieSodiumCompat,./vendor/phpcompatibility/phpcompatibility-wp/PHPCompatibilityWP --runtime-set testVersion 7.3 --ignore= --no-cache --no-colors --report=full --report-width=120 --STARTED--

--FINISHED--

qriouslad commented 2 years ago

I tried running locallly using Laragon, and it works! Output below

--STARTED--

Registering sniffs in the PHPCompatibility standard... Registering sniffs in the PHPCompatibilitySymfonyPolyfillPHP80 standard... Registering sniffs in the PHPCompatibilityPasswordCompat standard... Registering sniffs in the PHPCompatibilityParagonieRandomCompat standard... Registering sniffs in the PHPCompatibilityParagonieSodiumCompat standard... Creating file list...

C:\laragon\www\phpcs\testcode : old_code_for_testing.php

FILE: C:\laragon\www\phpcs\testcode\old_code_for_testing.php

FOUND 3 ERRORS AFFECTING 2 LINES

LINE 27: ERROR Extension 'mcrypt' is deprecated since PHP 7.1 and removed since PHP 7.2; Use openssl (preferred) or pecl/mcrypt once available instead (PHPCompatibility.Extensions.RemovedExtensions.mcryptDeprecatedRemoved) LINE 27: ERROR Function mcrypt_cbc() is deprecated since PHP 5.5 and removed since PHP 7.0 (PHPCompatibility.FunctionUse.RemovedFunctions.mcrypt_cbcDeprecatedRemoved)

25: foo::bar(); 26:

27: mcrypt_cbc("asd"); 28:
29: $bar = &new foo();

LINE 29: ERROR Assigning the return value of new by reference is deprecated in PHP 5.3 and has been removed in PHP 7.0 (PHPCompatibility.Syntax.RemovedNewReference.Removed)

27: mcrypt_cbc("asd"); 28:
29: $bar = &new foo(); 30:

Time: 2.1 secs; Memory: 8MB

--FINISHED--

sarfraznawaz2005 commented 2 years ago

So seems there is some other problem or restriction on your server but glad that it worked locally.

qriouslad commented 2 years ago

I inspected NGINX error log on the server and found this:

2022/03/12 08:56:42 [error] 20959#20959: *40863 FastCGI sent in stderr: "PHP message: PHP Warning: popen() has been disabled for security reasons in /home/{username}/webapps/compatibility-checker/phpcs/output.php on line 51" while reading response header from upstream, client: 202.80.216.155, server: compatibility-checker.dev.bowo.io, request: "POST /phpcs/output.php HTTP/2.0", upstream: "fastcgi://unix:/var/run/compatibility-checker.sock:", host: "compatibility-checker.dev.bowo.io", referrer: "https://compatibility-checker.dev.bowo.io/phpcs/"

Then enabled 'popen' and voila, now it works online. :-)

Sample output below, scanning an old WordPress plugin folder

--STARTED--

Registering sniffs in the PHPCompatibility standard... Registering sniffs in the PHPCompatibilitySymfonyPolyfillPHP73 standard... Registering sniffs in the PHPCompatibilityPasswordCompat standard... Registering sniffs in the PHPCompatibilityParagonieRandomCompat standard... Registering sniffs in the PHPCompatibilityParagonieSodiumCompat standard... Registering sniffs in the PHPCompatibilityWP standard... Creating file list...

/home/{username}/webapps/compatibility-checker/wp-content/plugins/plugin-logic : plugin-logic-fields.php

/home/{username}/webapps/compatibility-checker/wp-content/plugins/plugin-logic : plugin-logic.php Time: 458ms; Memory: 8MB

--FINISHED--