PHP 7 Compatibility Issue

Created on 7 March 2025, about 1 month ago

Problem/Motivation

PHPCompatibility has detected a warning for PHP 8.1 version affecting theme/views-data-export-json-footer.tpl.php
and theme/views-data-export-json-header.tpl.php files:
WARNING No PHP code was found in this file and short open tags are not allowed by this install of PHP. This file may be using short open tags but PHP does not allow them.

FILE: /var/www/html/docroot/sites/all/modules/contrib/views_data_export_json/theme/views-data-export-json-footer.tpl.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
LINE 1: WARNING No PHP code was found in this file and short open tags are not allowed by this install of PHP. This file may be using short open tags but PHP does not allow them.
                (Internal.NoCodeFound)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>> 1:  ]

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/docroot/sites/all/modules/contrib/views_data_export_json/theme/views-data-export-json-header.tpl.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
LINE 1: WARNING No PHP code was found in this file and short open tags are not allowed by this install of PHP. This file may be using short open tags but PHP does not allow them.
                (Internal.NoCodeFound)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>> 1:  [

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Steps to reproduce

Execute
phpcs docroot/sites/all/modules/contrib/views_data_export_json --extensions=php,module,inc --standard=PHPCompatibility --runtime-set testVersion 8.1 --report=code --report-file=reports/codereview/checkstyle-phpcompatibility.txt -sv

Proposed resolution

Add PHP tag and comment to bypass PHPCS warning.

While being aware that there is no support for D7 modules anymore and that the maintainers decided not to fix a very similar issue ( https://www.drupal.org/project/views_data_export/issues/3005288#comment-... 💬 PHP 7 compatibility Issue Closed: won't fix ), we need to fix the warning so we might as well contribute a patch in case it is useful to anyone.

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Active

Component

Code

Created by

🇪🇸Spain beagaliana

Live updates comments and jobs are added and updated live.
  • PHP 7.0

    The issue particularly affects sites running on PHP version 7.0.0 or later.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024