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        /* terminates script */
10     || $function === 'exit'
11     || $function === 'die'
12        /* intentionally violate invariants */
13     || $function === 'zend_create_unterminated_string'
14     || $function === 'zend_test_array_return'
15     || $function === 'zend_test_crash'
16     || $function === 'zend_leak_bytes'
17        /* mess with output */
18     || (is_string($function) && str_starts_with($function, 'ob_'))
19     || $function === 'output_add_rewrite_var'
20     || $function === 'error_log'
21        /* may spend a lot of time waiting for connection timeouts */
22     || (is_string($function) && str_contains($function, 'connect'))
23     || (is_string($function) && str_starts_with($function, 'snmp'))
24     || (is_array($function) && get_class($function[0]) === mysqli::class
25         && in_array($function[1], ['__construct', 'connect', 'real_connect']))
26        /* misc */
27     || $function === 'mail'
28     || $function === 'mb_send_mail'
29     || $function === 'pcntl_fork'
30     || $function === 'pcntl_rfork'
31     || $function === 'posix_kill'
32     || $function === 'posix_setrlimit'
33     || $function === 'sapi_windows_generate_ctrl_event'
34     || $function === 'imagegrabscreen'
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