diff options
author | Adam Harvey <aharvey@php.net> | 2010-11-09 14:53:23 +0000 |
---|---|---|
committer | Adam Harvey <aharvey@php.net> | 2010-11-09 14:53:23 +0000 |
commit | 150a741fee1fee325be80c12c34ee47c55a6b79c (patch) | |
tree | 045c897eb26ddd8e91e97b7c00c34257351f7269 /ext/spl | |
parent | aef6ac02f51e7bfe40f2f949af649fa983623576 (diff) | |
download | php-git-150a741fee1fee325be80c12c34ee47c55a6b79c.tar.gz |
Fix bug #53279 (SplFileObject doesn't initialise default CSV escape character).
Diffstat (limited to 'ext/spl')
-rwxr-xr-x | ext/spl/spl_directory.c | 1 | ||||
-rw-r--r-- | ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index d02a95b59d..0d6cfa269e 100755 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -274,6 +274,7 @@ static int spl_filesystem_file_open(spl_filesystem_object *intern, int use_inclu intern->u.file.delimiter = ','; intern->u.file.enclosure = '"'; + intern->u.file.escape = '\\'; zend_hash_find(&intern->std.ce->function_table, "getcurrentline", sizeof("getcurrentline"), (void **) &intern->u.file.func_getCurr); diff --git a/ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt b/ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt new file mode 100644 index 0000000000..b3b6c7c609 --- /dev/null +++ b/ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt @@ -0,0 +1,24 @@ +--TEST-- +SplFileObject::fgetcsv with default escape character +--FILE-- +<?php +$fp = fopen('SplFileObject::fgetcsv.csv', 'w+'); +fwrite($fp, '"aa\"","bb","\"c"'); +fclose($fp); + +$fo = new SplFileObject('SplFileObject::fgetcsv.csv'); +var_dump($fo->fgetcsv()); +?> +--CLEAN-- +<?php +unlink('SplFileObject::fgetcsv.csv'); +?> +--EXPECTF-- +array(3) { + [0]=> + string(4) "aa\"" + [1]=> + string(2) "bb" + [2]=> + string(3) "\"c" +} |