[php-src] Issue #9144: fputcsv / fgetcsv escape quoting
| From: | Tatikoma | Date: | Mon, 25 Jul 2022 23:13:10 +0000 |
| Subject: | [php-src] Issue #9144: fputcsv / fgetcsv escape quoting | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242022@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9144
Author: Tatikoma
### Description
The following code:
```php
<?php
$txt = "1\\\\\",2";
$fh = fopen('php://memory', 'a+b');
fputcsv($fh, [$txt]);
fseek($fh, 0, SEEK_SET);
$read = fgetcsv($fh);
fclose($fh);
assert(count($read) == 1);
```
Resulted in this output:
```
PHP Warning: Uncaught AssertionError: assert(count($read) == 1) in php shell code:1
Stack trace:
#0 php shell code(1): assert(false, 'assert(count($r...')
#1 {main}
thrown in php shell code on line 1
Warning: Uncaught AssertionError: assert(count($read) == 1) in php shell code:1
Stack trace:
#0 php shell code(1): assert(false, 'assert(count($r...')
#1 {main}
thrown in php shell code on line 1
```
But I expected this output instead:
```
No output, assertion should be okay.
```
### PHP Version
PHP 8.1.7 (cli) (built: Jun 9 2022 14:08:46) (NTS)
### Operating System
macOS Monterey, Alpine (Docker)