inpsyde / Wonolog

Monolog-based logging package for WordPress.
https://inpsyde.github.io/Wonolog/
MIT License
173 stars 17 forks source link

Logging a WP_Error with no data triggers a fatal error #36

Closed johnbillion closed 6 years ago

johnbillion commented 6 years ago

Version Information

Steps to Reproduce

Attempt to log a WP_Error object that doesn't contain a $data property, for example by using the following PHP code:

do_action( 'wonolog.log.error', new \WP_Error( 'hello', 'world' ) );

What I Expected

The WP_Error object gets logged.

What Happened Instead

A fatal error is triggered by Wonolog:

Uncaught TypeError: Argument 4 passed to Inpsyde\Wonolog\Data\Log::__construct() must be of the type array, null given, called in src/Data/Log.php on line 74
gmazzap commented 6 years ago

Thanks for reporting. The fix is merged on master, will be released on next release.

gmazzap commented 6 years ago

Fix merged in v1.0.2