-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Fix: Array to string conversion in Zend\Log\Writer\Db #7282
Fix: Array to string conversion in Zend\Log\Writer\Db #7282
Conversation
Please don't merge this yet. I am looking into a better approach for this by changing |
Nevermind, my other idea won't work, because the formatter is unaware of the database columns and therefore does not know if an array should be converted to string. |
continue; | ||
} | ||
|
||
$data[$columnMap[$name][$key]] = var_export($subvalue, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this should be json_encode()
instead. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using json_encode()
objects are stored as stdClass and not as the original class name and this causes loss of data. I looked at other possibilities too (see this comment #7244 (comment) and the one after that).
var_export()
keeps the data readable. If the data needs to be processed further, the method Zend\Log\Formatter\Base::normalize()
provides a nice way to do this, but I don't see how I can use that method (see my previous comment #7282 (comment)).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough!
…string-conversion Fix: Array to string conversion in Zend\Log\Writer\Db
Merged to develop for release with 2.4. |
…fix/log-writer-db-array-to-string-conversion Fix: Array to string conversion in Zend\Log\Writer\Db
Fix for issue #7244 where
Zend\Log\Writer\Db
can trigger an array to string conversion.Because the method
eventIntoColumn
has the same issue asmapEventIntoColumn
, I applied the patch toeventIntoColumn
as well.