summaryrefslogtreecommitdiff
path: root/ext/spl/spl_directory.c
diff options
context:
space:
mode:
authorChristoph M. Becker <cmb@php.net>2016-07-22 14:55:13 +0200
committerChristoph M. Becker <cmb@php.net>2016-07-22 15:24:50 +0200
commit6b116932b28b76c3f075921a0f2660f7bf5ac4e1 (patch)
treec1d1f6c170236d4a9d93cf6b270b3ed31e4570c6 /ext/spl/spl_directory.c
parentfb4a6dc0f1df106dae84c9d8f3ec53cc0da7231b (diff)
downloadphp-git-6b116932b28b76c3f075921a0f2660f7bf5ac4e1.tar.gz
Fix #72646: SplFileObject::getCsvControl does not return the escape character
This has obviously been missed when adding the $escape parameter to SplFileObject::setCsvControl() in PHP 5.3, so we catch up on this.
Diffstat (limited to 'ext/spl/spl_directory.c')
-rw-r--r--ext/spl/spl_directory.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 8613c9302c..c08334573e 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -2692,7 +2692,7 @@ SPL_METHOD(SplFileObject, fputcsv)
/* }}} */
/* {{{ proto void SplFileObject::setCsvControl([string delimiter = ',' [, string enclosure = '"' [, string escape = '\\']]])
- Set the delimiter and enclosure character used in fgetcsv */
+ Set the delimiter, enclosure and escape character used in fgetcsv */
SPL_METHOD(SplFileObject, setCsvControl)
{
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
@@ -2735,11 +2735,11 @@ SPL_METHOD(SplFileObject, setCsvControl)
/* }}} */
/* {{{ proto array SplFileObject::getCsvControl()
- Get the delimiter and enclosure character used in fgetcsv */
+ Get the delimiter, enclosure and escape character used in fgetcsv */
SPL_METHOD(SplFileObject, getCsvControl)
{
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- char delimiter[2], enclosure[2];
+ char delimiter[2], enclosure[2], escape[2];
array_init(return_value);
@@ -2747,9 +2747,12 @@ SPL_METHOD(SplFileObject, getCsvControl)
delimiter[1] = '\0';
enclosure[0] = intern->u.file.enclosure;
enclosure[1] = '\0';
+ escape[0] = intern->u.file.escape;
+ escape[1] = '\0';
add_next_index_string(return_value, delimiter, 1);
add_next_index_string(return_value, enclosure, 1);
+ add_next_index_string(return_value, escape, 1);
}
/* }}} */