From 5d651aebe9dde95b3c9f5e80dbc90ec3bb237785 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 21 Jun 2017 10:02:29 +0200 Subject: [PATCH] fix at PHP 7.0 not working migrating vfs from db to filesystem (filemanager/cli.php migrate-db2fs) migration loops forever, after migrating all files, as it does not detect no more files to migrate --- api/src/Vfs/Sqlfs/Utils.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/src/Vfs/Sqlfs/Utils.php b/api/src/Vfs/Sqlfs/Utils.php index 9635b6f25f..d46bd41a18 100644 --- a/api/src/Vfs/Sqlfs/Utils.php +++ b/api/src/Vfs/Sqlfs/Utils.php @@ -44,8 +44,9 @@ class Utils extends StreamWrapper $stmt->bindColumn(4,$fs_content,\PDO::PARAM_LOB); $stmt->bindValue(':offset', $n, \PDO::PARAM_INT); - while ($stmt->execute()) + while ($stmt->execute()) // && $stmt->rowCount() does not work for all dbs :( { + $start = $n; foreach($stmt as $row) { // hack to work around a current php bug (http://bugs.php.net/bug.php?id=40913) @@ -84,7 +85,7 @@ class Utils extends StreamWrapper ++$n; } - if (!$n) break; // just in case nothing is found, statement will execute just fine + if (!$n || $n == $start) break; // just in case nothing is found, statement will execute just fine $stmt->bindValue(':offset', $n, \PDO::PARAM_INT); }