Merge branch 'fix-infinite-loop' into 'dev'

Fix infinite loop using postgres as backend

See merge request hubzilla/core!1605
This commit is contained in:
Max Kostikov 2019-04-22 19:47:49 +02:00
commit f0edfca75c

View File

@ -161,23 +161,17 @@ class dba_pdo extends dba_driver {
}
function unescapebin($str) {
if($this->driver_dbtype === 'pgsql' && (! is_null($str))) {
$x = '';
while(! feof($str)) {
$x .= fread($str,8192);
if($this->driver_dbtype === 'pgsql') {
if(gettype($str) === 'resource') {
$str = stream_get_contents($str);
}
if(substr($x,0,2) === '\\x') {
$x = hex2bin(substr($x,2));
if(substr($str,0,2) === '\\x') {
$str = hex2bin(substr($str,2));
}
return $x;
}
else {
return $str;
}
return $str;
}
function getdriver() {
return 'pdo';
}