Fix null bytea columns.

Apply patch from 'opiazer'  Fixes #2432
This commit is contained in:
mark_story 2012-01-03 20:32:34 -05:00
parent 101148c10f
commit c43b099894
2 changed files with 2 additions and 2 deletions

View file

@ -716,7 +716,7 @@ class Postgres extends DboSource {
break; break;
case 'binary': case 'binary':
case 'bytea': case 'bytea':
$resultRow[$table][$column] = stream_get_contents($row[$index]); $resultRow[$table][$column] = is_null($row[$index]) ? null : stream_get_contents($row[$index]);
break; break;
default: default:
$resultRow[$table][$column] = $row[$index]; $resultRow[$table][$column] = $row[$index];

View file

@ -759,7 +759,7 @@ class PostgresTest extends CakeTestCase {
*/ */
function testVirtualFieldAsAConstant() { function testVirtualFieldAsAConstant() {
$this->loadFixtures('Article', 'Comment'); $this->loadFixtures('Article', 'Comment');
$Article =& ClassRegistry::init('Article'); $Article = ClassRegistry::init('Article');
$Article->virtualFields = array( $Article->virtualFields = array(
'empty' => "NULL", 'empty' => "NULL",
'number' => 43, 'number' => 43,