Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
PHP 7.4 has just been released.
Currently Coder fails with the following message.
An error occurred during processing; checking has been aborted. The error message was: file_get_contents(): read of 8192 bytes failed with errno=21 Is a directory in vendor/drupal/coder/coder_sniffer/DrupalPractice/Project.php on line 264
Comments
Comment #2
klausiPHP 7.4 is now enabled in our Travis CI tests and passing.
The error message does not seem PHP 7.4 related. Looking into Project.php it looks like a directory name instead of an info file name is coming out of getInfoFile(). Are you testing with directory names *.info or *.info.yml in the path to the test file? That might be a bug in our info file detector then and we need to check for directories there.
Comment #3
Chi CreditAttribution: Chi commentedBesides the above mentioned error I've got the following deprecation message.
That one is definitely PHP 7.4 issue.
https://www.php.net/manual/en/migration74.deprecated.php#migration74.dep...
Comment #4
Chi CreditAttribution: Chi commentedThe full list of deprecation message.
Comment #5
Chi CreditAttribution: Chi commentedWith regard to info file. I've got that error when running the following command
vendor/bin/phpcs src/Application.php
The project itself does not have info files because it is not a Drupal module or theme. However, I have another project that lives in a separate directory on the server (/var/www/domain.info). Seems like
Project::getInfoFile()
is confused by the name of that directory.That exposes two issues that needs to be addressed.
1.
Project::getInfoFile()
should use is_dir() when searching info files.2.
Project::getInfoFile()
should not search outside of project root. Currently it searches everything up to server root.I do not know yet why this error only occurs on PHP 7.4.
Comment #6
klausiThe deprecation warnings are already fixed on the 8.x-3.x branch. Please test the dev version of Coder.
Searching up the file system is intentional to get a Drupal core version from somewhere. In order to avoid that please set drupal_core_version in your phpcs config. See https://github.com/pfrenssen/coder#store-settings-in-a-phpcsxmldist-file
For the info file detection I opened https://github.com/pfrenssen/coder/pull/68
Comment #8
klausiTests are passing, merged.
Thanks a lot for reporting! Please test now with the dev version before we make the next release.
Comment #9
klausiAssigning credits to Chi for reporting.
Comment #10
Chi CreditAttribution: Chi commentedSeems like before PHP 7.4 file_get_contents just failed silently.
https://3v4l.org/usi4r