Skip to content

Commit 97ed208

Browse files
committed
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: Fix issues with phpt and EXTENSION on windows (BUG 75042)
2 parents 5ef63b6 + 71b1294 commit 97ed208

File tree

4 files changed

+48
-4
lines changed

4 files changed

+48
-4
lines changed

run-tests.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,15 +1504,19 @@ function run_test($php, $file, $env)
15041504

15051505
// Additional required extensions
15061506
if (array_key_exists('EXTENSIONS', $section_text)) {
1507-
$ext_dir=`$php -r 'echo ini_get("extension_dir");'`;
1507+
$ext_params = array();
1508+
settings2array($ini_overwrites, $ext_params);
1509+
settings2params($ext_params);
1510+
$ext_dir=`$php $pass_options $ext_params -d display_errors=0 -r "echo ini_get('extension_dir');"`;
15081511
$extensions = preg_split("/[\n\r]+/", trim($section_text['EXTENSIONS']));
1509-
$loaded = explode(",", `$php -n -r 'echo join(",", get_loaded_extensions());'`);
1512+
$loaded = explode(",", `$php $pass_options $ext_params -d display_errors=0 -r "echo implode(',', get_loaded_extensions());"`);
1513+
$ext_prefix = substr(PHP_OS, 0, 3) === "WIN" ? "php_" : "";
15101514
foreach ($extensions as $req_ext) {
15111515
if (!in_array($req_ext, $loaded)) {
15121516
if ($req_ext == 'opcache') {
1513-
$ini_settings['zend_extension'][] = $ext_dir . DIRECTORY_SEPARATOR . $req_ext . '.' . PHP_SHLIB_SUFFIX;
1517+
$ini_settings['zend_extension'][] = $ext_dir . DIRECTORY_SEPARATOR . $ext_prefix . $req_ext . '.' . PHP_SHLIB_SUFFIX;
15141518
} else {
1515-
$ini_settings['extension'][] = $ext_dir . DIRECTORY_SEPARATOR . $req_ext . '.' . PHP_SHLIB_SUFFIX;
1519+
$ini_settings['extension'][] = $ext_dir . DIRECTORY_SEPARATOR . $ext_prefix . $req_ext . '.' . PHP_SHLIB_SUFFIX;
15161520
}
15171521
}
15181522
}

tests/run-test/bug75042-2.phpt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
phpt EXTENSIONS directive with static module
3+
--SKIPIF--
4+
<?php
5+
$php = getenv('TEST_PHP_EXECUTABLE');
6+
if (false === stripos(`$php -n -m`, 'spl')) {
7+
die('skip spl is NOT built static');
8+
}
9+
--EXTENSIONS--
10+
SPL
11+
--FILE--
12+
<?php
13+
var_dump(extension_loaded('spl'));
14+
--EXPECT--
15+
bool(true)

tests/run-test/bug75042-3.phpt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
--TEST--
2+
phpt EXTENSIONS directive with nonexistent shared module
3+
--EXTENSIONS--
4+
nonexistentsharedmodule
5+
--FILE--
6+
<?php
7+
--EXPECTF--
8+
PHP Warning: PHP Startup: Unable to load dynamic library '%snonexistentsharedmodule.%s' %A

tests/run-test/bug75042.phpt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
phpt EXTENSIONS directive with shared module
3+
--SKIPIF--
4+
<?php
5+
$php = getenv('TEST_PHP_EXECUTABLE');
6+
if (false !== stripos(`$php -n -m`, 'openssl')) {
7+
die('skip openssl is built static');
8+
}
9+
$ext_module = ini_get('extension_dir') . DIRECTORY_SEPARATOR . (substr(PHP_OS, 0, 3) === "WIN" ? "php_openssl." : "openssl.") . PHP_SHLIB_SUFFIX;
10+
if( !file_exists($ext_module) ) die('skip openssl shared extension not found');
11+
--EXTENSIONS--
12+
openssl
13+
--FILE--
14+
<?php
15+
var_dump(extension_loaded('openssl'));
16+
--EXPECT--
17+
bool(true)

0 commit comments

Comments
 (0)