1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Files
archived-php-src/sapi/cli/tests/bug80092.phpt
Arnaud Le Blanc 7b4c14dc10 Make OPcache non-optional
This removes the --enable-opcache/--disable-opcache configure switch. OPcache
is now always builtin. The default value of opcache.enable and
opcache.enable_cli is unchanged.

RFC: https://wiki.php.net/rfc/make_opcache_required

Closes GH-18961.

Co-authored-by: Tim Düsterhus <tim@tideways-gmbh.com>
2025-07-27 09:40:22 +02:00

47 lines
1022 B
PHP

--TEST--
Bug #80092 (ZTS + preload = segfault on shutdown)
--SKIPIF--
<?php
include 'skipif.inc';
if (substr(PHP_OS, 0, 3) == 'WIN') {
die ("skip not for Windows");
}
$extDir = ini_get('extension_dir');
if (!file_exists($extDir . '/opcache.so')) {
die ('skip opcache shared object not found in extension_dir');
}
?>
--FILE--
<?php
$cmd = [
PHP_BINARY,
'-dextension_dir=' . ini_get('extension_dir'),
'-dopcache.enable=1',
'-dopcache.enable_cli=1',
'-dopcache.preload=' . __DIR__ . '/preload.inc',
'-v'
];
$proc = proc_open($cmd, [['null'], ['pipe', 'w'], ['redirect', 1]], $pipes);
$output = stream_get_contents($pipes[1]);
// Ignore warnings if opcache loads twice or duplicate modules are loaded by searching for the preloaded marker
$flag = false;
foreach (explode("\n", $output) as $line) {
if ($line === "preloaded") {
$flag = true;
}
if ($flag) {
echo $line, "\n";
}
}
?>
--EXPECTF--
preloaded
PHP %s
Copyright (c) The PHP Group
%AZend Engine %s
%A with Zend OPcache %a