Skip to content

PHP Warning "Array to string conversion" in FsActionMapper::insertMove() on first move of a file (postRename hook) #1605

Closed

Description

@csterling8

Which version of recognize are you using?

12.0.2

Enabled Modes

Face recognition, Object recognition

TensorFlow mode

Normal mode

Downstream App

Memories App

Which Nextcloud version do you have installed?

34.0.5

Which Operating system do you have installed?

ubuntu 26.04

Which database are you running Nextcloud on?

mariadb 11.8.9

Which Docker container are you using to run Nextcloud? (if applicable)

No response

How much RAM does your server have?

12G

What processor Architecture does your CPU have?

intel xeon

Describe the Bug

Every first move/rename of a file triggers a PHP warning:

Array to string conversion at /var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php#48

The warning originates from the postRename hook in Recognize's FileListener, which calls FsActionMapper::insertMove(). The insert statement binds an array where a scalar is expected, causing PDO to coerce it to the literal string "Array".

Key characteristics:

Only fires on the first move of a file. Moving the same file again (back to the original folder, or onward to another folder) produces no warning. Presumably the fs_action record already exists on subsequent moves, so the insert path is skipped.
Observed with image files (.jpg) being moved via the Files web UI between two groupfolders (WebDAV MOVE request). Cross-storage moves (copy+delete) trigger it; same-folder renames and moves within one storage do not appear to.
The move operation itself succeeds. The warning is logged twice per move (same reqId, same timestamp), suggesting two array-valued parameters or two executions of the faulty statement.
Possibly data-corrupting: the affected column(s) may receive the string "Array" instead of the intended value.

Suggested investigation
The bug is in custom_apps/recognize/lib/Db/FsActionMapper.php, insertMove() (calls insert() at line ~245; the faulty executeStatement() is at line ~278). Likely causes:

An array passed to the query builder as a normal string/int parameter instead of an array-typed parameter (PARAM_STR_ARRAY / ArrayParameterType::STRING), or
An array value where a scalar column value is expected (e.g. a serialized field not being encoded before insert).
Since the warning appears twice per move, two parameters (or two statements) may be affected.

It may be worth checking whether the corresponding oc_recognize_* rows contain the literal string "Array" in any column, since the insert does not fail — it succeeds with coerced data.

Workaround / mitigation
Disabling the Recognize app stops the warnings entirely (verified).
Enabling 'log.backtrace' => true in Nextcloud config.php is how the stack trace above was obtained (log size increases significantly; disable afterwards).

Expected Behavior

No PHP warning; the fs_action insert should bind correctly typed parameters.

To Reproduce

Install Recognize (12.0.2) on Nextcloud 34.0.5.
Ensure a file (e.g. a JPEG) exists that has not yet been recorded by Recognize (freshly uploaded, never moved since Recognize was active).
Move the file to another folder — in my case, from one groupfolder to another, via the web UI (Files app drag-and-drop or move dialog).
A PHP warning Array to string conversion at .../3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php#48 is logged.
Move the file back to its original location — no warning.
Move it to the destination folder again — no warning.

Debug log

Captured with 'log.backtrace' => true in config.php. Log entry (sanitized):

{
"level": 2,
"time": "2026-11-03T00:13:51+00:00",
"user": "",
"app": "PHP",
"method": "MOVE",
"url": "/remote.php/dav/files//Uploads/Documents/2026/10/IMG_0001.jpg",
"message": "Array to string conversion at /var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php#48"
}
Trace (abridged to the relevant frames):

Doctrine\DBAL\Driver\PDO\Statement->bindValue() 3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php:48
Doctrine\DBAL\Driver\Middleware\AbstractStatementMiddleware->bindValue() .../Middleware/AbstractStatementMiddleware.php:35
Doctrine\DBAL\Connection->bindValue() 3rdparty/doctrine/dbal/src/Connection.php:1842
Doctrine\DBAL\Connection->bindParameters() 3rdparty/doctrine/dbal/src/Connection.php:1210
Doctrine\DBAL\Connections\PrimaryReadReplicaConnection->executeStatement() .../PrimaryReadReplicaConnection.php:292
OC\DB\Connection->executeStatement() lib/private/DB/Connection.php:476
OC\DB\ConnectionAdapter->executeStatement() lib/private/DB/ConnectionAdapter.php:76
OC\DB\QueryBuilder\QueryBuilder->executeStatement() lib/private/DB/QueryBuilder/QueryBuilder.php:279
OCA\Recognize\Db\FsActionMapper->insert() custom_apps/recognize/lib/Db/FsActionMapper.php:278
OCA\Recognize\Db\FsActionMapper->insertMove() custom_apps/recognize/lib/Db/FsActionMapper.php:245
OCA\Recognize\Hooks\FileListener->postRename() custom_apps/recognize/lib/Hooks/FileListener.php:298
(called from FileListener.php:174)
OC\EventDispatcher\ServiceEventListener->handle() lib/private/EventDispatcher/ServiceEventListener.php:57
... symfony EventDispatcher dispatch chain ...
OC\Files\Node\HookConnector->postRename() lib/private/Files/Node/HookConnector.php:169
OC_Hook::emit() lib/private/legacy/OC_Hook.php:87
OC\Files\View->rename() lib/private/Files/View.php:861
OCA\DAV\Connector\Sabre\Directory->moveInto() apps/dav/lib/Connector/Sabre/Directory.php:459
Sabre\DAV\Tree->move() 3rdparty/sabre/dav/lib/DAV/Tree.php:178
Sabre\DAV\CorePlugin->httpMove() 3rdparty/sabre/dav/lib/DAV/CorePlugin.php:612

Activity

  1. marcelklehr commented on Nov 3, 2026

    @marcelklehr
    Member

    Thanks for the detailed report! The cause is that FsMove::getAddedUsers()/getTargetUsers() return arrays, which the mapper's insert() binds as strings. This has already been fixed in #1568 (backported to stable12 in #1599), which removes those columns entirely. The fix will ship with the next 12.x release. The "Array" values in oc_recognize_fs_moves are harmless and will be dropped by the migration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions