Skip to content

Commit 6d4f94e

Browse files
committed
fix: trying fix to conflicted test failure
1 parent 6e2247d commit 6d4f94e

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

ext/opcache/tests/php_cli_server.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?php
22
define ("PHP_CLI_SERVER_HOSTNAME", "localhost");
33

4-
function php_cli_server_start($ini = "") {
4+
function php_cli_server_start($ini = "", $doc_root = null) {
55
$php_executable = getenv('TEST_PHP_EXECUTABLE');
66
if ($php_executable) {
77
$php_executable = realpath(__DIR__ . '/../../../' . $php_executable) ?: realpath($php_executable) ?: $php_executable;
88
} else {
99
$php_executable = PHP_BINARY;
1010
}
11-
$doc_root = __DIR__;
11+
$doc_root ??= __DIR__;
1212

1313
$ini_array = preg_split('/\s+/', trim($ini));
1414
$ini_array = array_map(function($arg) {

ext/opcache/tests/static_cache_volatile_static_internal_object_method_mutation_001.phpt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ OPcache VolatileStatic tracks internal object method mutations
44
opcache
55
spl
66
--CONFLICTS--
7-
server
7+
all
88
--FILE--
99
<?php
1010

11-
file_put_contents(__DIR__ . '/volatile_static_internal_object_method_mutation_001.php', <<<'PHP'
11+
$docRoot = sys_get_temp_dir() . '/opcache_static_cache_' . getmypid() . '_' . str_replace('.', '_', uniqid('', true));
12+
$script = 'volatile_static_internal_object_method_mutation_001.php';
13+
mkdir($docRoot);
14+
15+
file_put_contents($docRoot . '/' . $script, <<<'PHP'
1216
<?php
1317
1418
class VolatileStaticDateMethodState
@@ -93,9 +97,14 @@ if ($php) {
9397
}
9498

9599
include 'php_cli_server.inc';
96-
php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.static_cache.volatile_size_mb=32 -d opcache.file_update_protection=0 -d opcache.jit=0');
100+
php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.static_cache.volatile_size_mb=32 -d opcache.file_update_protection=0 -d opcache.jit=0', $docRoot);
101+
102+
register_shutdown_function(static function () use ($docRoot, $script) {
103+
@unlink($docRoot . '/' . $script);
104+
@rmdir($docRoot);
105+
});
97106

98-
$base = 'http://' . PHP_CLI_SERVER_ADDRESS . '/volatile_static_internal_object_method_mutation_001.php';
107+
$base = 'http://' . PHP_CLI_SERVER_ADDRESS . '/' . $script;
99108
foreach (['date', 'array', 'fixed'] as $state) {
100109
echo file_get_contents($base . '?action=reset');
101110
echo file_get_contents($base . '?state=' . $state . '&action=read');

0 commit comments

Comments
 (0)