svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/spl/spl_directory.c
branches/PHP_5_3/ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt trunk/ext/spl/spl_directory.c
trunk/ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt
| From: | Adam Harvey | Date: | Tue, 09 Nov 2010 14:53:23 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/spl/spl_directory.c branches/PHP_5_3/ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt trunk/ext/spl/spl_directory.c trunk/ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-63789@lists.php.net to get a copy of this message | ||
aharvey Tue, 09 Nov 2010 14:53:23 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=305227
Log:
Fix bug #53279 (SplFileObject doesn't initialise default CSV escape character).
Bug: http://bugs.php.net/53279 (Open) SplFileObject
doesn't initialise default CSV escape character
Changed paths:
U php/php-src/branches/PHP_5_3/NEWS
U php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c
A php/php-src/branches/PHP_5_3/ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt
U php/php-src/trunk/ext/spl/spl_directory.c
A php/php-src/trunk/ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt
Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS 2010-11-09 14:06:25 UTC (rev 305226)
+++ php/php-src/branches/PHP_5_3/NEWS 2010-11-09 14:53:23 UTC (rev 305227)
@@ -55,6 +55,8 @@
- Fixed the filter extension accepting IPv4 octets with a leading 0 as that
belongs to the unsupported "dotted octal" representation. (Gustavo)
+- Fixed bug #53279 (SplFileObject doesn't initialise default CSV escape
+ character). (Adam)
- Fixed bug #53273 (mb_strcut() returns garbage with the excessive length parameter).
(CVE-2010-4156) (Mateusz Kocielski, Pierre, Moriyoshi)
- Fixed bug #53248 (rawurlencode RFC 3986 EBCDIC support misses tilde char).
(Justin Martin)
Modified: php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c 2010-11-09 14:06:25 UTC (rev 305226)
+++ php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c 2010-11-09 14:53:23 UTC (rev 305227)
@@ -275,6 +275,7 @@
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);
Added: php/php-src/branches/PHP_5_3/ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt
(rev 0)
+++ php/php-src/branches/PHP_5_3/ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt 2010-11-09
14:53:23 UTC (rev 305227)
@@ -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"
+}
Modified: php/php-src/trunk/ext/spl/spl_directory.c
===================================================================
--- php/php-src/trunk/ext/spl/spl_directory.c 2010-11-09 14:06:25 UTC (rev 305226)
+++ php/php-src/trunk/ext/spl/spl_directory.c 2010-11-09 14:53:23 UTC (rev 305227)
@@ -274,6 +274,7 @@
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);
Added: php/php-src/trunk/ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt
===================================================================
--- php/php-src/trunk/ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt
(rev 0)
+++ php/php-src/trunk/ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt 2010-11-09 14:53:23
UTC (rev 305227)
@@ -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"
+}