Bug #46463 [Com]: fgetcsv() omits empty fields

2011-12-29 Thread php at zeguigui dot com
Edit report at https://bugs.php.net/bug.php?id=46463&edit=1

 ID: 46463
 Comment by:     php at zeguigui dot com
 Reported by:php-bugs at christoph-jeschke dot de
 Summary:fgetcsv() omits empty fields
 Status: No Feedback
 Type:   Bug
 Package:Filesystem function related
 Operating System:   GNU/Linux
 PHP Version:5.2CVS-2008-11-01
 Block user comment: N
 Private report: N

 New Comment:

In fact I have the #55674 bug


Previous Comments:

[2011-12-29 12:38:06] php at zeguigui dot com

I have the same issue using \t as a delimiter and " as an enclosure.

php -v
PHP 5.3.8-pl0-gentoo (cli) (built: Dec  5 2011 22:34:55)

Please not that § is a valid ascii character (\u00A7)


[2009-09-27 01:00:02] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".


[2009-09-19 19:08:07] sjo...@php.net

Thank you for your bug report.

Your example uses a strange delimeter. First, it contains multiple characters. 
Second, it contains non-ASCII characters. The documentation says that the 
delimeter should be one character. When I try your example, the lines are not 
split at all, so I can not reproduce the problem.

Can you reproduce the problem with an ASCII-delimeter consisting of multiple 
characters? Can you reproduce the problem with a delimiter which is a single 
non-ASCII character? Can you still reproduce the problem with the latest PHP 
version?


[2008-11-02 13:53:59] php-bugs at christoph-jeschke dot de

# php -v
PHP 5.2.7RC3-dev (cli) (built: Nov  2 2008 14:49:46)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologie

Returns:

array(3) {
  [0]=>
  string(7) "line1f1"
  [1]=>
  string(7) "line1f2"
  [2]=>
  string(7) "line1f3"
}
array(3) {
  [0]=>
  string(7) "line2f1"
  [1]=>
  string(7) "line2f2"
  [2]=>
  string(7) "line2f3"
}
array(2) {
  [0]=>
  string(7) "line3f1"
  [1]=>
  string(7) "line3f3"
}

The empty field is still omitted.


[2008-11-02 09:26:57] php-bugs at christoph-jeschke dot de

Description:

Since PHP5, fgetcsv() omits empty fields instead returning a empty string as 
did in PHP4.

Reproduce code:
---
csv.php
===


paragraph.csv
=
line1f1§line1f2§line1f3
line2f1§line2f2§line2f3
line3f1§§line3f3

Expected result:

array(3) {
  [0]=>
  string(7) "line1f1"
  [1]=>
  string(7) "line1f2"
  [2]=>
  string(7) "line1f3"
}
array(3) {
  [0]=>
  string(7) "line2f1"
  [1]=>
  string(7) "line2f2"
  [2]=>
  string(7) "line2f3"
}
array(3) {
  [0]=>
  string(7) "line3f1"
  [1]=>
  string(0) ""
  [2]=>
  string(7) "line3f3"
}

Actual result:
--
array(3) {
  [0]=>
  string(7) "line1f1"
  [1]=>
  string(7) "line1f2"
  [2]=>
  string(7) "line1f3"
}
array(3) {
  [0]=>
  string(7) "line2f1"
  [1]=>
  string(7) "line2f2"
  [2]=>
  string(7) "line2f3"
}
array(2) {
  [0]=>
  string(7) "line3f1"
  [1]=>
  string(7) "line3f3"
}







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=46463&edit=1


Bug #46463 [Com]: fgetcsv() omits empty fields

2011-12-29 Thread php at zeguigui dot com
Edit report at https://bugs.php.net/bug.php?id=46463&edit=1

 ID: 46463
 Comment by:     php at zeguigui dot com
 Reported by:php-bugs at christoph-jeschke dot de
 Summary:fgetcsv() omits empty fields
 Status: No Feedback
 Type:   Bug
 Package:Filesystem function related
 Operating System:   GNU/Linux
 PHP Version:5.2CVS-2008-11-01
 Block user comment: N
 Private report: N

 New Comment:

I have the same issue using \t as a delimiter and " as an enclosure.

php -v
PHP 5.3.8-pl0-gentoo (cli) (built: Dec  5 2011 22:34:55)

Please not that § is a valid ascii character (\u00A7)


Previous Comments:

[2009-09-27 01:00:02] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".


[2009-09-19 19:08:07] sjo...@php.net

Thank you for your bug report.

Your example uses a strange delimeter. First, it contains multiple characters. 
Second, it contains non-ASCII characters. The documentation says that the 
delimeter should be one character. When I try your example, the lines are not 
split at all, so I can not reproduce the problem.

Can you reproduce the problem with an ASCII-delimeter consisting of multiple 
characters? Can you reproduce the problem with a delimiter which is a single 
non-ASCII character? Can you still reproduce the problem with the latest PHP 
version?


[2008-11-02 13:53:59] php-bugs at christoph-jeschke dot de

# php -v
PHP 5.2.7RC3-dev (cli) (built: Nov  2 2008 14:49:46)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologie

Returns:

array(3) {
  [0]=>
  string(7) "line1f1"
  [1]=>
  string(7) "line1f2"
  [2]=>
  string(7) "line1f3"
}
array(3) {
  [0]=>
  string(7) "line2f1"
  [1]=>
  string(7) "line2f2"
  [2]=>
  string(7) "line2f3"
}
array(2) {
  [0]=>
  string(7) "line3f1"
  [1]=>
  string(7) "line3f3"
}

The empty field is still omitted.


[2008-11-02 09:26:57] php-bugs at christoph-jeschke dot de

Description:

Since PHP5, fgetcsv() omits empty fields instead returning a empty string as 
did in PHP4.

Reproduce code:
---
csv.php
===


paragraph.csv
=
line1f1§line1f2§line1f3
line2f1§line2f2§line2f3
line3f1§§line3f3

Expected result:

array(3) {
  [0]=>
  string(7) "line1f1"
  [1]=>
  string(7) "line1f2"
  [2]=>
  string(7) "line1f3"
}
array(3) {
  [0]=>
  string(7) "line2f1"
  [1]=>
  string(7) "line2f2"
  [2]=>
  string(7) "line2f3"
}
array(3) {
  [0]=>
  string(7) "line3f1"
  [1]=>
  string(0) ""
  [2]=>
  string(7) "line3f3"
}

Actual result:
--
array(3) {
  [0]=>
  string(7) "line1f1"
  [1]=>
  string(7) "line1f2"
  [2]=>
  string(7) "line1f3"
}
array(3) {
  [0]=>
  string(7) "line2f1"
  [1]=>
  string(7) "line2f2"
  [2]=>
  string(7) "line2f3"
}
array(2) {
  [0]=>
  string(7) "line3f1"
  [1]=>
  string(7) "line3f3"
}







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=46463&edit=1