Skip to content

Commit 84c160d

Browse files
committed
Increase test portability
The test as is can only work if com_dotnet is built dynamically, and not already loaded via the php.ini file. While this is given on AppVeyor, it may not be given in other environments. Closes GH-8879.
1 parent f0cae1a commit 84c160d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

ext/com_dotnet/tests/bug77578.phpt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ com_dotnet
77
// To actually be able to verify the crash during shutdown on Windows, we have
88
// to execute a PHP subprocess, and check its exit status.
99
$php = PHP_BINARY;
10-
$ini = php_ini_loaded_file();
11-
$iniopt = $ini ? "-c $ini" : '';
12-
$command = "$php $iniopt -d extension=com_dotnet -d com.autoregister_typelib=1 -r \"new COM('WbemScripting.SWbemLocator');\"";
10+
$extension_dir = ini_get("extension_dir");
11+
$script = <<<SCRIPT
12+
if (!extension_loaded('com_dotnet')) dl('com_dotnet');
13+
ini_set('com.autoregister_typelib', '1');
14+
new COM('WbemScripting.SWbemLocator');
15+
SCRIPT;
16+
$command = "$php -d extension_dir=$extension_dir -r \"$script\"";
1317
exec($command, $output, $status);
1418
var_dump($output, $status);
1519
?>

0 commit comments

Comments
 (0)