Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.6.9.1]: Find and replace command fails Array to string conversion type casting #16751

Open
davidwebca opened this issue Feb 21, 2025 · 1 comment
Labels

Comments

@davidwebca
Copy link
Contributor

davidwebca commented Feb 21, 2025

What happened?

Description

Hi!

Had to make a huge search-replace in our project and it fails with the latest version in the corner of the type casting functions called before executing the update. I haven't had much time to pre-dig into it to help the diagnosis as I usually like to do, but it seems related to type casting the database before executing the update.

Steps to reproduce

  1. Create entries with "asdf" or any words inside a sub-matrix block.
  2. Use the admin interface "Find and replace" utility and search "asdf" to change it to "whatever"
  3. The queue manager outputs the error

Expected behavior

Search and replace should go through.

Actual behavior

It seems to fail at type casting, maybe some of the array or json types?

Stack trace

[queue.ERROR] [craft\queue\QueueLogBehavior::afterError] [93652] Replacing “asdf” with “whatever” (batch 1 of 3) (attempt: 1, pid: 99598) - Error (time: 0.727s): Array to string conversion {"memory":5160368}
[queue.ERROR] [yii\base\ErrorException:2] yii\base\ErrorException: Array to string conversion in vendor/yiisoft/yii2/db/ColumnSchema.php:173
Stack trace:
[queue.ERROR] [craft\queue\QueueLogBehavior::afterError] [93652] Replacing “asdf” with “whatever” (batch 1 of 3) (attempt: 1, pid: 99598) - Error (time: 0.727s): Array to string conversion {"memory":5160368}
[queue.ERROR] [yii\base\ErrorException:2] yii\base\ErrorException: Array to string conversion in vendor/yiisoft/yii2/db/ColumnSchema.php:173
Stack trace:
#​0 vendor/craftcms/cms/src/web/ErrorHandler.php(115): yii\base\ErrorHandler->handleError(2, 'Array to string...', '...', 173)
#​1 vendor/yiisoft/yii2/db/ColumnSchema.php(173): craft\web\ErrorHandler->handleError(2, 'Array to string...', '...', 173)
#​2 vendor/craftcms/cms/src/db/mysql/ColumnSchema.php(36): yii\db\ColumnSchema->typecast(Array)
#​3 vendor/yiisoft/yii2/db/mysql/ColumnSchema.php(49): craft\db\mysql\ColumnSchema->typecast(Array)
#​4 vendor/yiisoft/yii2/db/QueryBuilder.php(651): yii\db\mysql\ColumnSchema->dbTypecast(Array)
#​5 vendor/yiisoft/yii2/db/QueryBuilder.php(630): yii\db\QueryBuilder->prepareUpdateSets('{{%elements_sit...', Array, Array)
#​6 vendor/yiisoft/yii2/db/Command.php(598): yii\db\QueryBuilder->update('{{%elements_sit...', Array, Array, Array)
#​7 vendor/craftcms/cms/src/db/Command.php(152): yii\db\Command->update('{{%elements_sit...', Array, Array, Array)
#​8 vendor/craftcms/cms/src/helpers/Db.php(1116): craft\db\Command->update('{{%elements_sit...', Array, Array, Array, false)
#​9 vendor/craftcms/cms/src/queue/jobs/FindAndReplace.php(61): craft\helpers\Db::update('{{%elements_sit...', Array, Array, Array, false)
#​10 vendor/craftcms/cms/src/queue/BaseBatchedJob.php(137): craft\queue\jobs\FindAndReplace->processItem(Array)
#​11 vendor/yiisoft/yii2-queue/src/Queue.php(243): craft\queue\BaseBatchedJob->execute(Object(craft\queue\Queue))
#​12 vendor/yiisoft/yii2-queue/src/cli/Queue.php(147): yii\queue\Queue->handleMessage(93652, 'O:31:"craft\que...', 300, 1)
#​13 vendor/craftcms/cms/src/queue/Queue.php(192): yii\queue\cli\Queue->handleMessage(93652, 'O:31:"craft\que...', 300, 1)
#​14 vendor/craftcms/cms/src/queue/Queue.php(167): craft\queue\Queue->executeJob()
#​15 [internal function]: craft\queue\Queue->craft\queue{closure}(Object(Closure))
#​16 vendor/yiisoft/yii2-queue/src/cli/Queue.php(114): call_user_func(Object(Closure), Object(Closure))
#​17 vendor/craftcms/cms/src/queue/Queue.php(165): yii\queue\cli\Queue->runWorker(Object(Closure))
#​18 vendor/craftcms/cms/src/controllers/QueueController.php(98): craft\queue\Queue->run()
#​19 vendor/craftcms/cms/src/controllers/QueueController.php(118): craft\controllers\QueueController->actionRun()
#​20 [internal function]: craft\controllers\QueueController->actionRetry()
#​21 vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#​22 vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#​23 vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('retry', Array)
#​24 vendor/craftcms/cms/src/web/Application.php(361): yii\base\Module->runAction('queue/retry', Array)
#​25 vendor/craftcms/cms/src/web/Application.php(660): craft\web\Application->runAction('queue/retry', Array)
#​26 vendor/craftcms/cms/src/web/Application.php(323): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#​27 vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#​28 web/index.php(12): yii\base\Application->run()
#​29 {main} {"memory":5160640,"exception":"[object] (yii\base\ErrorException(code: 2): Array to string conversion at vendor/yiisoft/yii2/db/ColumnSchema.php:173)"}
[queue.ERROR] [yii\base\ErrorException:2] yii\base\ErrorException: Array to string conversion in vendor/yiisoft/yii2/db/ColumnSchema.php:173
Stack trace:
#​0 vendor/craftcms/cms/src/web/ErrorHandler.php(115): yii\base\ErrorHandler->handleError(2, 'Array to string...', '...', 173)
#​1 vendor/yiisoft/yii2/db/ColumnSchema.php(173): craft\web\ErrorHandler->handleError(2, 'Array to string...', '...', 173)
#​2 vendor/craftcms/cms/src/db/mysql/ColumnSchema.php(36): yii\db\ColumnSchema->typecast(Array)
#​3 vendor/yiisoft/yii2/db/mysql/ColumnSchema.php(49): craft\db\mysql\ColumnSchema->typecast(Array)
#​4 vendor/yiisoft/yii2/db/QueryBuilder.php(651): yii\db\mysql\ColumnSchema->dbTypecast(Array)
#​5 vendor/yiisoft/yii2/db/QueryBuilder.php(630): yii\db\QueryBuilder->prepareUpdateSets('{{%elements_sit...', Array, Array)
#​6 vendor/yiisoft/yii2/db/Command.php(598): yii\db\QueryBuilder->update('{{%elements_sit...', Array, Array, Array)
#​7 vendor/craftcms/cms/src/db/Command.php(152): yii\db\Command->update('{{%elements_sit...', Array, Array, Array)
#​8 vendor/craftcms/cms/src/helpers/Db.php(1116): craft\db\Command->update('{{%elements_sit...', Array, Array, Array, false)
#​9 vendor/craftcms/cms/src/queue/jobs/FindAndReplace.php(61): craft\helpers\Db::update('{{%elements_sit...', Array, Array, Array, false)
#​10 vendor/craftcms/cms/src/queue/BaseBatchedJob.php(137): craft\queue\jobs\FindAndReplace->processItem(Array)
#​11 vendor/yiisoft/yii2-queue/src/Queue.php(243): craft\queue\BaseBatchedJob->execute(Object(craft\queue\Queue))
#​12 vendor/yiisoft/yii2-queue/src/cli/Queue.php(147): yii\queue\Queue->handleMessage(93652, 'O:31:"craft\que...', 300, 1)
#​13 vendor/craftcms/cms/src/queue/Queue.php(192): yii\queue\cli\Queue->handleMessage(93652, 'O:31:"craft\que...', 300, 1)
#​14 vendor/craftcms/cms/src/queue/Queue.php(167): craft\queue\Queue->executeJob()
#​15 [internal function]: craft\queue\Queue->craft\queue{closure}(Object(Closure))
#​16 vendor/yiisoft/yii2-queue/src/cli/Queue.php(114): call_user_func(Object(Closure), Object(Closure))
#​17 vendor/craftcms/cms/src/queue/Queue.php(165): yii\queue\cli\Queue->runWorker(Object(Closure))
#​18 vendor/craftcms/cms/src/controllers/QueueController.php(98): craft\queue\Queue->run()
#​19 vendor/craftcms/cms/src/controllers/QueueController.php(118): craft\controllers\QueueController->actionRun()
#​20 [internal function]: craft\controllers\QueueController->actionRetry()
#​21 vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#​22 vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#​23 vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('retry', Array)
#​24 vendor/craftcms/cms/src/web/Application.php(361): yii\base\Module->runAction('queue/retry', Array)
#​25 vendor/craftcms/cms/src/web/Application.php(660): craft\web\Application->runAction('queue/retry', Array)
#​26 vendor/craftcms/cms/src/web/Application.php(323): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#​27 vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#​28 web/index.php(12): yii\base\Application->run()
#​29 {main} {"memory":5163256,"exception":"[object] (yii\base\ErrorException(code: 2): Array to string conversion at vendor/yiisoft/yii2/db/ColumnSchema.php:173)"}

Craft CMS version

5.6.9.1

PHP version

8.2.20 locally and 8.2.27 on remote

Operating system and version

MacOS Sequoia 15.3 locally and AlmaLinux 8.10 (Linux 4.18.0-553.30.1.el8_10.x86_64) on remote

Database type and version

MySQL 8.3.0 locally and 8.0.41 on remote

Image driver and version

GD 8.2.27 locally and GD 8.2.20 on remote

Installed plugins and versions

Name Handle Package Name Version Installed Enabled
Blocksmith blocksmith mediakreativ/craft-blocksmith dev-main Yes Yes
CKEditor ckeditor craftcms/ckeditor 4.6.0 Yes Yes
Colorit colorit presseddigital/colorit dev-master Yes Yes
Content Templates content-templates spicyweb/craft-content-templates 2.0.2 Yes Yes
Entry GPS Coordinates entry-gps-coordinates nthmedia/entry-gps-coordinates dev-master Yes Yes
Field Manager field-manager verbb/field-manager 4.0.3 Yes Yes
Formie formie verbb/formie 3.0.20 Yes Yes
Hyper hyper verbb/hyper 2.2.1 Yes Yes
Icon Picker icon-picker verbb/icon-picker 3.0.3 Yes Yes
Navigation navigation verbb/navigation 3.0.6 Yes Yes
oEmbed oembed wrav/oembed dev-feature/gql-params Yes Yes
Route Map route-map nystudio107/craft-routemap dev-craft-5 Yes Yes
SEOmatic seomatic nystudio107/craft-seomatic dev-develop-v5 Yes Yes
Smith smith verbb/smith 3.1.0 Yes Yes
Feed Me feed-me craftcms/feed-me 6.7.0 Yes No
Control Panel Nav cp-nav verbb/cp-nav 5.0.3 No No
@davidwebca davidwebca added the bug label Feb 21, 2025
@i-just
Copy link
Contributor

i-just commented Feb 24, 2025

Hi, thanks for reaching out! I’m not able to reproduce this. Any chance you could send your composer.json, composer.lock and database export to [email protected] and point out the find and replace strings you’re using when this error occurs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants