Add escape param to fputcsv()

Created on 11 August 2025, 6 days ago

Problem/Motivation

Using the default value for the escape parameter for the fputcsv() is deprecated in PHP 8.4.

FILE: ...ocroot/modules/contrib/config_inspector/scripts/config-validatability-report.php
--------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------------
 29 | WARNING | The $escape parameter must be passed when calling fputcsv() as its
    |         | default value will change in a future PHP version.
    |         | (PHPCompatibility.ParameterValues.RemovedProprietaryCSVEscaping.DeprecatedParamNotPassed)
 85 | WARNING | The $escape parameter must be passed when calling fputcsv() as its
    |         | default value will change in a future PHP version.
    |         | (PHPCompatibility.ParameterValues.RemovedProprietaryCSVEscaping.DeprecatedParamNotPassed)
--------------------------------------------------------------------------------------

Steps to reproduce

composer require --dev --with-all-dependencies \
    phpcompatibility/php-compatibility:10.x@dev \
    dealerdirect/phpcodesniffer-composer-installer:^1.1
php bin/phpcs -p -s \
  --standard=PHPCompatibility \
  --runtime-set testVersion 8.4 \
  --extensions="inc,install,module,php,profile,theme" \
  docroot/modules/contrib/config_inspector

Proposed resolution

Use a named argument to call fputcsv and use the default value. Named arguments are supported since PHP 8.0.

📌 Task
Status

Active

Version

2.1

Component

Code

Created by

🇩🇪Germany hosterholz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024