Skip to content

Fix PHP 8.4 Deprecations#1923

Merged
PatelUtkarsh merged 2 commits into
xwp:developfrom
TheVitik:fix/php-deprecations
Jul 13, 2026
Merged

Fix PHP 8.4 Deprecations#1923
PatelUtkarsh merged 2 commits into
xwp:developfrom
TheVitik:fix/php-deprecations

Conversation

@TheVitik

@TheVitik TheVitik commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR fixes PHP 8.4 deprecation warnings related to fputcsv().

Starting with PHP 8.4, calling fputcsv() without explicitly passing the $escape parameter triggers the following deprecation warning:

The $escape parameter must be passed when calling fputcsv() as its default value will change in a future PHP version.

Changes

  • Updated both occurrences of fputcsv() where the $escape parameter was omitted.
  • Explicitly passed the current default escape character ('\\') to preserve the existing behavior and eliminate the deprecation warning.

Example:

fputcsv( $csv, $row, ',', '"', '\\' );

Impact

This change is fully backward compatible and prepares the codebase for PHP 8.4 by removing the deprecation warnings without changing the existing CSV output behavior.

@PatelUtkarsh PatelUtkarsh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix! The approach looks good and is backward compatible with PHP 7.2.

One issue: the changed lines use spaces instead of tabs, so phpcs fails. Running vendor/bin/phpcbf classes/class-cli.php exporters/class-exporter-csv.php will fix it.

@TheVitik

Copy link
Copy Markdown
Contributor Author

Hi @PatelUtkarsh , thank you for the review.

Could you please check again?

When is it possible to release these changes?

@TheVitik TheVitik requested a review from PatelUtkarsh July 12, 2026 12:15

@PatelUtkarsh PatelUtkarsh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@PatelUtkarsh

Copy link
Copy Markdown
Member

Hello @TheVitik,

We can include it in next release; however next release isn't planned yet; I will let you know as soon as I confirm with team.

@PatelUtkarsh PatelUtkarsh merged commit c46390d into xwp:develop Jul 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants