Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.0

Bug #5652 Static $config causes error with several CSV-objects
Submitted: 2005-10-10 22:51 UTC
From: blinky at gmx dot net Assigned: dufuz
Status: Bogus Package: File_CSV
PHP Version: 4.3.10 OS: Linux 2.6.12
Roadmaps: (Not assigned)    
Subscription  
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes. If this is not your bug, you can add a comment by following this link. If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
2011-03-19 03:46 UTC
Package:
Bug Type:
Summary:
From: blinky at gmx dot net
New email:
PHP Version: Package Version: OS:

 

 [2005-10-10 22:51 UTC] blinky at gmx dot net
Description: ------------ With several objects based upon File_CSV there will be problems in loops with read() and write() calls when they have different configuration (5 vs. 42 fields). Test script: --------------- $csvFile = new File_CSV(); $outFile = new File_CSV(); $csvfileformat = $csvFile->discoverFormat($csvfilename); $csvoutformat = array('fields' => 5, 'sep' => ';', 'quote' => '"'); while ($csv_line = $csvFile->read($csvfilename, $csvfileformat)) { $outarray[] = $csv_line[0]; $outarray[] = $csv_line[1]; $outarray[] = $csv_line[23]; $outarray[] = $csv_line[33]; $outarray[] = $csv_line[43]; $outFile->write($outfilename, $outarray, $csvoutformat); } Bugfix description below. Expected result: ---------------- The first line in the output file will contain 5 fields with the correct value. The second line (after the first call of write() with the other configuration) will only contain the first and second value since read() only reads 5 fields instead of 42. I could fix this problem by changing the file CSV.php like this: 1. Adding "var $config;" after "class File_CSV {" 2. In function "getPointer" I removed "static $config". 3. In "getPointer" I replaced "$config" by "$this->config". (near lines 138 and 148)

Comments

 [2005-10-11 01:01 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2011-03-19 03:46 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!