Skip to content

Issue with fputcsv() and the default parameter values in PHP 8.4 #17008

@K2ouMais

Description

@K2ouMais

Description

The following code:

<?php

$data = [
    "test1",
    "test2",
    "test3",
    "test4",
    "test5",
];

$handle = fopen('php://memory', 'w+');

// Accepting the default values doesnt work
fputcsv($handle, $data);

// Providing all default parameter values work
fputcsv($handle, $data, ",", "\"", "\\", "\n");

fclose($handle);

https://3v4l.org/aRvTD#v8.4.1

Resulted in this output:

Deprecated: fputcsv(): the $escape parameter must be provided as its default value will change in /in/aRvTD on line 14

But I expected this output instead:

It should write without any problem

PHP Version

PHP 8.4.1

Operating System

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions