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

Bug #8239 MDB2_PORTABILITY_RTRIM ignored by driver
Submitted: 2006-07-18 14:22 UTC
From: ale dot pas at tiscali dot it Assigned: lsmith
Status: Closed Package: MDB2 (version 1.1.0)
PHP Version: 5.1.2 OS: linux
Roadmaps: (Not assigned)    
Subscription  


 [2006-07-18 14:22 UTC] ale dot pas at tiscali dot it (alessandro pasotti)
Description: ------------ option MDB2_PORTABILITY_RTRIM seems to be ignored by pgsql driver, in line 915 of file MDB2/Driver/pgsql.php there is a line like this, if ($this->db->options['portability'] & MDB2_PORTABILITY_EMPTY_TO_NULL) { $this->db->_fixResultArrayValues($row, MDB2_PORTABILITY_EMPTY_TO_NULL); } I believe it should pass control to _fixResultArrayValues also when MDB2_PORTABILITY_RTRIM is set. This works for me (but maybe breaks somewhere else): if ($this->db->options['portability'] & (MDB2_PORTABILITY_EMPTY_TO_NULL | MDB2_PORTABILITY_RTRIM )) { $this->db->_fixResultArrayValues($row, $this->db->options['portability']); } Test script: --------------- http://elpaso.homelinux.org/pear_bug.txt Expected result: ---------------- array 'driver_id' => '1' (length=1) 'driver' => 'GD/Gif' (length=6) 'tstamp' => '2004-04-01 12:00:00' (length=19) Actual result: -------------- array 'driver_id' => '1' (length=1) 'driver' => 'GD/Gif ' (length=50) 'tstamp' => '2004-04-01 12:00:00' (length=19)

Comments

 [2006-07-19 10:42 UTC] lsmith (Lukas Smith)
Moving this to MDB2. We really need test cases for all the portability modes. I assume this issue might affect other drivers as well. Maybe it does not even make sense to only add the rtrim feature only to RDBMS that do not rtrim the output of fixed length character types, because we have no way to differentiate between fixed and variable length columns and variable length columns are not rtrim'ed in any RDBMS afaik.
 [2006-07-19 12:50 UTC] lsmith (Lukas Smith)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. I fixed this issue in the sqlite and pgsql drivers. It may also affect the mssql driver, but its now atleast shown in the test suite (thx to Lorenzo).