summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2022-07-06 09:53:59 +0200
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>2022-07-25 15:59:36 +0000
commit618bbb313c1df2e860c8c9fd403f37fef1be4470 (patch)
tree98c960d8c409c8f442991bd1b25b86c97ccc3d82 /lib
parenta2166864d4995a07efc53a6f9670d61c9f875d0e (diff)
downloadnextcloud-server-618bbb313c1df2e860c8c9fd403f37fef1be4470.tar.gz
nextcloud-server-618bbb313c1df2e860c8c9fd403f37fef1be4470.zip
Fix reading blob data as resource
PostgreSQL returns data as resource when using IQueryBuilder::PARAM_LOB (which is used for QBMapper). Previously we just converted this resource using settype, which produced things like "Resource id #14" instead of the actual resource data. Now we read the stream correctly if the returned data is a resource See context at #22472 Fixes #22439 Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Diffstat (limited to 'lib')
-rw-r--r--lib/public/AppFramework/Db/Entity.php3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/public/AppFramework/Db/Entity.php b/lib/public/AppFramework/Db/Entity.php
index a059e3a27b0..dcd1c77c042 100644
--- a/lib/public/AppFramework/Db/Entity.php
+++ b/lib/public/AppFramework/Db/Entity.php
@@ -113,6 +113,9 @@ abstract class Entity {
$type = $this->_fieldTypes[$name];
if ($type === 'blob') {
// (B)LOB is treated as string when we read from the DB
+ if (is_resource($args[0])) {
+ $args[0] = stream_get_contents($args[0]);
+ }
$type = 'string';
}