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

Chi created an issue. See original summary.

klausi’s picture

Status: Active » Postponed (maintainer needs more info)

PHP 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.

Chi’s picture

Status: Postponed (maintainer needs more info) » Active

Besides the above mentioned error I've got the following deprecation 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

That one is definitely PHP 7.4 issue.
https://www.php.net/manual/en/migration74.deprecated.php#migration74.dep...

Chi’s picture

The full list of deprecation message.

PHP Deprecated:  Array and string offset access syntax with curly braces is deprecated in vendor/drupal/coder/coder_sniffer/DrupalPractice/Project.php on line 268

Deprecated: Array and string offset access syntax with curly braces is deprecated in vendor/drupal/coder/coder_sniffer/DrupalPractice/Project.php on line 268
PHP Deprecated:  Array and string offset access syntax with curly braces is deprecated in vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/NamingConventions/ValidGlobalSniff.php on line 115

Deprecated: Array and string offset access syntax with curly braces is deprecated in vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/NamingConventions/ValidGlobalSniff.php on line 115
PHP Deprecated:  Array and string offset access syntax with curly braces is deprecated in vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/InlineCommentSniff.php on line 150

Deprecated: Array and string offset access syntax with curly braces is deprecated in vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/InlineCommentSniff.php on line 150
PHP Deprecated:  Array and string offset access syntax with curly braces is deprecated in vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/FunctionCommentSniff.php on line 441

Deprecated: Array and string offset access syntax with curly braces is deprecated in vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/FunctionCommentSniff.php on line 441
PHP Deprecated:  Array and string offset access syntax with curly braces is deprecated in vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/ScopeIndentSniff.php on line 945

Deprecated: Array and string offset access syntax with curly braces is deprecated in vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/ScopeIndentSniff.php on line 945
PHP Deprecated:  Array and string offset access syntax with curly braces is deprecated in vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/FunctionTSniff.php on line 121

Deprecated: Array and string offset access syntax with curly braces is deprecated in vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/FunctionTSniff.php on line 121
PHP Deprecated:  Array and string offset access syntax with curly braces is deprecated in vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/FunctionTSniff.php on line 129

Deprecated: Array and string offset access syntax with curly braces is deprecated in vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/FunctionTSniff.php on line 129
PHP Deprecated:  Array and string offset access syntax with curly braces is deprecated in vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/LStringTranslatableSniff.php on line 62

Deprecated: Array and string offset access syntax with curly braces is deprecated in vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/LStringTranslatableSniff.php on line 62 
Chi’s picture

With 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.

klausi’s picture

Title: Support PHP 7.4 » Ignore directories that look like info files on Drupal core version detection

The 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

  • klausi authored da0d58c on 8.x-3.x
    fix(ProjectDetection): Ignore directory names when detecting the Drupal...
klausi’s picture

Priority: Major » Normal
Status: Active » Fixed

Tests are passing, merged.

Thanks a lot for reporting! Please test now with the dev version before we make the next release.

klausi’s picture

Assigning credits to Chi for reporting.

Chi’s picture

I do not know yet why this error only occurs on PHP 7.4.

Seems like before PHP 7.4 file_get_contents just failed silently.
https://3v4l.org/usi4r

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.