diff options
Diffstat (limited to 'include')
-rwxr-xr-x | include/dba/dba_pdo.php | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/include/dba/dba_pdo.php b/include/dba/dba_pdo.php index 9f8deaf17..b247728ff 100755 --- a/include/dba/dba_pdo.php +++ b/include/dba/dba_pdo.php @@ -134,12 +134,15 @@ class dba_pdo extends dba_driver { function unescapebin($str) { if($this->driver_dbtype === 'pgsql') { + $x = ''; + while(! feof($str)) { + $x .= fread($str,8192); + } + if(substr($x,0,2) === '\\x') { + $x = hex2bin(substr($x,2)); + } + return $x; - // The initial backslash inserted by escapebin above will have been stripped - // by the postgres server, leaving us with '\x{hexdigits}' - // The PDO driver returns bytea fields as streams, so fetch the content with fgets - - return hex2bin(substr(fgets($str),2)); } else { return $str; |