Commit Graph

627 Commits

Author SHA1 Message Date
Christoph M. Becker
be74a00464 Fix VirtualProtect() related Phar issues
We must not (try to) modify shared values, but rather have to use our
own copies, if unixified filenames are required on Windows.  To avoid
excessive string duplication, we add checks whether the filenames are
already unixified (i.e. do not contain backslashes).  To improve the
performance if we need to copy strings, we use do_alloca() and friends.

Besides generally being somewhat messy, the handling of unixified
filenames is still suboptimal performance-wise, but we leave this for a
future cleanup, and focus on fixing the issue at hand for now.

We also enable opcache.protect_memory for the AppVeyor CI.
2019-04-26 09:09:22 +02:00
Peter Kokot
c245898bfa Update and fix remaining year ranges (2019)
This patch follows previous license year ranges updates. With new
approach source code files now have simplified headers with license
information without year ranges.
2019-02-08 23:14:29 +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
Dmitry Stogov
675a8a64c3 Use HT_IS_INITIALIZED() and HT_INVALIDATE() macros instead of hackish HT_FLAGS assumtions. 2018-12-27 22:48:25 +03: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
Stanislav Malyshev
494d5d2429 Merge branch 'PHP-7.3'
* PHP-7.3:
  Fix bug #77022 - use file mode or umask for new files
2018-12-01 21:49:53 -08:00
Stanislav Malyshev
b1446521d7 Fix bug #77022 - use file mode or umask for new files 2018-12-01 21:48:49 -08:00
Stanislav Malyshev
e614b12712 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
2018-12-01 21:48:44 -08:00
Stanislav Malyshev
c5869fd1c8 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
2018-12-01 21:48:40 -08:00
Stanislav Malyshev
09885f78c6 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
2018-12-01 21:48:35 -08:00
Stanislav Malyshev
cea277048d Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Fix bug #77022 - use file mode or umask for new files
2018-12-01 21:48:27 -08:00
Stanislav Malyshev
cc84d893c7 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix bug #77022 - use file mode or umask for new files
2018-12-01 21:47:49 -08:00
Stanislav Malyshev
8136d130b6 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix bug #77022 - use file mode or umask for new files
2018-12-01 21:47:44 -08:00
Stanislav Malyshev
1aec05defd Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix bug #77022 - use file mode or umask for new files
2018-12-01 21:47:37 -08:00
Stanislav Malyshev
67f3615102 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Fix bug #77022 - use file mode or umask for new files
2018-12-01 21:08:38 -08:00
Stanislav Malyshev
69f5e7992b Fix bug #77022 - use file mode or umask for new files 2018-12-01 21:06:45 -08:00
Dmitry Stogov
0f7f1498be Use ZEND_THIS macro to hide implementation details in extensions code. 2018-11-15 19:54:19 +03:00
Dmitry Stogov
c6ad0b92b7 Replace getThis() by EX(This), when additional check is not necessary. 2018-11-14 02:44:25 +03: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
Dmitry Stogov
43d5a3665d It's safer to use zval_ptr_dtor() for iterator keys. 2018-07-05 16:56:52 +03:00
Dmitry Stogov
3780b027dd Use zval_ptr_dtor() instead of zval_dtor() in internal functions that destroy new created object (This is safer and produces less code) 2018-07-05 14:25:17 +03:00
Dmitry Stogov
4a475a4976 Replace legacy zval_dtor() by zval_ptr_dtor_nogc() or even more specialized destructors.
zval_dtor() doesn't make a lot of sense in PHP-7.* and it's used incorrectly in some places.
Its occurances should be replaced by zval_ptr_dtor() or zval_ptr_dtor_nogc(), or even more specialized destructors.
2018-07-04 19:22:24 +03:00
David Carlier
80bb649ad1 phar module, unsignedness check changes.
while at it, correcting seemingly subtle bug when checking
extension validity.
2018-06-18 14:08:50 +00:00
Dmitry Stogov
5eb1f92f31 Use zend_string_release_ex() instread of zend_string_release() in places, where we sure about string persistence. 2018-05-28 16:27:12 +03:00
Stanislav Malyshev
99f1d904a0 Merge branch 'PHP-7.2'
* PHP-7.2:
  Fix tsrm_ls
  Fix #76129 - remove more potential unfiltered outputs for phar
  Fix test
  Fix bug #76248 - Malicious LDAP-Server Response causes Crash
  Fix bug #76249 - fail on invalid sequences
  Fix #76130: Heap Buffer Overflow (READ: 1786) in exif_iif_add_value
  Fix bug #75981: prevent reading beyond buffer start
2018-04-23 22:04:22 -07:00
Stanislav Malyshev
4c06d929c0 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix tsrm_ls
  Fix #76129 - remove more potential unfiltered outputs for phar
  Fix test
  Fix bug #76248 - Malicious LDAP-Server Response causes Crash
  Fix bug #76249 - fail on invalid sequences
  Fix #76130: Heap Buffer Overflow (READ: 1786) in exif_iif_add_value
  Fix bug #75981: prevent reading beyond buffer start
2018-04-23 22:03:33 -07:00
Stanislav Malyshev
95ee9efa57 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix tsrm_ls
  Fix #76129 - remove more potential unfiltered outputs for phar
  Fix test
  Fix bug #76248 - Malicious LDAP-Server Response causes Crash
  Fix bug #76249 - fail on invalid sequences
  Fix #76130: Heap Buffer Overflow (READ: 1786) in exif_iif_add_value
  Fix bug #75981: prevent reading beyond buffer start
2018-04-23 22:00:24 -07:00
Stanislav Malyshev
5a18d7a0df Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Fix tsrm_ls
  Fix #76129 - remove more potential unfiltered outputs for phar
  Fix test
  Fix bug #76248 - Malicious LDAP-Server Response causes Crash
  Fix bug #76249 - fail on invalid sequences
  Fix #76130: Heap Buffer Overflow (READ: 1786) in exif_iif_add_value
  Fix bug #75981: prevent reading beyond buffer start
2018-04-23 21:59:57 -07:00
Stanislav Malyshev
6e64aba47f Fix #76129 - remove more potential unfiltered outputs for phar 2018-04-23 13:43:43 -07:00
Anatol Belski
2e5ac355b9 Move to unsigned types in phar
Preventing integer overflows in principle, which allows to avoid additional
range checks. The phar format is based on 32-bit lengths, so the storage
sizes was kept same.
2018-04-18 20:15:05 +02:00
Gabriel Caruso
701437a948
Remove return types from some magic method in protos
__construct, __destruct, __wakeup does not have return types defined.
2018-03-09 12:04:46 +01:00
Joe
c8e844be35
Merge branch 'PHP-7.2'
* PHP-7.2:
  Fixed bug #65414
2018-02-08 10:34:38 +01:00
Bishop Bettini
d806d0315f
Fixed bug #65414 2018-02-08 10:32:08 +01:00
Bishop Bettini
4765ba7dc3
Fixed bug #65414 2018-02-08 10:29:56 +01:00
Nikita Popov
4a7dacb5ee Don't loop over indexes in Phar::extractTo()
Instead use a more idiomatic foreach loop. The behavior is not
strictly the same, but I see no reason why this specific case
should enforce continuously indexed integer keys.

Also handle references in the array while at it.
2018-01-28 22:05:44 +01:00
Nikita Popov
d79a0bf748 Merge branch 'PHP-7.2' 2018-01-28 21:53:38 +01:00
Bishop Bettini
fa586cee3e Fixed bug #54289
If a directory is passed to Phar::extractTo(), loop over all
entries and extract all files with the given prefix.
2018-01-28 21:51:25 +01:00
Dmitry Stogov
9cbb521094 Access HashTable.u.flags through HT_FLAGS() macro. 2018-01-22 13:36:15 +03: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
Dmitry Stogov
b864e6b58c Move constants into read-only data segment 2017-12-15 01:55:00 +03:00
Dmitry Stogov
9e709e2fa0 Move constants into read-only data segment 2017-12-14 18:43:44 +03:00
Nikita Popov
95e9cc2871 Backport some printf() fixes to 7.2 2017-11-16 21:26:33 +01:00
Nikita Popov
26f8fc833b Enable and fix printf() format warnings
Add _unchecked() variants of zend_spprintf and zend_strpprintf for
cases where we specifically want to disable these checks, such as
use of %H.
2017-11-16 21:15:36 +01:00
Kalle Sommer Nielsen
cf1d42e001 Kill compiler warnings in ext/phar 2017-08-24 02:31:52 +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
Joe Watkins
2a64f548da
Merge branch 'PHP-7.1'
* PHP-7.1:
  Fix Bug #74386Phar::__construct(): wrong number of parameters by reflection
2017-05-29 08:32:23 +01:00
Fabien Villepinte
d6922ef8e3
Fix Bug #74386Phar::__construct(): wrong number of parameters by reflection 2017-05-29 08:31:47 +01:00