1<?php
2
3function skipFunction($function): bool {
4    if (false
5        /* expect input / hang */
6     || $function === 'readline'
7     || $function === 'readline_read_history'
8     || $function === 'readline_write_history'
9        /* intentionally violate invariants */
10     || $function === 'zend_create_unterminated_string'
11     || $function === 'zend_test_array_return'
12     || $function === 'zend_test_crash'
13     || $function === 'zend_leak_bytes'
14        /* mess with output */
15     || (is_string($function) && str_starts_with($function, 'ob_'))
16     || $function === 'output_add_rewrite_var'
17     || $function === 'error_log'
18        /* may spend a lot of time waiting for connection timeouts */
19     || (is_string($function) && str_contains($function, 'connect'))
20     || (is_string($function) && str_starts_with($function, 'snmp'))
21     || (is_array($function) && get_class($function[0]) === mysqli::class
22         && in_array($function[1], ['__construct', 'connect', 'real_connect']))
23        /* misc */
24     || $function === 'mail'
25     || $function === 'mb_send_mail'
26     || $function === 'pcntl_fork'
27     || $function === 'pcntl_rfork'
28     || $function === 'posix_kill'
29     || $function === 'posix_setrlimit'
30     || $function === 'sapi_windows_generate_ctrl_event'
31     || $function === 'imagegrabscreen'
32     // PHP-8.1 only
33     || $function === 'dcgettext'
34     || $function === 'dcngettext'
35    ) {
36        return true;
37    }
38    if ($function[0] instanceof SoapServer) {
39        /* TODO: Uses fatal errors */
40        return true;
41    }
42
43    return false;
44}
45