mirror of
https://github.com/php/php-src.git
synced 2024-11-30 21:35:36 +08:00
Merge branch 'PHP-7.4'
* PHP-7.4: Fix #78296: is_file fails to detect file
This commit is contained in:
commit
b07c76059d
16
ext/standard/tests/file/bug78296.phpt
Normal file
16
ext/standard/tests/file/bug78296.phpt
Normal file
@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #78296 (is_file fails to detect file)
|
||||
--FILE--
|
||||
<?php
|
||||
$dir = str_pad(__DIR__ . '/bug78296', 250, '_');
|
||||
var_dump(mkdir($dir));
|
||||
var_dump(is_dir($dir));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
--CLEAN--
|
||||
<?php
|
||||
$dir = str_pad(__DIR__ . '/bug78296', 250, '_');
|
||||
rmdir($dir);
|
||||
?>
|
@ -320,13 +320,23 @@ PW32IO int php_win32_ioutil_mkdir_w(const wchar_t *path, mode_t mode)
|
||||
|
||||
if (!PHP_WIN32_IOUTIL_IS_LONG_PATHW(tmp, path_len)) {
|
||||
wchar_t *_tmp = (wchar_t *) malloc((path_len + PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW + 1) * sizeof(wchar_t));
|
||||
wchar_t *src, *dst;
|
||||
if (!_tmp) {
|
||||
SET_ERRNO_FROM_WIN32_CODE(ERROR_NOT_ENOUGH_MEMORY);
|
||||
free(tmp);
|
||||
return -1;
|
||||
}
|
||||
memmove(_tmp, PHP_WIN32_IOUTIL_LONG_PATH_PREFIXW, PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW * sizeof(wchar_t));
|
||||
memmove(_tmp+PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW, tmp, path_len * sizeof(wchar_t));
|
||||
src = tmp;
|
||||
dst = _tmp + PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW;
|
||||
while (src < tmp + path_len) {
|
||||
if (*src == PHP_WIN32_IOUTIL_FW_SLASHW) {
|
||||
*dst++ = PHP_WIN32_IOUTIL_DEFAULT_SLASHW;
|
||||
src++;
|
||||
} else {
|
||||
*dst++ = *src++;
|
||||
}
|
||||
}
|
||||
path_len += PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW;
|
||||
_tmp[path_len] = L'\0';
|
||||
free(tmp);
|
||||
|
@ -218,8 +218,16 @@ __forceinline static wchar_t *php_win32_ioutil_conv_any_to_w(const char* in, siz
|
||||
memmove(ret, mb, mb_len * sizeof(wchar_t));
|
||||
ret[mb_len] = L'\0';
|
||||
} else {
|
||||
wchar_t *src = mb, *dst = ret + PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW;
|
||||
memmove(ret, PHP_WIN32_IOUTIL_LONG_PATH_PREFIXW, PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW * sizeof(wchar_t));
|
||||
memmove(ret+PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW, mb, mb_len * sizeof(wchar_t));
|
||||
while (src < mb + mb_len) {
|
||||
if (*src == PHP_WIN32_IOUTIL_FW_SLASHW) {
|
||||
*dst++ = PHP_WIN32_IOUTIL_DEFAULT_SLASHW;
|
||||
src++;
|
||||
} else {
|
||||
*dst++ = *src++;
|
||||
}
|
||||
}
|
||||
ret[mb_len + PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW] = L'\0';
|
||||
|
||||
mb_len += PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW;
|
||||
|
Loading…
Reference in New Issue
Block a user