After upgrading to Phalcon 2.0.8 from 1.3 I started getting seemingly random BadMethodCallExceptions exceptions from across my code:
Fatal error: Uncaught exception 'BadMethodCallException' with message 'Wrong number of parameters'
For example, I get this:
Fatal error: Uncaught exception 'BadMethodCallException' with message 'Wrong number of parameters' in /srv/www/laffo/drywall/vendor/phalcon/incubator/Library/Phalcon/Logger/Adapter/Firelogger.php on line 205 BadMethodCallException: Wrong number of parameters in /srv/www/laffo/drywall/vendor/phalcon/incubator/Library/Phalcon/Logger/Adapter/Firelogger.php on line 205 Call Stack: 0.0833 2681632 1. Phalcon\Logger\Adapter\Firelogger->commit() /srv/www/laffo/drywall/vendor/phalcon/incubator/Library/Phalcon/Logger/Adapter/Firelogger.php:0 0.0833 2681632 2. Phalcon\Logger\Adapter\Firelogger->flush() /srv/www/laffo/drywall/vendor/phalcon/incubator/Library/Phalcon/Logger/Adapter/Firelogger.php:191 0.0833 2682088 3. trigger_error() /srv/www/laffo/drywall/vendor/phalcon/incubator/Library/Phalcon/Logger/Adapter/Firelogger.php:205
Firelogger is from the incubator library, version ~2.0. On line #205 there is this code:
trigger_error(
"Cannot send FireLogger headers after output has been sent" . ($file ? " (output started at $file:$line)." : "."), \E_USER_WARNING );
There is nothing wrong with this code, and I don't think it's a problem with incubator. I am getting the same BadMethodCallException at other places too, for example when calling \Phalcon\Mvc\Model::create() method with no arguments (e.g. $myModel->create();). Whether I get the exception depends on WHEN I call whatever code that has triggered the exception. For example, if I put
trigger_error('someting', \E_USER_WARNING);
into index.php, it works fine, no exception. I suspect this is a bug in Phalcon 2.0.x but before filing it at github I wanted to check if anybody else has encoutered this weirdness. Any ideas anyone please?