From: stronk7 Date: Wed, 14 Oct 2009 10:32:48 +0000 (+0000) Subject: Fix retrieving of NULLs in PG databases and binary fields X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=2b4cf032fa9718795c17e2dcbec81a0b8541f949;p=moodle.git Fix retrieving of NULLs in PG databases and binary fields --- diff --git a/lib/dml/pgsql_native_moodle_database.php b/lib/dml/pgsql_native_moodle_database.php index 98becbc628..67f213cd5b 100644 --- a/lib/dml/pgsql_native_moodle_database.php +++ b/lib/dml/pgsql_native_moodle_database.php @@ -653,7 +653,7 @@ class pgsql_native_moodle_database extends moodle_database { $id = reset($row); if ($blobs) { foreach ($blobs as $blob) { - $row[$blob] = pg_unescape_bytea($row[$blob]); + $row[$blob] = $row[$blob] !== null ? pg_unescape_bytea($row[$blob]) : null; } } if (isset($return[$id])) { diff --git a/lib/dml/pgsql_native_moodle_recordset.php b/lib/dml/pgsql_native_moodle_recordset.php index 525a48c916..41093740e0 100644 --- a/lib/dml/pgsql_native_moodle_recordset.php +++ b/lib/dml/pgsql_native_moodle_recordset.php @@ -62,7 +62,7 @@ class pgsql_native_moodle_recordset extends moodle_recordset { if ($this->blobs) { foreach ($this->blobs as $blob) { - $row[$blob] = pg_unescape_bytea($row[$blob]); + $row[$blob] = $row[$blob] !== null ? pg_unescape_bytea($row[$blob]) : null; } }