Commit Graph

4341 Commits

Author SHA1 Message Date
Bob Weinand
3280a29ee5 Fix invalid access to interned strings after they are freed in phpdbg 2016-10-01 10:46:21 +01:00
Bob Weinand
e5d75d7268 Add phpdbg generator command 2016-09-28 13:26:08 +02:00
Julien Pauli
974ba6be7a Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Formatting. Fix possible memory corruption in FPM SHM management
  fix every work call mmap

Conflicts:
	sapi/fpm/fpm/fpm_scoreboard.c
2016-09-23 13:54:22 +02:00
Julien Pauli
fbf87a8082 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Formatting. Fix possible memory corruption in FPM SHM management
  fix every work call mmap
2016-09-23 13:53:22 +02:00
Julien Pauli
a22175b06f Formatting. Fix possible memory corruption in FPM SHM management 2016-09-23 13:52:58 +02:00
tom916
807004a446 fix every work call mmap
fix fpm_scoreboard_free
2016-09-23 13:52:58 +02:00
Anatol Belski
8f256bebef Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  update NEWS
  phpdbg next command must stop when leaving function
2016-09-23 11:25:33 +02:00
Bob Weinand
cf35dae6e2 phpdbg next command must stop when leaving function 2016-09-23 03:29:37 +02:00
George Wang
248ef30abe Merge branch 'PHP-7.0' into PHP-7.1 2016-09-19 10:50:21 -04:00
George Wang
ca24c58e65 Merge branch 'PHP-5.6' into PHP-7.0 2016-09-19 10:49:26 -04:00
George Wang
56fa36b0a8 Fix wrong year in previous commit. 2016-09-19 10:46:46 -04:00
Anatol Belski
b1f33db39f backport 59444347 and 3d7343f6 2016-09-08 17:46:53 +02:00
Stanislav Malyshev
8c16f2262f Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  phpdbg: couple of network function return checks. Possible overflow when copy the socket_path configuration.
2016-09-04 23:24:31 -07:00
David Carlier
19350b6b73 phpdbg: couple of network function return checks. Possible
overflow when copy the socket_path configuration.
2016-09-04 23:18:51 -07:00
Nikita Popov
f1bfd7fe00 Merge branch 'PHP-7.0' into PHP-7.1 2016-09-03 23:31:05 +02:00
Nikita Popov
1ae2d074f8 Fix bug #72996 2016-09-03 23:30:23 +02:00
Anatol Belski
0e709fe42d Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  fix dealloc mismatch
2016-08-29 13:43:08 +02:00
Anatol Belski
eac7f4b670 fix dealloc mismatch 2016-08-29 12:46:23 +02:00
George Wang
0a09eecfcc code cleanup. 2016-08-28 22:31:08 -04:00
George Wang
413bd261ec Merge branch 'PHP-7.0' into PHP-7.1 2016-08-28 22:29:38 -04:00
George Wang
ca1eb585ee Merge branch 'PHP-5.6' into PHP-7.0
Conflicts:
	sapi/litespeed/lsapi_main.c
2016-08-28 22:23:28 -04:00
George Wang
c73bcbefbd Added .user.ini support.
Added LSPHPRC support.
update LiteSpeed SAPI version to 6.10 .
2016-08-28 21:49:30 -04:00
Stanislav Malyshev
d6a43a8562 Fix bug #72836 - integer overflow in base64_decode caused heap corruption 2016-08-16 22:55:41 -07:00
Matthias Endler
ad8b99c888 Fix some typos in PHP FPM configuration
[skip ci]
2016-08-15 22:50:14 +02:00
Anatol Belski
53034feda5 pull ps_title behind the logic to support the current codepage 2016-08-11 13:38:28 +02:00
Nikita Popov
2fbfa7f62e Merge branch 'PHP-7.0' into PHP-7.1 2016-08-09 15:35:04 +02:00
Nikita Popov
842e408c67 Don't copy mime types in CLI server
This is both unnecessary and causes leaks in valgrind.
2016-08-09 15:34:03 +02:00
Christoph M. Becker
b0558b3004 Merge branch 'PHP-7.0' into PHP-7.1 2016-07-28 17:00:54 +02:00
Christoph M. Becker
95190db84d Merge branch 'PHP-5.6' into PHP-7.0 2016-07-28 16:54:36 +02:00
Christoph M. Becker
6e886f07a8 Fix #72676: Test cli_process_title_unix fails on AIX
Patch provided by matthieu dot sarter dot external at atos dot net.
2016-07-28 16:51:45 +02:00
Remi Collet
d5ad4b8b14 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  FPM: add test for CVE-2016-5385
2016-07-22 09:37:00 +02:00
Remi Collet
9622f973a5 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  FPM: add test for CVE-2016-5385
2016-07-22 09:36:36 +02:00
Remi Collet
fb4a6dc0f1 FPM: add test for CVE-2016-5385 2016-07-22 09:35:09 +02:00
Anatol Belski
88d86aeb53 add missing header to fix build 2016-07-19 01:30:07 +02:00
Anatol Belski
2349332b66 correct macro names 2016-07-17 12:33:26 +02:00
Bob Weinand
517bbb14fd Disable optimizer when it conflicts with phpdbg tests 2016-07-13 10:22:00 +02:00
Bob Weinand
7a125a4409 Remove bogus zend_signal_shutdown symbol from header 2016-07-13 01:05:32 +02:00
Bob Weinand
d08cb90462 Cleanup zend_/signal usage in phpdbg.c 2016-07-13 00:37:25 +02:00
Bob Weinand
ef6d0c8b6d Fix phpdbg ZTS watchpoint+shutdown sequences & opcache+watchpoints 2016-07-12 20:50:51 +02:00
Julien Pauli
556cbfb6c3 Merge branch 'PHP-7.0'
* PHP-7.0:
  Updated NEWS
  Updated NEWS
  Fix #72575: using --allow-to-run-as-root should ignore missing user directive
2016-07-12 10:38:51 +02:00
Julien Pauli
3c356aa7cb Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Updated NEWS
  Fix #72575: using --allow-to-run-as-root should ignore missing user directive
2016-07-12 10:38:22 +02:00
gooh
fb49f137ec Fix #72575: using --allow-to-run-as-root should ignore missing user
directive

Trying to start PHP-FPM with the --allow-to-run-as-root flag will not
work when the user directive is not given in the FPM worker pool
configuration. Parsing the config will fail. Consequently, FPM cannot
start.

The check is in place to prevent FPM from getting started with root
privileges by accident. Prior to #61295 the check would also prevent
any non-root user to start PHP-FPM without a user directive present.

This patch adds an additional check to the config parser, checking for
the --allow-to-run-as-root flag to be present. If so, parsing will no
longer abort for root users even if the user directive is missing.

I will also update the PHP docs since they still state the user
directive is a mandatory setting which it is not since #61295.
2016-07-12 10:36:17 +02:00
Bob Weinand
b00376884e Rewrite watchpoints to be much more stable
This mainly involves a separate abstraction layer for elements (e.g. $a->b) and watchpoints (on pointer of the Bucket for example).
Also better comparison handling (value backup vs. page dumps).

It is not yet finished (there are sometimes false positives announced and names not yet perfect), but the functionality is working and not crashing as far as I have tested.
Future scope is also relative watchpoints, e.g. "w $this->val expression()" which does not have the symbol tables as basis, but the value (in this example: return value of expression()) as basis.
2016-07-11 23:58:20 +02:00
Julien Pauli
51e7415575 Merge branch 'PHP-7.0'
* PHP-7.0:
  Remove needless zeroing of anonymously mmap'd memory
  Remove needless zeroing of anonymously mmap'd memory
2016-07-11 14:59:24 +02:00
Julien Pauli
fc2c301fe2 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Remove needless zeroing of anonymously mmap'd memory
  Remove needless zeroing of anonymously mmap'd memory
2016-07-11 14:58:55 +02:00
Julien Pauli
2552cf248d Remove needless zeroing of anonymously mmap'd memory 2016-07-11 14:58:12 +02:00
Michael McConville
9dd5d96332 Remove needless zeroing of anonymously mmap'd memory
All existing systems zero anonymously mmapped memory, and if I
understand correctly POSIX will be specifying this soon. Many projects
already rely on it, so no reasonable system would return memory of
unspecified value.
2016-07-11 14:56:17 +02:00
Anatol Belski
45a8824423 fix build with mod_winnt 2016-07-11 09:40:43 +02:00
Martin Vobruba
2809a676b5 Pass error severity to SAPI modules and raise corresponding error level in Apache 2016-07-11 09:34:48 +02:00
Dmitry Stogov
d898344663 Inline simple constant functions 2016-06-30 17:04:25 +03:00
Remi Collet
d53fa7f451 Improve php-fpm systemd unit file
- use PrivateTmp, now available everwhere, for better security
- add comment about how to customize the unit file
2016-06-29 06:48:06 +02:00
Dmitry Stogov
0cfb47651c Fixed compilation warnings 2016-06-28 11:37:51 +03:00
Xinchen Hui
de7a6b1232 MFH: Fixed fd leak (the origin commit can not be cherry-picked) 2016-06-28 11:36:27 +08:00
David Carlier
85e985f191 couple of resource leaks fixes and use after free's 2016-06-27 07:44:21 +01:00
Xinchen Hui
8de8636a2b Merge branch 'PHP-7.0' 2016-06-24 18:08:28 -07:00
Xinchen Hui
0183a9af5a Fixed bug #72484 (SCRIPT_FILENAME shows wrong path if the user specify router.php) 2016-06-24 18:08:16 -07:00
Dmitry Stogov
1433162083 Fixed compilation warnings 2016-06-21 20:12:29 +03:00
Dmitry Stogov
22ecd4428a Fixed compilation warnings 2016-06-21 17:56:07 +03:00
Dmitry Stogov
1616038698 Added ZEND_ATTRIBUTE_FORMAT to some middind functions.
"%p" replaced by ZEND_LONG_FMT to avoid compilation warnings.
Fixed most incorrect use cases of format specifiers.
2016-06-21 16:00:37 +03:00
Dmitry Stogov
7cc1b00163 Improved support for zend-signals. 2016-06-20 22:41:14 +03:00
Dmitry Stogov
c22a1c83f3 Zend signals should be installed after request startup (or regular signals may be installed before zend_signal_startup) 2016-06-20 19:19:16 +03:00
Dmitry Stogov
c622cc4446 Fixed phpdbg build without --enable-zend-signals 2016-06-20 16:32:24 +03:00
Dmitry Stogov
6ef43be1d7 Merge branch 'master' of git.php.net:php-src
* 'master' of git.php.net:php-src:
  Fixed the UTF-8 and long path support in the streams on Windows.
2016-06-20 14:59:35 +03:00
Dmitry Stogov
c8706331b5 Cleanup zend_signal API 2016-06-20 14:58:42 +03:00
Anatol Belski
3d3f11ede4 Fixed the UTF-8 and long path support in the streams on Windows.
Since long the default PHP charset is UTF-8, however the Windows part is
out of step with this important point. The current implementation in PHP
doesn't technically permit to handle UTF-8 filepath and several other
things. Till now, only the ANSI compatible APIs are being used. Here is more
about it

https://msdn.microsoft.com/en-us/library/windows/desktop/dd317752%28v=vs.85%29.aspx

The patch fixes not only issues with multibyte filenames under
incompatible codepages, but indirectly also issues with some other multibyte
encodings like BIG5, Shift-JIS, etc. by providing a clean way to access
filenames in UTF-8. Below is a small list of issues from the bug tracker,
that are getting fixed:

https://bugs.php.net/63401
https://bugs.php.net/41199
https://bugs.php.net/50203
https://bugs.php.net/71509
https://bugs.php.net/64699
https://bugs.php.net/64506
https://bugs.php.net/30195
https://bugs.php.net/65358
https://bugs.php.net/61315
https://bugs.php.net/70943
https://bugs.php.net/70903
https://bugs.php.net/63593
https://bugs.php.net/54977
https://bugs.php.net/54028
https://bugs.php.net/43148
https://bugs.php.net/30730
https://bugs.php.net/33350
https://bugs.php.net/35300
https://bugs.php.net/46990
https://bugs.php.net/61309
https://bugs.php.net/69333
https://bugs.php.net/45517
https://bugs.php.net/70551
https://bugs.php.net/50197
https://bugs.php.net/72200
https://bugs.php.net/37672

Yet more related tickets can for sure be found - on bugs.php.net, Stackoverflow
and Github. Some of the bugs are pretty recent, some descend to early
2000th, but  the user comments in there last even till today. Just for example,
bug #30195 was opened in 2004, the latest comment in there was made in 2014. It
is certain, that these bugs descend not only to pure PHP use cases, but get also
redirected from the popular PHP based projects. Given the modern systems (and
those supported by PHP) are always based on NTFS, there is no excuse to keep
these issues unresolved.

The internalization approach on Windows is in many ways different from
UNIX and Linux, while it supports and is based on Unicode. It depends on the
current system code page, APIs used and exact kind how the binary was compiled
The locale doesn't affect the way Unicode or ANSI API work. PHP in particular
is being compiled without _UNICODE defined and this is conditioned by the
way we handle strings. Here is more about it

https://msdn.microsoft.com/en-us/library/tsbaswba.aspx

However, with any system code page ANSI functions automatically convert
paths to UTF-16. Paths in some encodings incompatible with the
current system code page, won't work correctly with ANSI APIs. PHP
till now only uses the ANSI Windows APIs.

For example, on a system with the current code page 1252, the paths
in cp1252 are supported and transparently converted to UTF-16 by the
ANSI functions. Once one wants to handle a filepath encoded with cp932 on
that particular system, an ANSI or a POSIX compatible function used in
PHP will produce an erroneous result. When trying to convert that cp932 path
to UTF-8 and passing to the ANSI functions, an ANSI function would
likely interpret the UTF-8 string as some string in the current code page and
create a filepath that represents every single byte of the UTF-8 string.
These behaviors are not only broken but also disregard the documented
INI settings.

This patch solves the issies with the multibyte paths on Windows by
intelligently enforcing the usage of the Unicode aware APIs. For
functions expect Unicode (fe CreateFileW, FindFirstFileW, etc.), arguments
will be converted to UTF-16 wide chars. For functions returning Unicode
aware data (fe GetCurrentDirectoryW, etc.), resulting wide string is
converted back to char's depending on the current PHP charset settings,
either to the current ANSI codepage (this is the behavior prior to this patch)
or to UTF-8 (the default behavior).

In a particular case, users might have to explicitly set
internal_encoding or default_charset, if filenames in ANSI codepage are
necessary. Current tests show no regressions and witness that this will be an
exotic case, the current default UTF-8 encoding is compatible with any
supported system. The dependency libraries are long switching to Unicode APIs,
so some tests were also added for extensions not directly related to streams.
At large, the patch brings over 150 related tests into the core. Those target
and was run on various environments with European, Asian, etc. codepages.
General PHP frameworks was tested and showed no regressions.

The impact on the current C code base is low, the most places affected
are the Windows only places in the three files tsrm_win32.c, zend_virtual_cwd.c
and plain_wrapper.c. The actual implementation of the most of the wide
char supporting functionality is in win32/ioutil.* and win32/codepage.*,
several  low level functionsare extended in place to avoid reimplementation for
now. No performance impact was sighted. As previously mentioned, the ANSI APIs
used prior the patch perform Unicode conversions internally. Using the
Unicode  APIs directly while doing custom conversions just retains the status
quo. The ways to optimize it are open (fe. by implementing caching for the
strings converted to wide variants).

The long path implementation is user transparent. If a path exceeds the
length of _MAX_PATH, it'll be automatically prefixed with \\?\. The MAXPATHLEN
is set to 2048 bytes.

Appreciation to Pierre Joye, Matt Ficken, @algo13 and others for tips, ideas
and testing.

Thanks.
2016-06-20 12:45:39 +02:00
Dmitry Stogov
3abd9c34c1 Removed unused callbacks 2016-06-20 13:27:59 +03:00
Martin Vobruba
1ed544d05b Enable per-module logging in Apache 2.4+ 2016-06-03 00:08:57 +02:00
Anatol Belski
d122f4c24a improve date header code 2016-06-02 13:13:54 +02:00
SeeSchloss
f33c7b3e41 Added mandatory Date: header to built-in webserver 2016-06-02 12:27:48 +02:00
Xinchen Hui
0ed4034881 Merge branch 'PHP-7.0'
* PHP-7.0:
  Fixed bug #72308 (fastcgi_finish_request and logging environment variables)
2016-06-02 14:17:00 +08:00
Xinchen Hui
31ce3a661a Fixed bug #72308 (fastcgi_finish_request and logging environment variables) 2016-06-02 14:16:32 +08:00
Anatol Belski
6bd3b8108a Merge branch 'PHP-7.0'
* PHP-7.0:
  fix condition
2016-05-30 18:36:06 +02:00
Anatol Belski
2524ab9e67 fix condition 2016-05-30 18:35:14 +02:00
Bob Weinand
67468fb417 Fixed bug #72284 (phpdbg fatal errors with coverage)
Cherry-pick of original commits d3371b and 0f20e11 only present in master
2016-05-30 13:31:17 +02:00
Adam Harvey
38be3b28cb Merge branch 'PHP-7.0'
* PHP-7.0:
  Fix typo in phpdbg help.
2016-05-25 12:48:00 -05:00
Adam Harvey
c523dfdb49 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Fix typo in phpdbg help.
2016-05-25 12:47:49 -05:00
Adam Harvey
54eb659032 Fix typo in phpdbg help.
Sorry, I would have included this in the last push had I spotted it a
minute earlier.
2016-05-25 12:47:35 -05:00
Adam Harvey
457d3ad36c Merge branch 'PHP-7.0'
* PHP-7.0:
  Add missing newlines to phpdbg's help for the run command.
2016-05-25 12:42:17 -05:00
Adam Harvey
ac29f9de86 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Add missing newlines to phpdbg's help for the run command.
2016-05-25 12:40:23 -05:00
Adam Harvey
e623e91e27 Add missing newlines to phpdbg's help for the run command.
This is not at all related to needing screenshots for a talk I'm giving
in two days. No sir. Not at all.
2016-05-25 12:38:41 -05:00
Dmitry Stogov
2ae21abdf7 Fixed bug #72213 (Finally leaks on nested exceptions).
Squashed commit of the following:

commit 8461b0407f
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed May 25 00:34:42 2016 +0300

    Rmoved zend_try_catch_element.parent and walk through op_array.try_catch_array backward from the current try_cacth_offset.

commit 0c71e24964
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed May 25 00:04:53 2016 +0300

    Move SAVE_OPLINE() to its original place

commit 111432a4df
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed May 25 00:01:10 2016 +0300

    Separate the common part of ZEND_HANDLE_EXCEPTION and FAST_RET into zend_dispatch_try_catch_finally_helper.

commit 4f21c06c2e
Author: Nikita Popov <nikic@php.net>
Date:   Tue May 24 14:55:27 2016 +0200

    Improve finally fix

commit da5c727499
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue May 24 10:36:08 2016 +0300

    Fixed Zend/tests/try/bug70228_3.phpt and Zend/tests/try/bug70228_4.phpt

commit cfcedf2fb4
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue May 24 02:59:27 2016 +0300

    Added test

commit 4c6aa93d43
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue May 24 00:38:20 2016 +0300

    Added tests

commit 8a8f4704b0
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Mon May 23 23:27:34 2016 +0300

    Fixed bug #72213 (Finally leaks on nested exceptions)
2016-05-25 01:25:12 +03:00
Dmitry Stogov
be071702b3 Fixed bug #72188 (Nested try/finally blocks losing return value) 2016-05-13 14:38:43 +03:00
Bob Weinand
d33e71b358 Fix include_once in phpdbg 2016-05-07 14:45:41 +02:00
Bob Weinand
0f20e113c2 Fix potential double free with phpdbg 2016-05-03 13:36:41 +02:00
Joe Watkins
12f826d7df Merge branch 'PHP-7.0'
* PHP-7.0:
  fix size_t signed comparison
2016-04-29 10:20:27 +01:00
Joe Watkins
dbae1653da fix size_t signed comparison 2016-04-29 10:19:55 +01:00
Dmitry Stogov
747a482b9c Don't initialize EX(call)->symbol_table on each function call.
Keep it uninitialized, and check ZEND_CALL_HAS_SYMBOL_TABLE flag when necessary.
2016-04-28 15:17:24 +03:00
Dmitry Stogov
6499162ff0 - get rid of EG(scope). zend_get_executed_scope() should be used instead.
- ichanged zval_update_constant_ex(). Use IS_TYPE_IMMUTABLE flag on shared constants and AST, instead of "inline_change" parameter.
2016-04-28 04:13:34 +03:00
Dmitry Stogov
f0a2e8eb13 Removed "zend_fcall_info.function_table". It was assigned in many places, but is never used. 2016-04-27 13:46:38 +03:00
Ferenc Kovacs
1380a6c2ff Merge branch 'PHP-7.0'
* PHP-7.0:
  mark frequent intermittent fpm test with XFAIL
2016-04-18 09:05:16 +02:00
Ferenc Kovacs
8f35ee49ee Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  mark frequent intermittent fpm test with XFAIL
2016-04-18 09:04:55 +02:00
Ferenc Kovacs
3a16f511d9 mark frequent intermittent fpm test with XFAIL 2016-04-18 09:04:27 +02:00
Xinchen Hui
a8c4d9e09d Merge branch 'PHP-7.0'
* PHP-7.0:
  Fixed failed with libedit
2016-04-15 11:58:13 +08:00
Xinchen Hui
163d26d584 Fixed failed with libedit 2016-04-15 11:57:53 +08:00
Joe Watkins
fef494f99f Merge branch 'PHP-7.0'
* PHP-7.0:
  phpdbg: close file handles
2016-04-12 13:40:36 +01:00
Joe Watkins
b04125da85 phpdbg: close file handles 2016-04-12 13:40:03 +01:00
Nikita Popov
8e5b139732 Evaluate arguments of new for classes without ctor
ML: http://markmail.org/message/4b3mk7jid64zvz34
2016-03-25 19:11:37 +01:00
Nikita Popov
24551ed6c8 Print .0 in phpdbg opcode dumps 2016-03-25 19:11:32 +01:00
Matt Ficken
fa6ce55675 bug #71478 implementing feature request 2016-03-21 21:09:32 -07:00
Anatol Belski
ec13d5ca75 Merge branch 'PHP-7.0'
* PHP-7.0:
  update NEWS
  Fix bug #71624, PHP_MODE_PROCESS_STDIN (CLI SAPI called with '-R') did not properly set $argi and $argn
  fix uninitialized value
2016-03-15 07:11:54 +01:00