php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72646 SplFileObject::getCsvControl does not return the escape characters
Submitted: 2016-07-22 08:10 UTC Modified: 2016-07-22 11:59 UTC
From: nyamsprod at gmail dot com Assigned: cmb (profile)
Status: Closed Package: SPL related
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
9 + 32 = ?
Subscribe to this entry?

 
 [2016-07-22 08:10 UTC] nyamsprod at gmail dot com
Description:
------------
SplFileObject::setCsvControl takes 3 parameters 
- the delimiter character
- the enclosure character
- the escape character

But the equivalent SplFileObject::getCsvControl returns an array with only two of those parameters. The escape character is missing.

Test script:
---------------
<?php

$controls = (new SplTempFileObject())->getCsvControl();
print_r($controls);

Expected result:
----------------
Array
(
 [0] => ,
 [1] => "
 [2] => "\"
)

Actual result:
--------------
Array
(
 [0] => ,
 [1] => "
)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-07-22 11:59 UTC] cmb@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2016-07-22 11:59 UTC] cmb@php.net
Confirmed: <https://3v4l.org/XTKF7>. That's obviously been
forgotten when $escape was added to ::setCSVControl() in PHP 5.3.
The docs need respective updates also.
 [2016-07-22 13:30 UTC] cmb@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6b116932b28b76c3f075921a0f2660f7bf5ac4e1
Log: Fix #72646: SplFileObject::getCsvControl does not return the escape character
 [2016-07-22 13:30 UTC] cmb@php.net
-Status: Verified +Status: Closed
 [2016-07-22 13:35 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=339699
Log: Fix #72646: SplFileObject::getCsvControl does not return the escape characters
 [2016-10-17 10:10 UTC] bwoebi@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6b116932b28b76c3f075921a0f2660f7bf5ac4e1
Log: Fix #72646: SplFileObject::getCsvControl does not return the escape character
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC