ZF2-453: Logger xml formatter not accepting arrays (from extra params)
Description
taken from rtfd: $writer = new Zend\Log\Writer\Stream('php://output'); $formatter = new Zend\Log\Formatter\Xml(); $writer->setFormatter($formatter);
$logger = new Zend_Log(); $logger->addWriter($writer); $logger->info('informational message');
This causes an array to string conversion notice error in the xml file line 157: $elt->appendChild(new DOMElement($key, (string)$value));
The extra params are passed as an array. I think this code comes directly from the config xml writer, as that suffers from exactly the same problem.
Comments
Posted by Koen Pieters (koen) on 2012-08-07T14:22:59.000+0000
Send pull request: https://github.com/zendframework/zf2/pull/2120
Posted by Koen Pieters (koen) on 2012-08-09T09:55:59.000+0000
Hi Thomas,
I've made the pull request cause if I used your code example.
I didn't get the notice, but got this as a result:
When I tested with:
The output was the following:
I had a look at the code, and the extra options are, as far as I could see, implemented for the errorHandler and the ExceptionHandler, but not for XML.
Cause the empty didn't seem right, I did a pull request for not showing this in the xml output.
Did you test it on the latest ZF2 from git? Do you still get the notice?
PS. I've also did a pull request to update the documentation for the right example ( $logger = new Zend\Log\Logger(); ) on http://packages.zendframework.com/docs/latest/…
Posted by Benoît Durand (intiilapa) on 2012-08-24T19:38:51.000+0000
The PR is merged on master. Can we close this issue?
Posted by Maks 3w (maks3w) on 2012-08-24T23:58:30.000+0000
patch merged
Posted by Koen Pieters (koen) on 2012-08-28T14:56:03.000+0000
issue closed.
Thanks Ralph for your unit test.