Skip to content

Commit f2e095d

Browse files
committed
Fix Windows
1 parent cf0657f commit f2e095d

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

Zend/tests/gh10469.phpt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ zend_test
66
<?php
77
ini_set('open_basedir', __DIR__);
88

9+
$pathSeparator = PHP_OS_FAMILY !== 'Windows' ? ':' : ';';
910
$originalDir = __DIR__;
1011
$tmpDir = $originalDir . '/gh10469_tmp';
1112
@mkdir($tmpDir, 0777, true);
1213
chdir($tmpDir);
13-
ini_set('open_basedir', ini_get('open_basedir') . ':.' . DIRECTORY_SEPARATOR . '..');
14-
ini_set('open_basedir', ini_get('open_basedir') . ':.' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR);
15-
ini_set('open_basedir', ini_get('open_basedir') . ':' . DIRECTORY_SEPARATOR . 'a' . DIRECTORY_SEPARATOR);
16-
ini_set('open_basedir', ini_get('open_basedir') . ':.' . DIRECTORY_SEPARATOR . 'a');
14+
ini_set('open_basedir', ini_get('open_basedir') . $pathSeparator . '.' . DIRECTORY_SEPARATOR . '..');
15+
ini_set('open_basedir', ini_get('open_basedir') . $pathSeparator . '.' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR);
16+
ini_set('open_basedir', ini_get('open_basedir') . $pathSeparator . '.' . DIRECTORY_SEPARATOR . 'a' . DIRECTORY_SEPARATOR);
17+
ini_set('open_basedir', ini_get('open_basedir') . $pathSeparator . '.' . DIRECTORY_SEPARATOR . 'a');
1718

1819
chdir($originalDir);
1920
var_dump(ini_get('open_basedir'));
@@ -24,5 +25,5 @@ var_dump(get_open_basedir());
2425
@rmdir(__DIR__ . '/gh10469_tmp');
2526
?>
2627
--EXPECTF--
27-
string(%d) "%stests:.%e..:.%e..%e"
28-
string(%d) "%stests:%stests:%stests%e:%stests%egh10469_tmp%ea"
28+
string(%d) "%stests%c.%e..%c.%e..%e%c.%ea%e%c.%ea"
29+
string(%d) "%stests%c%stests%c%stests%e%c%stests%egh10469_tmp%ea"

main/fopen_wrappers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ PHPAPI ZEND_INI_MH(OnUpdateBaseDir)
9898
}
9999
char resolved_name[MAXPATHLEN + 1];
100100
if (expand_filepath(ptr, resolved_name) == NULL) {
101-
// efree(pathbuf);
101+
efree(pathbuf);
102102
smart_str_free(&buf);
103103
return FAILURE;
104104
}

0 commit comments

Comments
 (0)