Open mindctrl opened 4 years ago
Similar errors reported here: https://wordpress.org/support/topic/fatal-error-created-by-plugin/
Similar errors reported here: https://wordpress.org/support/topic/fatal-error-created-by-plugin/
@shawnhooper
Confirming version 1.5.0 causes fatal error. Checked, version 1.4.7 doesn't cause these issues.
Re: PHP Fatal error: Uncaught Error: Call to undefined method PHPCompatibility\PHPCSHelper::findStartOfStatement() in /wp-content/plugins/php-compatibility-checker/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/ArgumentFunctionsReportCurrentValueSniff.php:323)
This particular error can be fixed by changing the offending line 323 to
$startOfStatement = $phpcsFile->findStartOfStatement( $i, $this->ignoreForStartOfStatement );
@TimSmith It should not be fixed like that. This should be fixed by making sure all relevant vendor
files are included with the plugin.
@jrfnl The root problem is that the PHPCompatibility vendor files in the plugin are using the PHPCompatibility version 8.2.0 codebase but with the Sniffs taken from version 9.2.0.
My 'fix' is just a sticking plaster that let me execute the plugin immediately.
@TimSmith That's what I mean, the vendor
directory in the plugin wasn't updated correctly for the 1.5.0
release and this needs to be fixed.
An update to PHPCompatibilityWP
2.1.0
in combination with PHPCompatibility
9.3.1
would be good too to catch a lot more PHP 7.4 issues.
Sorry about my ignorance, but how would you do that? "update to PHPCompatibilityWP 2.1.0 in combination with PHPCompatibility 9.3.1" Thanks
Sorry about my ignorance, but how would you do that?
@tatuiot Are you asking cause you want to create a fix ? or because you want to "fix" this for your own WP install only ?
Would rolling back to 1.4.7 be pretty okay, to be able to use the module?
Does the check still finish despite this error? Fatal
would indicate that it interrupts the scan..
@ehausen Rolling back will mean the scans being run will be not be up to date, i.e. a lot of issues won't be caught and reported.
@jrfnl But currently with this Fatal error it seem unusable? Am I correct?
@ehausen Yes, fatal errors break things. Not sure what your usecase is, but you could just use the underlying tooling directly: https://github.com/PHPCompatibility/PHPCompatibility
When scanning the plugin triggers PHP fatal errors due to missing methods in some of the dependencies. This happens via WP-CLI or the UI.
I haven't dug deeply into this, but it appears the composer dependencies weren't fully updated/included, as some of the code calls methods that aren't in the build.
@stevenkword pinging you for visibility.