Commit Graph

123 Commits

Author SHA1 Message Date
Christoph M. Becker
1aeff522b8 Revert "Fix #79806: realpath() erroneously resolves link to link"
This reverts commit d5b59b4303.
2020-07-27 17:50:41 +02:00
Christoph M. Becker
d5b59b4303 Fix #79806: realpath() erroneously resolves link to link
After resolving reparse points, the path still may be a reparse point;
in that case we have to resolve that reparse point as well.
2020-07-27 15:08:39 +02:00
Christoph M. Becker
29968d8f99 Fix #79470: PHP incompatible with 3rd party file system on demand
We add support for Activision HSM (`IO_REPARSE_TAG_ACTIVISION_HSM`) and
VFS for Git (`IO_REPARSE_TAG_PROJFS`).  The latter fixes bug #78784.
2020-04-27 09:30:57 +02:00
Christoph M. Becker
5e19f1d458 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78220: Can't access OneDrive folder
2019-08-19 19:57:22 +02:00
Christoph M. Becker
81f52158b4 Fix #78220: Can't access OneDrive folder
As of Windows 1903, when the OneDrive on-demand feature is enabled, the
OneDrive folder is reported as reparse point by `FindFirstFile()`, but
trying to get information about the reparse point using
`DeviceIoControl()` fails with `ERROR_NOT_A_REPARSE_POINT`.  We work
around this problem by falling back to `GetFileInformationByHandle()`
if that happens, but only if the reparse point is reported as cloud
reparse point, and only if PHP is running on Windows 1903 or later.

The patch has been developed in collaboration with ab@php.net.

We should keep an eye on the somewhat quirky OneDrive behavior, since
it might change again in a future Windows release.
2019-08-19 19:55:35 +02:00
Anatol Belski
8b20e7b68b Fixed bug #77484 Zend engine crashes when calling realpath in invalid working dir 2019-01-19 02:36:51 +01:00
Anatol Belski
199914b42d Fixed bug #77317 __DIR__, __FILE__, realpath() reveal physical path for subst virtual drive
Keep compatibility with 7.2 and below which better comply with
realpath(3). This might have been fixable another way, say by checking
of QueryDosDevice or alike, sadly that comes with a huge performance
impact. The new internal realpath API is kept available so is
usable when bind or network mount or other OS specific realpath
variants are needed. If not used by default, a userspace function for
this specific case might be considered to be offered in next minor.
2018-12-26 12:59:00 +01:00
Zeev Suraski
9afce019e0 Future-proof email addresses 2018-11-01 18:35:32 +02:00
Peter Kokot
8d3f8ca12a Remove unused Git attributes ident
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.

In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.

This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-07-25 00:53:25 +02:00
Anatol Belski
18750a2238 Eliminate cast 2018-03-19 11:44:27 +01:00
Anatol Belski
397d40cdd7 Mark non exported symbol as static 2018-03-17 21:17:47 +01:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Xinchen Hui
7a7ec01a49 year++ 2018-01-02 12:55:14 +08:00
Anatol Belski
32db45ca54 Drop unused code 2017-12-15 14:58:43 +01:00
Anatol Belski
f3f6cd24e9 Modernize realpath and integrate quick variant into virtual_file_ex
The slower I/O as a traditional bottleneck on Windows which is
the target of this patch. The recursive path resolution, while being
an allround solution, is expensive when it comes to the common case.
Files with proper ACLs set can be resolved in one go by usage of specific
API. Those are available since Vista, so actually can be called old. Those
simpler api is used for the cases where no CWD_EXPAND is requested. For
the cases where ACLs are improper, the existing solution based on
FindFirstFile still does good job also partially providing quirks. Cases
involing reparse tags and other non local filesystems are also partially
server by new APIs.

The approach uses both APIs - the quick one for the common case still
integrating realpath cache, and the existing one as a fallback. The tests
show the I/O load drop on the realpath resolution part due to less
system calls for the sub part resolution of paths. In most case it is
justified, as the sub parts were otherwise cached or unused as well. The
realpath() implementation in ioutil is also closer to the POSIX.
2017-12-15 13:23:34 +01:00
Anatol Belski
17d621e7d3 Allow delete-sharing mode for CreateFile by default
This effectively allows a UNIX like semantics for deleting files
with an open handle. Some OS related limitations still persist,
but the Windows 95 times can be considered as definitely over.
2017-12-08 18:14:20 +01:00
Anatol Belski
80d6eb6806 Fix unsigned comparisons and remove dead code
Fix unsigned comparison

Cleanup never executed block

Fix unsigned comparison

Fix unsigned comparison, diff can't be < 0

Fix unsigned comparison

Fix unsigned comparison

Remove dead code
2017-11-17 22:38:44 +01:00
Anatol Belski
61259d692e Merge branch 'PHP-7.2'
* PHP-7.2:
  Fixed #75384 PHP seems incompatible with OneDrive files on demand
  bump versions
  Fixed ext/date tests due to changes in Olson database
2017-11-08 12:01:39 +01:00
Anatol Belski
01c70cc98b Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed #75384 PHP seems incompatible with OneDrive files on demand
  bump versions
  Fixed ext/date tests due to changes in Olson database
2017-11-08 12:00:30 +01:00
Anatol Belski
d36e793c93 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed #75384 PHP seems incompatible with OneDrive files on demand
  Fixed ext/date tests due to changes in Olson database
2017-11-08 11:54:18 +01:00
Anatol Belski
c6720e2f45 Fixed #75384 PHP seems incompatible with OneDrive files on demand 2017-11-08 11:52:42 +01:00
Anatol Belski
be62d5fc19 Merge branch 'PHP-7.2'
* PHP-7.2:
  Fix datatype
2017-10-11 09:00:32 +02:00
Anatol Belski
53169dc480 Fix datatype 2017-10-11 08:58:59 +02:00
Anatol Belski
beb9295790 Merge branch 'PHP-7.2'
* PHP-7.2:
  Fixed bug #75063
2017-08-14 00:53:33 +02:00
Anatol Belski
0a2a136111 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #75063
2017-08-14 00:51:47 +02:00
Anatol Belski
3069ad8dd1 Fixed bug #75063 2017-08-14 00:44:19 +02:00
Anatol Belski
827284ec36 fix up porting mistakes 2017-07-27 23:38:04 +02:00
Anatol Belski
49d9b3013f Move cwd_state and path related routines to size_t
Having `int` there is no real profit in the size or speed, while unsigned
improves security and overall integration. ZPP supplied strings can
be then accepted directly and structs can be still handled with smaller
unsigned types for size reasons, which is safe. Yet some related places
are to go.

basic move tsrm_realpath_r to size_t

fix conditions and sync with affected places

touch ocurrences of php_sys_readlink usage

follow up on phar path handling

remove duplicated check

move zend_resolve_path and related pieces to size_t

touch yet resolve path related places

remove cast

missing pieces

missing piece

yet cleanups for php_sys_readlink for ssize_t

fix wrong return
2017-07-27 20:11:21 +02:00
Anatol Belski
6a010ad492 Avoid unnecessary string copy
which is the case when there's no impersonation.
2017-04-27 16:03:12 +02:00
Anatol Belski
24ae881080 get rid of two strlen calls 2017-04-27 15:41:09 +02:00
Anatol Belski
ad4ef13c5d Switch to FindFirstFileEx with basic info level
That omits querying of short names, thus improving perf.
2017-04-07 21:15:37 +02:00
Anatol Belski
936e341b5e missing bits for php_sys_stat_ex so everything is handled with wide chars
rename to pathw_len
2017-04-03 17:39:15 +02:00
Anatol Belski
f02b4d575f Merge branch 'PHP-7.1'
* PHP-7.1:
  fix possible out of bounds buffer access
2017-04-03 15:22:59 +02:00
Anatol Belski
3438e62b30 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  fix possible out of bounds buffer access
2017-04-03 15:22:04 +02:00
Anatol Belski
feeb35e438 fix possible out of bounds buffer access 2017-04-03 15:20:32 +02:00
Nikita Popov
edcabf6d07 Drop unnecessary allocator return value checks 2017-03-13 22:07:15 +01:00
Anatol Belski
5b5130c4ff Revert "backport 51e1da6ea1 into 7.0"
This reverts commit 8da8756312.
2017-01-31 14:21:20 +01:00
Anatol Belski
352456031e Merge branch 'PHP-7.1'
* PHP-7.1:
  make length check more robust
2017-01-24 13:25:57 +01:00
Anatol Belski
403f352482 make length check more robust 2017-01-24 13:24:11 +01:00
Anatol Belski
8da8756312 backport 51e1da6ea1 into 7.0 2017-01-21 02:56:15 +01:00
Anatol Belski
d263f29b71 Merge branch 'PHP-7.1'
* PHP-7.1:
  exclude debug code
  ensure the string for conversion is \0 terminated and integrade additional path length check
2017-01-21 02:20:52 +01:00
Anatol Belski
51e1da6ea1 exclude debug code 2017-01-21 02:17:06 +01:00
Anatol Belski
6b6122a957 ensure the string for conversion is \0 terminated and integrade
additional path length check
2017-01-21 02:11:24 +01:00
Anatol Belski
73bfa264cc Merge branch 'PHP-7.1'
* PHP-7.1:
  Fixed bug #73962 bug with symlink related to cyrillic directory
2017-01-20 23:47:12 +01:00
Anatol Belski
95406c878a Fixed bug #73962 bug with symlink related to cyrillic directory 2017-01-20 23:45:08 +01:00
Anatol Belski
25797535d4 Merge branch 'PHP-7.1'
* PHP-7.1:
  fix edge case leak
2017-01-07 01:17:18 +01:00
Anatol Belski
b716a1fbef fix edge case leak 2017-01-07 01:15:49 +01:00
Anatol Belski
628c5a31da Merge branch 'PHP-7.1'
* PHP-7.1:
  Fixed bug #73877 readlink() returns garbage for UTF-8 paths
2017-01-07 01:10:56 +01:00
Anatol Belski
0f410f8087 Fixed bug #73877 readlink() returns garbage for UTF-8 paths 2017-01-07 01:09:17 +01:00
Sammy Kaye Powers
dac6c639bb Update copyright headers to 2017 2017-01-04 11:23:42 -06:00