Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typehint fail in Logger creation in AbstractBinary #4

Open
ckrack opened this issue Apr 3, 2015 · 0 comments
Open

Typehint fail in Logger creation in AbstractBinary #4

ckrack opened this issue Apr 3, 2015 · 0 comments
Labels

Comments

@ckrack
Copy link

ckrack commented Apr 3, 2015

I am using Alchemy/Binarydriver through PHP-FFMPeg.

When no logger is set through the configuration, the typehint in Alchemy\BinaryDriver\AbstractBinary::__construct() fails.

Catchable fatal error: Argument 2 passed to Alchemy\BinaryDriver\AbstractBinary::__construct() must be an instance of Psr\Log\LoggerInterface, instance of Monolog\Logger given, called in /vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/AbstractBinary.php on line 171 and defined in /vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/AbstractBinary.php on line 39

in AbstractBinary::load, $logger is null.
This leads to: this line being called:
$logger = new Logger(__NAMESPACE__ . ' logger');

__NAMESPACE__ is:
string 'Alchemy\BinaryDriver' (length=20)

Logger is referenced as:
use Monolog\Logger;
in Line 19.

This leads to $logger being the following at the end of the call to AbstractBinary::load:

object(Monolog\Logger)[21]
  protected 'name' => string 'Alchemy\BinaryDriver logger' (length=27)
  protected 'handlers' => 
    array (size=1)
      0 => 
        object(Monolog\Handler\NullHandler)[23]
          protected 'level' => int 100
          protected 'bubble' => boolean false
          protected 'formatter' => null
          protected 'processors' => 
            array (size=0)
              empty
  protected 'processors' => 
    array (size=0)
      empty

Monolog/Logger Version is: "dev-master": "1.13.x-dev"
This is installed through composer requirements following from php-ffmpeg.

Monolog\Logger correctly implements Loggerinterface though.
class Logger implements LoggerInterface

Is this a PHP bug?
My PHP Version is 5.6.2 on OSX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants