Skip to content

Commit 7485682

Browse files
committed
Make LDAPCONF test work on windows
Rather than using putenv(), use the ENV section. This also required adding {PWD} support for it.
1 parent 1c08f8a commit 7485682

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
uri ldaps://example.com:3141/

ext/ldap/tests/ldap_connect_ldap_conf.phpt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@ phpinfo();
1010
if (!preg_match("/vendor name => openldap/i", ob_get_clean()))
1111
die("skip not openldap");
1212
?>
13+
--ENV--
14+
LDAPCONF={PWD}/ldap_connect_ldap_conf.conf
1315
--FILE--
1416
<?php
15-
$conf=tempnam("/tmp","ldap.conf");
16-
file_put_contents($conf, "uri ldaps://example.com:3141/");
17-
putenv("LDAPCONF=$conf");
1817
$link = ldap_connect();
1918
ldap_get_option($link, LDAP_OPT_HOST_NAME, $host);
2019
var_dump($host);
21-
unlink($conf);
2220
?>
2321
--EXPECT--
2422
string(16) "example.com:3141"

run-tests.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2047,7 +2047,8 @@ function run_test(string $php, $file, array $env): string
20472047
$env['TZ'] = '';
20482048

20492049
if ($test->sectionNotEmpty('ENV')) {
2050-
foreach (explode("\n", $test->getSection('ENV')) as $e) {
2050+
$env_str = str_replace('{PWD}', dirname($file), $test->getSection('ENV'));
2051+
foreach (explode("\n", $env_str) as $e) {
20512052
$e = explode('=', trim($e), 2);
20522053

20532054
if (!empty($e[0]) && isset($e[1])) {

0 commit comments

Comments
 (0)