Skip to content

Commit 883b446

Browse files
committed
Show registered error notification callbacks in phpinfo() output.
1 parent f2c0f05 commit 883b446

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

Zend/zend.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,7 @@ int zend_startup(zend_utility_functions *utility_functions) /* {{{ */
816816

817817
zend_startup_strtod();
818818
zend_startup_extensions_mechanism();
819+
zend_startup_error_notify_callbacks();
819820

820821
/* Set up utility functions and values */
821822
zend_error_cb = utility_functions->error_function;
@@ -1078,6 +1079,7 @@ void zend_shutdown(void) /* {{{ */
10781079
zend_hash_destroy(GLOBAL_AUTO_GLOBALS_TABLE);
10791080
free(GLOBAL_AUTO_GLOBALS_TABLE);
10801081

1082+
zend_shutdown_error_notify_callbacks();
10811083
zend_shutdown_extensions();
10821084
free(zend_version_info);
10831085

@@ -1784,6 +1786,7 @@ int zend_shutdown_error_notify_callbacks()
17841786
void zend_register_error_notify_callback(const char *name, zend_error_notify_cb cb)
17851787
{
17861788
zend_error_notify_callback callback;
1789+
17871790
callback.name = name;
17881791
callback.notify_callback = cb;
17891792

ext/standard/info.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,28 @@ static zend_always_inline int php_info_print(const char *str) /* {{{ */
8686
}
8787
/* }}} */
8888

89+
static ZEND_COLD void php_info_print_error_notify_callback(zend_error_notify_callback *callback) /* {{{ */
90+
{
91+
php_info_printf("%s ", callback->name);
92+
}
93+
/* }}} */
94+
95+
static ZEND_COLD void php_info_print_error_notify_callbacks() /* {{{ */
96+
{
97+
if (!sapi_module.phpinfo_as_text) {
98+
php_info_printf("<tr><td class=\"e\">Registered Error Notification Callbacks</td><td class=\"v\">");
99+
} else {
100+
php_info_printf("\nRegistered Error Notification Callbacks => ");
101+
}
102+
103+
zend_llist_apply(&zend_error_notify_callbacks, (llist_apply_func_t) php_info_print_error_notify_callback);
104+
105+
if (!sapi_module.phpinfo_as_text) {
106+
php_info_print("</td></tr>\n");
107+
}
108+
}
109+
/* }}} */
110+
89111
static ZEND_COLD void php_info_print_stream_hash(const char *name, HashTable *ht) /* {{{ */
90112
{
91113
zend_string *key;
@@ -884,6 +906,8 @@ PHPAPI ZEND_COLD void php_print_info(int flag)
884906
php_info_print_stream_hash("Stream Socket Transports", php_stream_xport_get_hash());
885907
php_info_print_stream_hash("Stream Filters", php_get_stream_filters_hash());
886908

909+
php_info_print_error_notify_callbacks();
910+
887911
php_info_print_table_end();
888912

889913
/* Zend Engine */

0 commit comments

Comments
 (0)