DamienHarper / auditor

auditor, the missing audit log library
MIT License
164 stars 53 forks source link

mb_convert_encoding(): Object is not supported #220

Closed mrshaharb closed 1 month ago

mrshaharb commented 2 months ago

https://github.com/DamienHarper/auditor/blob/80855fca1ff007e1c3fae587f38d4ed07e99407e/src/Provider/Doctrine/Auditing/Transaction/TransactionProcessor.php#L213

creates an error similar to https://github.com/DamienHarper/auditor/issues/155: mb_convert_encoding(): Object is not supported

should be $diff = is_string($data["diff"]) ? mb_convert_encoding($data['diff'], 'UTF-8', 'UTF-8') : $data["diff"];

remyroussel commented 1 month ago

I’m experiencing the same issue when $diff is an array containing an object. Since commit https://github.com/DamienHarper/auditor/commit/e5ab4e3b181ffe539e2232cc30283854222b13e6, we allow TransactionProcessor::audit $data['diff'] arrays to be handled by mb_convert_encoding (only string was before). Problem is when an object is inside array (first level or deeper nested), mb_convert_encoding triggers a warning (and object is filtered out of result). I’ve created a PR to fix this: https://github.com/DamienHarper/auditor/pull/223.

DamienHarper commented 1 month ago

fixed in 3.1.0