Fix : Test pg_escape and pg_unescape exist before executing them

This commit is contained in:
Flokami
2022-04-18 22:51:16 +04:00
parent b18b9a960f
commit 8f215b2f6a
2 changed files with 9 additions and 2 deletions

View File

@@ -132,7 +132,12 @@ class DbHelper
public function getExtra($data) public function getExtra($data)
{ {
if ($this->getDBType() == "pgsql" && is_resource($data)) { if ($this->getDBType() == "pgsql" && is_resource($data)) {
$extra = pg_unescape_bytea(stream_get_contents($data)); if (function_exists("pg_unescape_bytea")) {
$extra = pg_unescape_bytea(stream_get_contents($data));
}
else {
$extra = stream_get_contents($data);
}
return unserialize($extra); return unserialize($extra);
} }
return unserialize($data); return unserialize($data);

View File

@@ -65,7 +65,9 @@ class YoutubeHelper
if ($file) { if ($file) {
$extra = serialize($extra); $extra = serialize($extra);
if($this->dbconn->getDBType() == "pgsql"){ if($this->dbconn->getDBType() == "pgsql"){
$extra = pg_escape_bytea($extra); if (function_exists("pg_escape_bytea")) {
$extra = pg_escape_bytea($extra);
}
} }
$data = [ $data = [
'uid' => $this->user, 'uid' => $this->user,