[GH-ISSUE #1323] ZendMonitor TypeError #548

Closed
opened 2026-03-04 02:15:53 +03:00 by kerem · 2 comments
Owner

Originally created by @happydude on GitHub (Apr 26, 2019).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1323

Getting a TypeError in 2.0.0-beta1,

./vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php:68
zend_monitor_custom_event() expects parameter 1 to be string, integer given

Documentation at http://files.zend.com/help/Zend-Server/content/zendserverapi/zend_monitor-php_api.htm#function-zend_monitor_custom_event

Based on the zend server documentation
github.com/Seldaek/monolog@ebb804e432/src/Monolog/Handler/ZendMonitorHandler.php (L68)
should be something like

zend_monitor_custom_event('',$message, $formatted, $level);

In addition the levelMap is not compatible with zend server monitor, they only support three log levels:

var_export(
[
	'ZEND_MONITOR_EVENT_SEVERITY_INFO' => \ZEND_MONITOR_EVENT_SEVERITY_INFO,
	'ZEND_MONITOR_EVENT_SEVERITY_WARNING' => \ZEND_MONITOR_EVENT_SEVERITY_WARNING,
	'ZEND_MONITOR_EVENT_SEVERITY_ERROR' => \ZEND_MONITOR_EVENT_SEVERITY_ERROR
]);

outputs

array (
  'ZEND_MONITOR_EVENT_SEVERITY_INFO' => -1,
  'ZEND_MONITOR_EVENT_SEVERITY_WARNING' => 0,
  'ZEND_MONITOR_EVENT_SEVERITY_ERROR' => 1,
)
Originally created by @happydude on GitHub (Apr 26, 2019). Original GitHub issue: https://github.com/Seldaek/monolog/issues/1323 Getting a TypeError in 2.0.0-beta1, ./vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php:68 zend_monitor_custom_event() expects parameter 1 to be string, integer given Documentation at http://files.zend.com/help/Zend-Server/content/zendserverapi/zend_monitor-php_api.htm#function-zend_monitor_custom_event Based on the zend server documentation https://github.com/Seldaek/monolog/blob/ebb804e432e8fe0fe96828f30d89c45581d36d07/src/Monolog/Handler/ZendMonitorHandler.php#L68 should be something like ``` zend_monitor_custom_event('',$message, $formatted, $level); ``` In addition the levelMap is not compatible with zend server monitor, they only support three log levels: ``` var_export( [ 'ZEND_MONITOR_EVENT_SEVERITY_INFO' => \ZEND_MONITOR_EVENT_SEVERITY_INFO, 'ZEND_MONITOR_EVENT_SEVERITY_WARNING' => \ZEND_MONITOR_EVENT_SEVERITY_WARNING, 'ZEND_MONITOR_EVENT_SEVERITY_ERROR' => \ZEND_MONITOR_EVENT_SEVERITY_ERROR ]); ``` outputs ``` array ( 'ZEND_MONITOR_EVENT_SEVERITY_INFO' => -1, 'ZEND_MONITOR_EVENT_SEVERITY_WARNING' => 0, 'ZEND_MONITOR_EVENT_SEVERITY_ERROR' => 1, ) ```
kerem 2026-03-04 02:15:53 +03:00
  • closed this issue
  • added the
    Bug
    label
Author
Owner

@Seldaek commented on GitHub (Jul 3, 2019):

If you have time to send a PR, the handler would ideally adjust its behavior based on the version of ZendServer present, I am not familiar enough with it to say how to detect that.. Please target the 1.x branch for a fix.

<!-- gh-comment-id:508093959 --> @Seldaek commented on GitHub (Jul 3, 2019): If you have time to send a PR, the handler would ideally adjust its behavior based on the version of ZendServer present, I am not familiar enough with it to say how to detect that.. Please target the 1.x branch for a fix.
Author
Owner

@happydude commented on GitHub (Jul 12, 2019):

I did not find a way to detect zend server version, but the newer style should be compatible with zend server 6 (php 5.3) and newer.

I did not commit it, but the tests passed with declare(strict_types=1).

<!-- gh-comment-id:510999535 --> @happydude commented on GitHub (Jul 12, 2019): I did not find a way to detect zend server version, but the newer style should be compatible with zend server 6 (php 5.3) and newer. I did not commit it, but the tests passed with declare(strict_types=1).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/monolog#548
No description provided.