Changeset 10948
- Timestamp:
- 08/19/08 16:20:41 (2 years ago)
- Files:
-
- branches/1.0/lib/vendor/creole/drivers/mysqli/MySQLiResultSet.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/lib/vendor/creole/drivers/mysqli/MySQLiResultSet.php (modified) (1 diff)
- branches/1.2/lib/plugins/sfPropelPlugin/lib/vendor/creole/drivers/mysqli/MySQLiResultSet.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.0/lib/vendor/creole/drivers/mysqli/MySQLiResultSet.php
r497 r10948 140 140 } 141 141 142 if ($this->fields[$column] === null ) {142 if ($this->fields[$column] === null || $this->fields[$column] == '0000-00-00 00:00:00') { 143 143 return null; 144 144 } 145 145 146 146 $ts = strtotime($this->fields[$column]); 147 148 /** 149 * @see ResultSetCommon::getDate() 150 */ 151 public function getDate($column, $format = '%X') 152 { 153 /* As of PHP 5.2.4, strftime() returns false for '0000-00-00' which 154 is impossible to tell apart from illegal dates. (Pre-PHP 5.2.4 155 even interpreted such dates incorrectly, see 156 http://bugs.php.net/bug.php?id=41523). 157 We catch this special case and return null as the date here. 158 However, we need to know the exact format the DBMS returns this 159 date, which is why we make this decision here in the specific 160 driver before dispatching to the common implementation. */ 161 $idx = (is_int($column) ? $column - 1 : $column); 162 if (array_key_exists($idx, $this->fields) && $this->fields[$idx] == '0000-00-00') return null; 163 return parent::getDate($column, $format); 164 } 147 165 148 166 if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE branches/1.1/lib/plugins/sfPropelPlugin/lib/vendor/creole/drivers/mysqli/MySQLiResultSet.php
r497 r10948 140 140 } 141 141 142 if ($this->fields[$column] === null ) {142 if ($this->fields[$column] === null || $this->fields[$column] == '0000-00-00 00:00:00') { 143 143 return null; 144 144 } 145 145 146 146 $ts = strtotime($this->fields[$column]); 147 148 /** 149 * @see ResultSetCommon::getDate() 150 */ 151 public function getDate($column, $format = '%X') 152 { 153 /* As of PHP 5.2.4, strftime() returns false for '0000-00-00' which 154 is impossible to tell apart from illegal dates. (Pre-PHP 5.2.4 155 even interpreted such dates incorrectly, see 156 http://bugs.php.net/bug.php?id=41523). 157 We catch this special case and return null as the date here. 158 However, we need to know the exact format the DBMS returns this 159 date, which is why we make this decision here in the specific 160 driver before dispatching to the common implementation. */ 161 $idx = (is_int($column) ? $column - 1 : $column); 162 if (array_key_exists($idx, $this->fields) && $this->fields[$idx] == '0000-00-00') return null; 163 return parent::getDate($column, $format); 164 } 147 165 148 166 if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE branches/1.2/lib/plugins/sfPropelPlugin/lib/vendor/creole/drivers/mysqli/MySQLiResultSet.php
r497 r10948 140 140 } 141 141 142 if ($this->fields[$column] === null ) {142 if ($this->fields[$column] === null || $this->fields[$column] == '0000-00-00 00:00:00') { 143 143 return null; 144 144 } 145 145 146 146 $ts = strtotime($this->fields[$column]); 147 148 /** 149 * @see ResultSetCommon::getDate() 150 */ 151 public function getDate($column, $format = '%X') 152 { 153 /* As of PHP 5.2.4, strftime() returns false for '0000-00-00' which 154 is impossible to tell apart from illegal dates. (Pre-PHP 5.2.4 155 even interpreted such dates incorrectly, see 156 http://bugs.php.net/bug.php?id=41523). 157 We catch this special case and return null as the date here. 158 However, we need to know the exact format the DBMS returns this 159 date, which is why we make this decision here in the specific 160 driver before dispatching to the common implementation. */ 161 $idx = (is_int($column) ? $column - 1 : $column); 162 if (array_key_exists($idx, $this->fields) && $this->fields[$idx] == '0000-00-00') return null; 163 return parent::getDate($column, $format); 164 } 147 165 148 166 if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE

