Commit Graph

62 Commits

Author SHA1 Message Date
Christoph M. Becker
27bb0d9164 Fix readlink related memory leak 2020-07-16 09:16:48 +02:00
Christoph M. Becker
a9e45bc0fb Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78296: is_file fails to detect file
2019-12-02 11:29:58 +01:00
Christoph M. Becker
bb735c9e9e Fix #78296: is_file fails to detect file
If we're constructing extended-length paths (i.e. paths prefixed with
`\\?\`), we have to replace all forward slashes with backward slashes,
because the former are not supported by Windows for extended-length
paths.

The more efficient and likely cleaner alternative solution would be to
cater to this in `php_win32_ioutil_normalize_path_w()` by always
replacing forward slashes, but that might break existing code.  It
might be sensible to change that for `master`, though.
2019-12-02 11:29:10 +01:00
johnstevenson
b37a6aafce Fix bc break in Windows readlink
GetFinalPathNameByHandleW is given a file handle to a symbolic link,
rather than one to the target, and therefore returns an incorrect path.

Fix symlink with relative path and add test
2019-03-10 15:48:31 +01:00
Peter Kokot
92ac598aab Remove local variables
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.

A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.

This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.

With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.

Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files.  All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
2019-02-03 21:03:00 +01:00
Zeev Suraski
0cf7de1c70 Remove yearly range from copyright notice 2019-01-30 11:03:12 +02:00
Anatol Belski
248c857a31 Reuse delivered length
Fix length calculation
2018-10-03 23:12:49 +02:00
Anatol Belski
91c905e83c Refactor php_sys_readlink
Also move the implementation into win32 where it belongs
2018-10-03 18:56:55 +02:00
Anatol Belski
3e2549d74f Merge branch 'PHP-7.3'
* PHP-7.3:
  Fixed bug #76947 file_put_contents() blocks the directory of the file (__DIR__)
2018-10-03 00:22:34 +02:00
Anatol Belski
8209a8821c Fixed bug #76947 file_put_contents() blocks the directory of the file (__DIR__)
The condition was wrong. The target buffer size only matters, when some
output is going to be copied into it.
2018-10-03 00:15:43 +02:00
Anatol Belski
e42e8b1051 Refactor stat implementation
- move relevant parts into win32
- general cleanup
- use Windows API and fallback to POSIX
- improve filetime to timestamp conversion
- improve stat/fsat
- handle ino by using file index
- handle st_dev by using volume serial number

The inode implementation is based on file indexes from NTFS. On 32-bit,
fake inodes are shown, that may lead to unexpeted results. 64-bit
implementation is most reliable.
2018-08-26 22:30:06 +02:00
Christoph M. Becker
c9861bd7a9 Create and expose php_sys_symlink() and php_sys_link()
These macros are supposed to behave like POSIX's symlink() and link(),
respectively, on POSIX compliant systems and on Windows.

Future scope: merge link.c and link_win32.c
2018-08-02 14:08:30 +02:00
Anatol Belski
0834679e40 Merge branch 'PHP-7.2'
* PHP-7.2:
  Fix macro
2018-07-12 11:38:18 +02:00
Anatol Belski
9443c61928 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix macro
2018-07-12 11:37:13 +02:00
Anatol Belski
cc7b000d2c Fix macro 2018-07-12 11:35:00 +02:00
Anatol Belski
34833c9d39 Avoid multiple wcslen() calls 2018-02-18 20:30:33 +01:00
Anatol Belski
036a80037b Avoid multiple wcslen calls 2018-02-18 15:26:33 +01:00
Anatol Belski
9d8417f190 Reduce variable scope 2018-02-15 21:18:58 +01:00
Anatol Belski
d7f65f30a0 Revert "Improve conversion loop"
This reverts commit 7a4573a55a.

Don't read over '\0'.
2018-02-12 22:59:21 +01:00
Anatol Belski
7a4573a55a Improve conversion loop 2018-02-05 20:42:17 +01:00
Gabriel Caruso
c215b8d147 Trailing whitespaces on win32
Signed-off-by: Gabriel Caruso <carusogabriel34@gmail.com>
2018-01-04 02:41:26 -02: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
Xinchen Hui
ccd4716ec7 year++ 2018-01-02 12:53:31 +08:00
Anatol Belski
9baf84e513 Drop unused code 2017-12-15 15:00:20 +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
71eaf0d97f Merge branch 'PHP-7.2'
* PHP-7.2:
  Fixed bug #75679 Path 260 character problem
2017-12-14 16:18:33 +01:00
Anatol Belski
ed210c186a Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #75679 Path 260 character problem
2017-12-14 16:17:37 +01:00
Anatol Belski
4c0af1fbd4 Fixed bug #75679 Path 260 character problem 2017-12-14 16:16:50 +01:00
Anatol Belski
331019c548 Use cheaper ascii conversion for mode 2017-12-09 12:38:19 +01:00
Anatol Belski
f3fd860e24 Revamp fopen implementation, rely on open 2017-12-09 11:58:17 +01:00
Anatol Belski
36cdca6576 Cleanup 2017-12-09 00:21:23 +01:00
Anatol Belski
94f16f1961 Rework mkdir impl and expose wide char variant 2017-12-09 00:11:33 +01:00
Anatol Belski
c9274a4c6a Move declarations 2017-12-08 21:41:25 +01:00
Anatol Belski
a9a49b8250 Improve ioutil access impl and refactor tsrm_win32_access 2017-12-08 20:58:19 +01:00
Anatol Belski
2fbdaec03c Revamp unlink() implementation and improve error handling 2017-12-08 19:23:18 +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
4a2ccd908b Keep up with Linux extension to POSIX.1-2001 getcwd()
If both buf and size are zero, the buf is allocated as big as required.
Otherwise, the size is still to respect.

Fix var name

Improve error check

Ensure the end buffer length is not bigger than requested
2017-11-28 09:15:14 +01:00
Anatol Belski
e9927994eb Sync with the POSIX signature 2017-11-28 09:15:14 +01:00
Anatol Belski
155b244c12 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix normalized path length calculation and error handling
2017-11-27 12:33:23 +01:00
Anatol Belski
34b19387c2 Fix normalized path length calculation and error handling 2017-11-27 12:32:19 +01:00
Anatol Belski
b5fd99b636 Merge branch 'PHP-7.1'
* PHP-7.1:
  Fixed bug #74923 Crash when crawling through network share
2017-07-14 13:24:21 +02:00
Anatol Belski
5d15fdc4a4 Fixed bug #74923 Crash when crawling through network share 2017-07-14 13:23:24 +02:00
Anatol Belski
ba5df1c682 comply with POSIX signature 2017-07-09 16:23:31 +02:00
Anatol Belski
8d0d326ff9 fix warning 2017-07-09 16:05:36 +02:00
Anatol Belski
4bdd63595b Merge branch 'PHP-7.1'
* PHP-7.1:
  improve error handling
2017-05-17 13:38:03 +02:00
Anatol Belski
02e9e59beb improve error handling 2017-05-17 13:35:42 +02:00
Anatol Belski
1507f30d15 Merge branch 'PHP-7.1'
* PHP-7.1:
  fix wrong error check
2017-05-17 12:51:46 +02:00
Anatol Belski
6e3d24bcf4 fix wrong error check 2017-05-17 12:50:41 +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