Skip to content

str_getcsv returns null byte for unterminated quoted string #11982

Closed
@apeschar

Description

@apeschar

Description

The following code:

<?php
echo json_encode(str_getcsv("\""));

Resulted in this output:

["\u0000"]

But I expected this output instead:

[""]

https://3v4l.org/TI1vo

PHP Version

PHP 5.3.0 to now

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