From 20194bed424d9dac2b9506067adde97bfe83ea0d Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 23 Oct 2016 21:27:10 -0700 Subject: this seems to work, but there are unanswered questions and is still undergoing investigation. It appears that the data stored with os_content = 1 is not being escaped in all circumstances or the scaled image data is being escaped twice. --- include/dba/dba_pdo.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'include/dba') 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; -- cgit v1.2.3