xref: /PHP-8.3/sapi/cli/tests/bug80092.phpt (revision c524dc65)
1--TEST--
2Bug #80092 (ZTS + preload = segfault on shutdown)
3--SKIPIF--
4<?php
5include 'skipif.inc';
6if (substr(PHP_OS, 0, 3) == 'WIN') {
7    die ("skip not for Windows");
8}
9$extDir = ini_get('extension_dir');
10if (!file_exists($extDir . '/opcache.so')) {
11    die ('skip opcache shared object not found in extension_dir');
12}
13?>
14--FILE--
15<?php
16
17$cmd = [
18    PHP_BINARY,
19    '-dextension_dir=' . ini_get('extension_dir'),
20    '-dzend_extension=opcache.so',
21    '-dopcache.enable=1',
22    '-dopcache.enable_cli=1',
23    '-dopcache.preload=' . __DIR__ . '/preload.inc',
24    '-v'
25];
26
27$proc = proc_open($cmd, [['null'], ['pipe', 'w'], ['redirect', 1]], $pipes);
28$output = stream_get_contents($pipes[1]);
29
30// Ignore warnings if opcache loads twice or duplicate modules are loaded by searching for the preloaded marker
31$flag = false;
32foreach (explode("\n", $output) as $line) {
33	if ($line === "preloaded") {
34		$flag = true;
35	}
36	if ($flag) {
37		echo $line, "\n";
38	}
39}
40
41?>
42--EXPECTF--
43preloaded
44PHP %s
45Copyright (c) The PHP Group
46Zend Engine %s
47%A    with Zend OPcache %a
48