aboutsummaryrefslogtreecommitdiffstats
path: root/include/dba/dba_pdo.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2016-10-23 21:27:10 -0700
committerzotlabs <mike@macgirvin.com>2016-10-23 21:27:10 -0700
commit20194bed424d9dac2b9506067adde97bfe83ea0d (patch)
treee92237e087328ee40cb4a766e50013cd8315dd6c /include/dba/dba_pdo.php
parent39f0707201109d7d5784e254aca320af43812ec8 (diff)
downloadvolse-hubzilla-20194bed424d9dac2b9506067adde97bfe83ea0d.tar.gz
volse-hubzilla-20194bed424d9dac2b9506067adde97bfe83ea0d.tar.bz2
volse-hubzilla-20194bed424d9dac2b9506067adde97bfe83ea0d.zip
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.
Diffstat (limited to 'include/dba/dba_pdo.php')
-rwxr-xr-xinclude/dba/dba_pdo.php13
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;