ZF-10698: monitor_custom_event() signature wrong in ZendMonitor.php


I'm getting this warning when using ZendMonitor

Warning: monitor_custom_event() expects at most 3 parameters, 4 given in /usr/local/zend/share/ZendFramework/library/Zend/Log/Writer/ZendMonitor.php on line 106

taking a look at the ZendMonitor.php code, the call looks like this:

    protected function _write($event)
        $priority = $event['priority'];
        $message  = $event['message'];
        unset($event['priority'], $event['message']);

        if (!empty($event)) {
            monitor_custom_event($priority, $message, false, $event);
        } else {
            monitor_custom_event($priority, $message);

the actual signature of the method as documented in…

void zend_monitor_custom_event (string $class, string $text, mixed $user_data)


This issue was fixed yesterday in trunk and the 1.11 release branch.

Hi @matthew

I think that could be added in the clause else (line 127 Zend/Log/Writer/ZendMonitor.php) too a verification if is Zend Server to call the function zend_monitor_custom_event.

else {
    if ($this->_isZendServer) {
        zend_monitor_custom_event($priority, $message);
    } else {
        monitor_custom_event($priority, $message);

Greetings Ramon

We could, but it's not strictly necessary, as the first two arguments of each is the same, and monitor_custom_event() is aliased to zend_monitor_custom_event() in Zend Server.