bedezign/yii2-audit

Php 7.2. Array to string conversion

StalkAlex opened this issue · 6 comments

2018-03-27 10:17:40 [172.18.0.8][319][-][warning][yii\log\Dispatcher::dispatch] Unable to send log via bedezign\yii2\audit\LogTarget: PHP Notice 'yii\base\ErrorException' with message 'Array to string conversion' 

in /app/vendor/yiisoft/yii2/db/Command.php:219

Stack trace:
#0 [internal function]: yii\base\ErrorHandler->handleError(8, 'Array to string...', '/app/vendor/yii...', 219, Array)
#1 /app/vendor/yiisoft/yii2/db/Command.php(219): strtr('INSERT INTO "au...', Array)
#2 /app/vendor/yiisoft/yii2/db/Command.php(1096): yii\db\Command->getRawSql()
#3 /app/vendor/yiisoft/yii2/db/Command.php(1061): yii\db\Command->logQuery('yii\\db\\Command:...')
#4 /app/vendor/bedezign/yii2-audit/src/models/AuditEntry.php(127): yii\db\Command->execute()
#5 /app/vendor/bedezign/yii2-audit/src/LogTarget.php(57): bedezign\yii2\audit\models\AuditEntry->addBatchData(Array, false)
#6 /app/vendor/bedezign/yii2-audit/src/LogTarget.php(74): bedezign\yii2\audit\LogTarget->export()
#7 /app/vendor/yiisoft/yii2/log/Dispatcher.php(189): bedezign\yii2\audit\LogTarget->collect(Array, true)
#8 /app/vendor/yiisoft/yii2/log/Logger.php(177): yii\log\Dispatcher->dispatch(Array, true)
#9 [internal function]: yii\log\Logger->flush(true)
#10 {main}

Can I assume you are using an older Yii version? As described on the main repo page, the first section, we cannot support PHP 7.2 on a version of Yii that is not 2.0.13 or later.

No, I'm using 2.0.14.1

And you also switched to our v2 releases?

Yes, I was who started those changes :) #235

Right, sorry :)

Okay I see what the issue is. The fix in the yii framework that resolved that binding issue was actually released as part of hotfix 2.0.14.2, so the one after yours:

https://github.com/yiisoft/yii2/blob/2.0.14.2/framework/CHANGELOG.md

  • Bug #15817: Fixed support of deprecated array format type casting in yii\db\Command::bindValues() (silverfire)

So if you upgrade to the next hotfix you should be ok.

Okay, thanks for the hint!