Commit Graph

164 Commits

Author SHA1 Message Date
Nikita Popov
7a766401eb Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix bug #81068: Fix possible use-after-free in realpath_cache_clean()
2021-05-25 11:41:06 +02:00
Nikita Popov
0fb371440d Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix bug #81068: Fix possible use-after-free in realpath_cache_clean()
2021-05-25 11:40:57 +02:00
Dimitry Andric
99a208566a Fix bug #81068: Fix possible use-after-free in realpath_cache_clean()
If ZTS is enabled, this can cause cwd_globals_ctor() to be called
multiple times, each with a freshly allocated virtual_cwd_globals
instance. At shutdown time however, cwd_globals_dtor() will call
realpath_cache_clean(), which then possibly cleans up the same
realpath_cache instance more than once. Using AddressSanitzer, this
shows up as a heap use-after-free.

To avoid this, add a helper function to do the actual work on one
instance of a realpath_cache, and call it both from cwd_globals_dtor()
and realpath_cache_clean(). The former uses the virtual_cwd_globals
parameter passed in via the destructor, the latter uses the CWDG()
macro.
2021-05-25 11:40:28 +02:00
George Peter Banyard
aca6aefd85
Remove 'register' type qualifier (#6980)
The compiler should be smart enough to optimize this on its own
2021-05-14 13:38:01 +01:00
KsaR
01b3fc03c3
Update http->https in license (#6945)
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
Christoph M. Becker
c8a966a9ae
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #80960: opendir() warning wrong info when failed on Windows
2021-04-19 16:18:03 +02:00
Christoph M. Becker
cb262cd974
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80960: opendir() warning wrong info when failed on Windows
2021-04-19 16:17:01 +02:00
Christoph M. Becker
ea3c992bff
Fix #80960: opendir() warning wrong info when failed on Windows
Firstly, we must not forget to set appropriate error codes for "manual"
checks in `virtual_file_ex()`.

Secondly, we must not call `php_error_docref2()` for warnings regarding
unary functions; thus, we introduce `php_win32_docref1_from_error()`.

Closes GH-6872.
2021-04-19 16:12:22 +02:00
Josh Soref
462da6e09c Fix spelling and grammar mistakes
This PR corrects misspellings identified by the check-spelling action.

The misspellings have been reported at jsoref@b6ba3e2#commitcomment-48946465

The action reports that the changes in this PR would make it happy: jsoref@602417c

Closes GH-6822.
2021-04-13 12:09:37 +02:00
George Peter Banyard
5caaf40b43
Introduce pseudo-keyword ZEND_FALLTHROUGH
And use it instead of comments
2021-04-07 00:46:29 +01:00
Nikita Popov
26bd857999 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Declare may_retry_reparse_point on windows only
2020-10-26 12:41:12 +01:00
Nikita Popov
31aca85572 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Declare may_retry_reparse_point on windows only
2020-10-26 12:40:56 +01:00
Nikita Popov
824cbc2781 Declare may_retry_reparse_point on windows only 2020-10-26 12:40:45 +01:00
Christoph M. Becker
0abcb9fb69 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80258: Windows Deduplication Enabled, randon permission errors
2020-10-26 11:22:39 +01:00
Christoph M. Becker
ac2e9587fb Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80258: Windows Deduplication Enabled, randon permission errors
2020-10-26 11:21:52 +01:00
Christoph M. Becker
848e24f24d Fix #80258: Windows Deduplication Enabled, randon permission errors
A recent bug fix regarding symlinks claimed:

> After resolving reparse points, the path still may be a reparse
> point; in that case we have to resolve that reparse point as well.

While that is basically correct, some reparse points may point to
inaccessible system folders (e.g. `IO_REPARSE_TAG_DEDUP` points to
"\System Volume Information").  Since we don't know details about
arbitrary reparse points, and are mainly interested in nested symlinks,
we take a step back, and only resolve `IO_REPARSE_TAG_SYMLINK` for now.

Close GH-6354.
2020-10-26 11:21:14 +01:00
George Peter Banyard
fa8d9b1183 Improve type declarations for Zend APIs
Voidification of Zend API which always succeeded
Use bool argument types instead of int for boolean arguments
Use bool return type for functions which return true/false (1/0)
Use zend_result return type for functions which return SUCCESS/FAILURE as they don't follow normal boolean semantics

Closes GH-6002
2020-08-28 15:41:27 +02:00
Christoph M. Becker
44ad2db15f Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79806: realpath() erroneously resolves link to link
2020-07-28 14:02:25 +02:00
Christoph M. Becker
e0ebe56ebf Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79806: realpath() erroneously resolves link to link
2020-07-28 14:00:52 +02:00
Christoph M. Becker
c756f82c02 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-28 13:55:22 +02:00
Christoph M. Becker
592f70bc46 Merge branch 'PHP-7.4'
* PHP-7.4:
  Revert "Fix #79806: realpath() erroneously resolves link to link"
2020-07-27 17:53:23 +02:00
Christoph M. Becker
f02507469d Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Revert "Fix #79806: realpath() erroneously resolves link to link"
2020-07-27 17:51:56 +02:00
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
54e15dcd6f Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79806: realpath() erroneously resolves link to link
2020-07-27 15:11:39 +02:00
Christoph M. Becker
85a26fef11 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79806: realpath() erroneously resolves link to link
2020-07-27 15:10:22 +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
5a04796f76 Fix MSVC level 1 (severe) warnings
We fix (hopefully) all instances of:

* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4005>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4024>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4028>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4047>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4087>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4090>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4273>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4312>

`zend_llist_add_element()` and `zend_llist_prepend_element()` now
explicitly expect a *const* pointer.

We use the macro `ZEND_VOIDP()` instead of a `(void*)` cast to suppress
C4090; this should prevent accidential removal of the cast by
clarifying the intention, and makes it easier to remove the casts if
the issue[1] will be resolved sometime.

[1] <https://developercommunity.visualstudio.com/content/problem/390711/c-compiler-incorrect-propagation-of-const-qualifie.html>
2020-06-05 11:17:05 +02:00
Christoph M. Becker
f578d57ee9 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79470: PHP incompatible with 3rd party file system on demand
2020-04-27 09:32:02 +02:00
Christoph M. Becker
a2ed731fa5 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79470: PHP incompatible with 3rd party file system on demand
2020-04-27 09:31:38 +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
Nikita Popov
97cb81ead5 Remove HAVE_REALPATH checks
We do not actually use realpath(), but a custom implementation.
Make sure the realpath() function is always available.

Closes GH-5290.
2020-03-26 11:46:00 +01:00
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Christoph M. Becker
3775d47eee Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78220: Can't access OneDrive folder
2019-08-19 19:58:45 +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
Dmitry Stogov
9499484ed2 Implemented a faster way to access predefined TSRM resources - CG(), EG(), etc. 2019-03-14 03:01:01 +03: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
1f4a04fb3f Merge branch 'PHP-7.3'
* PHP-7.3:
  Fixed bug #77484 Zend engine crashes when calling realpath in invalid working dir
2019-01-19 02:39:42 +01: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
f44d53bb4a Merge branch 'PHP-7.3'
* PHP-7.3:
  Fixed bug #77317 __DIR__, __FILE__, realpath() reveal physical path for subst virtual drive
2018-12-26 13:05:46 +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
Gabriel Caruso
cdd8368d6f Clean up unnecessary ternary expressions and simplify some returns
- Simplify conditions
- Use ZEND_HASH_APPLY_* instead of hard-coded booleans
- Use ZEND_NORMALIZE_BOOL
- Drop sign in favor of ZEND_NORMALIZE_BOOL
2018-12-03 01:22:14 +01:00
Zeev Suraski
9afce019e0 Future-proof email addresses 2018-11-01 18:35:32 +02:00
Zeev Suraski
54dc07f3dc Update email addresses. We're still @Zend, but future proofing it... 2018-11-01 17:20:07 +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
44fa6be16e Set correct error code and adapt test 2018-09-17 17:19:39 +02:00
Anatol Belski
decdca664e Fix error setting, both errors are needed 2018-09-17 13:34:52 +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
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