Commit Graph

5532 Commits

Author SHA1 Message Date
Dmitry Stogov
46e38a1927 Fixed bug #79737 (Building embed as static fails during install step). 2020-06-29 11:14:20 +03:00
Nikita Popov
956dde0bc0 Simplify and fix php-cgi detection
Make it work for installed PHP binaries.
2020-06-26 14:17:56 +02:00
Nikita Popov
f89d84d622 Better leak fix for cgi -s / -w
We also need to go through request shutdown. The naming is a bit
confusing, but it's fine to go through fastcgi_request_done even
if not using fastcgi. Whether we loop or not is checked separately.
2020-06-26 11:07:55 +02:00
Nikita Popov
a1c6a7a3f2 Fix leaks in cgi strip/highlight mode 2020-06-25 16:06:33 +02:00
Nikita Popov
4c8ba98751 Sort extensions alphabetically
This makes it easier to compare mime data from different sources.
2020-06-24 16:59:42 +02:00
Nikita Popov
5889c41c76 Generate tabs in generate_mime_type_map.php
The PHP file is space indented, but we need the C file to be tab
indented.
2020-06-24 16:31:46 +02:00
Nikita Popov
1af78bc8a4 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #79030 Use usec from apache request time
2020-06-24 14:43:13 +02:00
Nikita Popov
5435a4a9d4 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79030 Use usec from apache request time
2020-06-24 14:43:02 +02:00
Herbert256
4a26628b29 Fixed bug #79030 Use usec from apache request time
Don't unnecessarily truncate to milliseconds.

Closes GH-5760.
2020-06-24 14:41:50 +02:00
Christoph M. Becker
26badd58b5 Mark phpdbg test as XFAIL on Windows with JIT enabled
The test fails as of commit 8b12ea04ee.
2020-06-24 10:34:16 +02:00
Nikita Popov
c9b9f525a9 Include stub hash in generated arginfo files
The hash is used to check whether the arginfo file needs to be
regenerated. PHP-Parser will only be downloaded if this is actually
necessary.

This ensures that release artifacts will never try to regenerate
stubs and thus fetch PHP-Parser, as long as you do not modify any
files.

Closes GH-5739.
2020-06-24 09:55:19 +02:00
Nikita Popov
35729b7604 Remove unnecessary initialization in phpdbg webhelper
This whole code is very dubious and should possibly be dropped. For
now just fix the build warning.
2020-06-23 14:29:24 +02:00
Nikita Popov
40d162e423 Merge branch 'PHP-7.4'
* PHP-7.4:
  Restore XFAIL on fpm test
2020-06-23 12:36:04 +02:00
Nikita Popov
c4639a2deb Restore XFAIL on fpm test
Still fails intermittently.
2020-06-23 12:35:11 +02:00
Christoph M. Becker
dad377ba57 Fix test wrt. commit 1a2732f9a8 2020-06-22 18:55:16 +02:00
Michael Orlitzky
40cdc5f298 sapi/fpm/config.m4: add a new --with-fpm-apparmor configure flag.
The existing AC_FPM_APPARMOR macro (which is always run when FPM is
enabled) checks for the existence of libapparmor, and adds it to $LIBS
if found. The result is an "automagic" dependency on libapparmor that
depends not only on the user's configuration, but also on the build
host's environment.

In particular, this can cause problems if the user just happens to
have libapparmor installed (for testing or development) when he builds
PHP. Later, he may remove libapparmor, not realizing that PHP depends
on it. At that point, FPM will cease to work due to the missing library.

This commit adds a new configure flag called "--with-fpm-apparmor",
defaulting to "no", that enables or disables the feature. The new flag
is used to signal the user's intent; whether or not he wants to use
AppArmor. If he does, then we still check for the existence and
usability of libapparmor; however, it is now an error for the library
to be missing when --with-fpm-apparmor is requested.

Gentoo-bug: https://bugs.gentoo.org/637402
PHP-bug: https://bugs.php.net/bug.php?id=75519
2020-06-21 17:08:40 +01:00
David Carlier
bb61346580 Fix Haiku build
getrusage supports only two fields. The network api sits in the network lib.

Closes GH-5732.
2020-06-19 17:21:55 +02:00
Nikita Popov
3a9a8df3fd Fix CLI test if linked against libedit
The error message changed here.
2020-06-18 17:30:03 +02:00
Nikita Popov
ebc3043816 Merge branch 'PHP-7.4' 2020-06-18 17:02:24 +02:00
Nikita Popov
ea3a317659 Fix race condition in FPM tests
The newly de-XFAILed tests have a race condition. Make sure we
terminate only after expecting all the log lines.
2020-06-18 17:01:29 +02:00
Nikita Popov
111f05610d Merge branch 'PHP-7.4' 2020-06-18 16:00:30 +02:00
Nikita Popov
76ca6bf3ef Un-XFAIL FPM tests
These were XFAILed due to a bug in the log implementation that
caused intermittent failures. However, this issue is supposed to
be resolved in the meantime, so try dropping the XFAIL marker.
2020-06-18 15:59:32 +02:00
Christoph M. Becker
92c4b06513 Use ZEND_UNREACHABLE() instead of ZEND_ASSERT(0)
Instead of marking unreachable code with `ZEND_ASSERT(0)`, we introduce
`ZEND_UNREACHABLE()`, so that MSVC which does not consider `assert(0)`
to mark unreachable code does no longer trigger C4715[1] warnings in
debug builds.  This may be useful for other compilers as well.

[1] <https://docs.microsoft.com/de-de/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4715?view=vs-2019>
2020-06-16 18:39:09 +02:00
Nikita Popov
ccf3e01216 Update fuzzer readme
Drop --enable-json flag and make it more obvious that clang needs
to be used.
2020-06-12 10:08:34 +02:00
Christoph M. Becker
68dd6cc92b Control VCRT leak reporting via environment variable in debug builds
Formerly, this had to be enabled by passing the configuration flag
`--enable-crt-debug`; now it can be enabled by setting the environment
variable `PHP_WIN32_DEBUG_HEAP`.  The advantage is that it is no longer
necessary to do separate builds, at the cost of a very minor
performance penalty during process startup.
2020-06-10 09:05:17 +02:00
Nikita Popov
257dbb0450 Add zend_call_known_function() API family
This adds the following APIs:

void zend_call_known_function(
    zend_function *fn, zend_object *object, zend_class_entry *called_scope,
    zval *retval_ptr, int param_count, zval *params);

void zend_call_known_instance_method(
    zend_function *fn, zend_object *object, zval *retval_ptr, int param_count, zval *params);
void zend_call_known_instance_method_with_0_params(
    zend_function *fn, zend_object *object, zval *retval_ptr);
void zend_call_known_instance_method_with_1_params(
    zend_function *fn, zend_object *object, zval *retval_ptr, zval *param);
void zend_call_known_instance_method_with_2_params(
    zend_function *fn, zend_object *object, zval *retval_ptr, zval *param1, zval *param2);

These are used to perform a call if you already have the
zend_function you want to call. zend_call_known_function()
is the base API, the rest are just really thin wrappers around
it for the common case of instance method calls.

Closes GH-5692.
2020-06-09 16:21:54 +02:00
twosee
88355dd338 Constify char * arguments of APIs
Closes GH-5676.
2020-06-08 10:38:45 +02:00
twosee
7d6a0ba808 Fix expression warnings and break warnings
Close GH-5675.
2020-06-07 10:41:11 +02:00
twosee
1b85e749c7 Fix warning of strict-prototypes
Closes GH-5673.
2020-06-07 10:36:50 +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
Nikita Popov
975acfe71e Pass zend_string message to zend_error_cb
This makes the zend_error_cb API simpler, and avoid formatting
the same message in multiple places.

It should be noted that the passed zend_string is always
non-persistent, so if you want to store it persistently somewhere,
you may still need to duplicate it.

The last_error_message is cleared a bit more aggressive, to make
sure it doesn't hang around across allocator life-cycles.

Closes GH-5639.
2020-06-05 09:54:02 +02:00
Christoph M. Becker
4ce47709c7 Fix phpdbg watchpoints wrt. negative_array_index RFC
The implementation of that RFC changed the initial value of
`zend_array.nNextFreeElement` to `-1`; we work around that by inserting
first, and retrieving the index afterwards.

We also fix the erroneous printf specifier for the unsigned integer.
2020-06-05 09:06:29 +02:00
Christoph M. Becker
864fb0ec23 Implement #47074: phpinfo() reports "On" as 1 for the some extensions
What is modified as boolean, should also be displayed as boolean.
2020-06-04 11:25:45 +02:00
Nikita Popov
698bd59fb5 Fix typo in skipif section
Merge mistake...
2020-06-03 14:50:35 +02:00
Nikita Popov
180b9af58a Merge branch 'PHP-7.4'
* PHP-7.4:
  Skip new watch point test under asan
2020-06-03 10:02:31 +02:00
Nikita Popov
2a7d628adc Skip new watch point test under asan 2020-06-03 10:01:57 +02:00
Christoph M. Becker
86057f5f44 Skip new test case on Windows when JIT is enabled
Cf. <http://git.php.net/?p=php-src.git;a=commit;h=c5cf0af8a98cbc574fd315bf9d78033b896886f3>.
2020-06-02 17:12:34 +02:00
Christoph M. Becker
486b8b1cd1 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #73927: phpdbg fails with windows error prompt at "watch array"
2020-06-02 15:19:32 +02:00
Christoph M. Becker
af4a9bf1bf Fix #73927: phpdbg fails with windows error prompt at "watch array"
We expect zvals, so we should request zvals.

We also suppress spurious watchpoint removal notices.
2020-06-02 15:17:40 +02:00
Christoph M. Becker
520a403fcd Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79650: php-win.exe 100% cpu lockup
2020-06-01 13:25:58 +02:00
Christoph M. Becker
b26ad33001 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79650: php-win.exe 100% cpu lockup
2020-06-01 13:24:32 +02:00
Christoph M. Becker
923c45bdca Fix #79650: php-win.exe 100% cpu lockup
As of PHP 7.3.0, `sapi_cli_single_write()` is supposed to return `< 0`
on failure, but `fwrite()` returns a `size_t`, and signals error by
setting the stream's error indicator.  We have to cater to that.
2020-06-01 13:22:44 +02:00
Nikita Popov
7562679b45 Remove json checks in fuzzer SAPI
JSON is now always enabled
2020-05-29 12:08:45 +02:00
Nikita Popov
5716fa7f49 Make Exception::$previous a typed property
Exception::$previous is a private property, so we can add a type:

    private ?Throwable $previous = null;
2020-05-28 14:01:29 +02:00
Nikita Popov
aaae77f7f1 Make Exception::$trace typed array property
This is a private property, so we are allowed to add a type.
The new declaration of the property is:

    private array $trace = [];

This ensures that Exception::getTrace() does indeed return an array.

Userland code that was modifying the property through refleciton
may have to be adjusted to assign an array (instead of null,
for example).

Closes GH-5636.
2020-05-28 13:55:38 +02:00
Christoph M. Becker
c5cf0af8a9 Mark several phpdbg tests as xfail
Apparently, breakpoints and watchpoints are practically disabled if
run with OPcache JIT under Windows, so we mark the affected tests as
xfail in that case for the time being.
2020-05-27 11:39:15 +02:00
Máté Kocsis
fbe30592d6
Improve type error messages when an object is given
From now on, we always display the given object's type instead of just reporting "object".
Additionally, make the format of return type errors match the format of argument errors.

Closes GH-5625
2020-05-26 19:06:19 +02:00
Christoph M. Becker
d2508ef947 Merge branch 'PHP-7.4'
* PHP-7.4:
  Enable phpdbg tests on AppVeyor
  Make phpdbg test portable
  Fix several mostly Windows related phpdbg bugs
  Fix #73926: phpdbg will not accept input on restart execution
2020-05-26 17:46:56 +02:00
Christoph M. Becker
9d5dafe040 Make phpdbg test portable 2020-05-26 17:45:35 +02:00
Christoph M. Becker
8483a21f29 Fix several mostly Windows related phpdbg bugs
* Properly initialize PHPDBG_G(watch_tmp)

  Otherwise that may cause segfaults in ZTS builds.

* Deactivate potentially remaining watchpoints after REPL

  Otherwise the memory could still be protected, resulting in segfaults
  during shutdown.

* NULL zend_handlers_table after freeing

  As of commit 4130fe4[1], the `zend_handlers_table` is explicitly
  freed in the `zend_vm_dtor()`.  Since phpdbg (and maybe some other
  SAPIs) may restart the engine afterwards, we have to make sure that
  the table is also NULLed.

* Only set context option if there is a context

  In other words, we must not follow the null pointer.

* Cater to file handles without attached console

  File handles do not necessarily have an attached console (for
  instance, pipes do not), in which case `GetConsoleScreenBufferInfo()`
  fails.  In this case we set a default value (`40`) for lines like on
  other systems.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=4130fe437a5db7ead1444d3748bd0fbad9829cb2>
2020-05-26 17:45:25 +02:00
Christoph M. Becker
e483761a1e Fix #73926: phpdbg will not accept input on restart execution
We are more liberal, and accept Windows line endings (CRLF) as well.
2020-05-26 17:44:39 +02:00
Nikita Popov
0374cf08c7 Add --file-cache-prime/use options to run-tests
--file-cache-prime populates the file cache,
--file-cache-use uses the file cache.

And fix a number of tests to run under file cache or disabled
timestamp validation.
2020-05-20 15:29:32 +02:00
Christoph M. Becker
5211ddce0e Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix INI setting member name
2020-05-19 16:01:48 +02:00
Christoph M. Becker
6a9db9573e Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix INI setting member name
2020-05-19 16:00:19 +02:00
Christoph M. Becker
85ac5643ff Fix INI setting member name
Since the member is not used in `OnUpdateEol()` that's not really an
issue, but still it's confusing to apparently have two INI settings
targeting the same member.
2020-05-19 15:59:21 +02:00
Nikita Popov
c3bbcff5e6 Fix phpdbg test with JIT
With JIT one extra cache slot is allocated, so the extended_value
needs one more character, and the output ends up having one space
less...
2020-05-18 15:25:24 +02:00
George Peter Banyard
f717ec608d Adjust bogus checks in FPM as HAVE_FPM_LQ is always defined
Drop checks for FPM status as per review

Closes GH-5530
2020-05-17 22:04:35 +02:00
Nikita Popov
406c95758d Remove some uses of zend_inline_hash_func
There's no need to force-inline the hashing for all of these.
2020-05-15 10:14:22 +02:00
Máté Kocsis
68527a7834
Add stubs for some SAPIs
For apache2handler, fpm, litespeed, phpdbg, specifically.
Partially implements GH-5295
2020-05-14 13:35:12 +02:00
George Peter Banyard
c0997130ec Fix [-Wundef] warning in PHPDBG SAPI 2020-05-12 22:02:51 +02:00
George Peter Banyard
56698afb6d Fix [-Wundef] warning in CLI SAPI 2020-05-12 22:02:12 +02:00
George Peter Banyard
f87743de9f Fix [-Wundef] warning in FPM SAPI 2020-05-12 22:02:03 +02:00
Christoph M. Becker
9dcf494e36 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79489: .user.ini does not inherit
2020-05-12 11:49:04 +02:00
Christoph M. Becker
4b0d5e0faf Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79489: .user.ini does not inherit
2020-05-12 11:48:36 +02:00
Christoph M. Becker
bdba0cd3d2 Fix #79489: .user.ini does not inherit
On Windows, PATH_TRANSLATED may contain backslashes as well as slashes,
so we must not only check for `DEFAULT_SLASH`.
2020-05-12 11:47:47 +02:00
Nikita Popov
c50cfc4d3d Add quiet parameter to internal HTML entities API
In some places, we need to make sure that no warnings are thrown
due to unknown encoding. The error reporting code tried to avoid
this by determining a "safe charset", but this introduces subtle
discrepancies in which charset is picked (normally
internal_encoding takes precedence). Avoid this by suppressing
the warning in the first place.

While here, use the fallback logic to print error messages with
substitution characters more consistently, to avoid skipping
parts of the error message entirely.
2020-05-07 15:46:08 +02:00
Alex Dowad
8ddaf13ed3 Code tweaks: Remove unneeded semicolons 2020-04-29 23:17:40 +02:00
Máté Kocsis
33c3691c33
Generate method entries from stubs for Zend classes
Closes GH-5459
2020-04-26 11:13:14 +02:00
George Peter Banyard
f91f72607b Drop unnecessary stdint and inttypes header checks
These are always available as of C99.

Closes GH-5323

Co-authored-by: "Christoph M. Becker" <cmbecker69@gmx.de>
2020-04-22 20:18:19 +02:00
Máté Kocsis
6111d64cda
Improve a last couple of argument error messages
Closes GH-5404
2020-04-20 13:09:00 +02:00
Christoph M. Becker
193cb97a0e Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79491: Search for .user.ini extends up to root dir
2020-04-20 11:00:01 +02:00
Christoph M. Becker
18ad38a7b2 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79491: Search for .user.ini extends up to root dir
2020-04-20 10:58:33 +02:00
Christoph M. Becker
fa10abd6d7 Fix #79491: Search for .user.ini extends up to root dir
The `start` parameter of `php_cgi_ini_activate_user_config` is supposed
to hold the byte offset of the doc root in the given `path`.  However,
the current expression which fixes a potential type incompatibility
will ever only evaluate to zero or one, because it uses the *logical*
and operator (`&&`).  Furthermore we notice that subtracting one from
`doc_root_len` is not necessary, so there is even no need for the
`start` parameter at all.
2020-04-20 10:56:36 +02:00
Nikita Popov
ae5d7e4e96 Merge branch 'PHP-7.4'
* PHP-7.4:
  Apply doc root fix for FPM
2020-04-20 10:48:20 +02:00
Nikita Popov
721ca87e56 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Apply doc root fix for FPM
2020-04-20 10:48:05 +02:00
Nikita Popov
f62571c121 Apply doc root fix for FPM
This is the change from GH-5417 but for FPM. This was stripping the
last character from the doc_root. Given how it is used, this should
be harmless, but let's make it less confusing...
2020-04-20 10:47:54 +02:00
Nikita Popov
d68dfaf05e Remove return value from llist apply functions
Unlike the hash apply functions, these do not return int.
2020-04-15 11:01:12 +02:00
Máté Kocsis
3709e74b5e
Store default parameter values of internal functions in arg info
Closes GH-5353. From now on, PHP will have reflection information
about default values of parameters of internal functions.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2020-04-08 18:37:51 +02:00
Nikita Popov
b0d8f012f9 Merge branch 'PHP-7.4'
* PHP-7.4:
  Add php_cli_server_connect() helper
2020-04-08 17:11:50 +02:00
Nikita Popov
1327491224 Add php_cli_server_connect() helper
To encapsulate the repeated fsockopen() code.

This gives us a chance to control the timeout in one place:
Raise it to one second.
2020-04-08 17:10:20 +02:00
Christoph M. Becker
6a67067c21 Merge branch 'PHP-7.4'
* PHP-7.4:
  Relax overly strict test expectation
2020-04-08 11:35:28 +02:00
Christoph M. Becker
73a0719f45 Relax overly strict test expectation
There is no reason to expect a `1` after the PID; neither the session
ID nor the memory usage are required to contain one.  Actually, we just
want to verify here, that the process with the $child_pid is running,
and is a php.exe process.
2020-04-08 11:34:18 +02:00
Máté Kocsis
21cfa03f17
Generate function entries for another batch of extensions
Closes GH-5352
2020-04-05 21:15:30 +02:00
Matteo Beccati
66ec60cb45 Merge branch 'PHP-7.4'
* PHP-7.4:
  Skip fpm tests not designed to be run as root
  Allow fpm tests to be run with long socket path
2020-04-02 16:17:24 +02:00
Matteo Beccati
87375fa2be Skip fpm tests not designed to be run as root
When running as root with TEST_FPM_RUN_AS_ROOT=1
2020-04-02 16:16:42 +02:00
Matteo Beccati
af337ae47e Allow fpm tests to be run with long socket path
Socket path is restricted to ~100 bytes, so we can use
the system temp dir if the path ends up too long.
2020-04-02 16:16:42 +02:00
Nikita Popov
184fdac7c2 Remove <default> prefix from reflection dump
This really doesn't add anything, and only makes for confusing
terminology. Only marking properties as dynamic is sufficient.
2020-04-02 11:25:41 +02:00
Jakub Zelenka
477efe935b Merge branch 'PHP-7.4' 2020-03-29 20:21:24 +01:00
Andre Nathan
0b4e80b8c1 Allow numeric [UG]ID in FPM listen.{owner,group} 2020-03-29 20:20:01 +01:00
Nikita Popov
33ef3d64da Use separate typedef for bucket comparison function
Avoid performing the same casting dance inside each sort compare
function.
2020-03-04 12:46:06 +01:00
Nicolas Grekas
9e775db025 Define Stringable with __toString():string method 2020-03-02 15:25:32 +01:00
Nikita Popov
a297c4ef9e Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix another flaky FPM test
2020-02-28 14:41:32 +01:00
Nikita Popov
b2d01e0be8 Fix another flaky FPM test 2020-02-28 14:40:21 +01:00
Nikita Popov
b89ba475df Merge branch 'PHP-7.4'
* PHP-7.4:
  Try to fix intermittent FPM failures
2020-02-28 13:19:53 +01:00
Nikita Popov
3c096b51f9 Try to fix intermittent FPM failures
Terminate only after expecting the log lines to avoid race
condition.
2020-02-28 13:19:10 +01:00
Nicolas Oelgart
aa79a22d32 Add preg_last_error_msg() function
Provides the last PCRE error as a human-readable message, similar
to functionality existing in other extensions, such as
json_last_error_msg().

Closes GH-5185.
2020-02-25 10:26:03 +01:00
Jakub Zelenka
736b1ab200 Merge branch 'PHP-7.4' 2020-02-23 19:15:05 +00:00
Jakub Zelenka
578a8113eb Fix bug #79014 (PHP-FPM & Primary script unknown) 2020-02-23 19:14:05 +00:00
Jakub Zelenka
ee0579350f Merge branch 'PHP-7.4' 2020-02-23 18:32:20 +00:00
Jakub Zelenka
0bc6a66a7a Fix bug #77653 (operator displayed instead of the real error message) 2020-02-23 18:29:10 +00:00
Nikita Popov
318fe06042 Create memory stream in exif fuzzer
At least one segfault observed because temp file creation failed.
Switch to using a memory stream, which should be more robust, and
more efficient for that matter.
2020-02-19 10:24:12 +01:00
Christoph M. Becker
7d0102dfa7 Revert "Replace @param annotations with type declarations"
This reverts commit c31029f335.
2020-02-17 08:55:18 +01:00
Christoph M. Becker
c31029f335 Replace @param annotations with type declarations 2020-02-16 23:43:38 +01:00
George Peter Banyard
fa99811389 Fix [-Wmissing-field-initializers] compiler warning in PHPDBG_COMMAND_HELP_D macro 2020-02-10 11:33:06 +01:00
George Peter Banyard
c343c1bcae Fix some -Wold-style-declaration compiler warnings 2020-02-05 17:39:29 +01:00
Nikita Popov
f8d795820e Reindent phpt files 2020-02-03 22:52:20 +01:00
Nikita Popov
169805777c Merge branch 'PHP-7.4'
* PHP-7.4:
  Apply tidy formatting
2020-02-03 13:42:08 +01:00
Nikita Popov
58b17906f5 Apply tidy formatting
Mostly reindent PHP scripts to spaces.
2020-02-03 13:41:31 +01:00
Nikita Popov
4cdd15d414 Merge branch 'PHP-7.4'
* PHP-7.4:
  Disable parallelism for FPM tests
2020-02-03 09:58:03 +01:00
Nikita Popov
aaf9cbb7eb Disable parallelism for FPM tests
Let's see if this helps with spurious failures on Azure.
2020-02-03 09:57:34 +01:00
Akim Demaille
4cbffd89d9
Clean up the generation of the parsers
Prefer '%define api.value.type' to '#define YYSTYPE', so that Bison
know the type.

Use '%code requires' to declare what is needed to define the api.value.type
(that code is output in the generated header before the generated
definition of YYSTYPE).

Prefer '%define api.prefix' inside the grammar file to '-p' outside,
as anyway the functions defined in the file actually use this prefix.

Prefer `%param` to both `%parse-param` and `%lex-param`.

Closes GH-5138
2020-02-01 14:21:53 +01:00
Akim Demaille
37d0f7d3b3
Use "%empty" in the parsers, instead of comments
The annotation %empty is properly enforced: warnings when it's
missing, and errors when it's inappropriate.  Support for %empty was
introduced in Bison 3.0.

Pass -Wempty-rule to Bison.

Closes GH-5134
2020-01-31 09:52:40 +01:00
Nikita Popov
16f194c75e Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix bug #78323: Code 0 is returned on invalid options
2020-01-27 13:32:51 +01:00
Nikita Popov
1cccbb8ff1 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix bug #78323: Code 0 is returned on invalid options
2020-01-27 13:32:38 +01:00
Ivan Mikheykin
fd08f062ae Fix bug #78323: Code 0 is returned on invalid options
Set CLI exit code to 1 when invalid parameters are passed,
and print error to stderr.
2020-01-27 13:32:19 +01:00
wbender
98bfad738a Fix bug #64865: Use CONTEXT_DOCUMENT_ROOT for scanning dir tree
If CONTEXT_DOCUMENT_ROOT is set use that rather than DOCUMENT_ROOT to
scan up the dir tree looking for .user.ini files.

Closes GH-5051.
2020-01-24 15:33:55 +01:00
Nikita Popov
06e193ba8d Merge branch 'PHP-7.4'
* PHP-7.4:
  Add sleep in FPM reload test
2020-01-21 17:56:43 +01:00
Nikita Popov
0aa09da486 Add sleep in FPM reload test
Explicitly mark the point where we have to wait.
2020-01-21 17:55:47 +01:00
Máté Kocsis
d1764ca330
Make error messages more consistent by fixing capitalization
Closes GH-5066 As a first step, let's capitalize their initial letter when it is applicable.
2020-01-17 14:52:46 +01:00
Máté Kocsis
afdaa91170
Fix #78880: Final spelling fixes 2020-01-16 19:14:31 +01:00
Máté Kocsis
c3cf01b553
Fix #78880: Yet another batch of spelling errors 2020-01-16 12:04:00 +01:00
Máté Kocsis
0b4778c377
Fix #78880: Another bunch of spelling errors 2020-01-16 09:46:47 +01:00
Nikita Popov
0a9bdd6e7b Merge branch 'PHP-7.4'
* PHP-7.4:
  Increase select timeout in FPM tester
2020-01-09 10:20:28 +01:00
Nikita Popov
b3cc30adf8 Increase select timeout in FPM tester
Let's see if that helps with the recent failure spree on Azure.
2020-01-09 10:19:02 +01:00
Nikita Popov
d5f26de63d Merge branch 'PHP-7.4'
* PHP-7.4:
  Revert "Display a message if select in FPM test timeouts"
2020-01-08 16:32:00 +01:00
Nikita Popov
4b860c06ed Revert "Display a message if select in FPM test timeouts"
This reverts commit e2361498d5.

Ooops, this occurs normally during some tests, but I didn't notice
because I have slow tests disabled...
2020-01-08 16:31:33 +01:00
Nikita Popov
c669a1a4da Merge branch 'PHP-7.4'
* PHP-7.4:
  Display a message if select in FPM test timeouts
2020-01-08 15:57:21 +01:00
Nikita Popov
e2361498d5 Display a message if select in FPM test timeouts 2020-01-08 15:57:05 +01:00
Máté Kocsis
e1b57310b1
Use RETURN_THROWS() during ZPP in main, sapi, win32, and Zend 2019-12-30 17:38:10 +01:00
Christoph M. Becker
1ab9d626d1 Fix typo 2019-12-30 17:21:50 +01:00
Christoph M. Becker
dabc28d182 Fix #78880: Spelling error report
We fix the most often occuring typos according to a recent codespell
report[1] in tests, code comments and documentation.

[1] <https://fossies.org/linux/test/php-src-master-f8f48ce.191129.tar.gz/codespell.html>.
2019-12-21 11:58:00 +01:00
Nikita Popov
7df8f952ae Further reduce parse depth limit in mbstring fuzzer
Depth limit of 1024 still causes optimize_node stack overflows
when running under asan.
2019-12-14 22:43:15 +01:00
Nikita Popov
9de4f87aca Limit parse depth in mbstring fuzzer
The default depth of 4096 is large enough to cause optimize_node
stack overflows under asan. Reduce to 1024.
2019-12-13 16:09:28 +01:00
ekinhbayar
a74484cc98 Remove phpdbg README
phpdbg documentation has been moved to PHP manual and the link at the
bottom of this README is dead, so the file can be removed.
2019-12-09 17:32:17 +01:00
Jakub Zelenka
d98df5b6c6 Merge branch 'PHP-7.4' 2019-12-08 17:58:59 +00:00
Jakub Zelenka
ac042f839f Fix bug #78916 (php-fpm 7.4.0 don't send mail via mail()) 2019-12-08 17:57:17 +00:00
Jakub Zelenka
2a742546bf Merge branch 'PHP-7.4' 2019-12-01 17:17:30 +00:00
Jakub Zelenka
67cd4271e9 Fix bug #78889 (php-fpm service fails to start) 2019-12-01 17:13:20 +00:00
George Wang
8a977e07d0 Merge branch 'PHP-7.4' 2019-11-21 17:59:05 -05:00
George Wang
99b8e67615 Merge branch 'PHP-7.3' into PHP-7.4 2019-11-21 17:58:44 -05:00
George Wang
e981f5af51 Merge branch 'PHP-7.2' into PHP-7.3 2019-11-21 17:58:16 -05:00
George Wang
c7141412ce Added environment LSAPI_CLEAN_SHUTDOWN to control clean shutdown. Update SAPI version to LiteSpeed v7.6 . 2019-11-21 17:57:50 -05:00
Craig Duncan
e208d236b3 Convert apache2handler arginfo to php stubs 2019-11-18 15:07:04 +01:00
Jakub Zelenka
f826bbde93 Merge branch 'PHP-7.4' 2019-11-17 14:53:53 +00:00
Maksim Nikulin
e37bd5dcc2 Do not let PHP-FPM children miss SIGTERM, SIGQUIT
Postpone signal delivery while spawning children.
Prevent the following case:

- Reload (reexec) is in progress.
- New master is forking to start enough children for pools
  where `pm` is not `on-demand`.
- Another `SIGUSR2` is received by the master process.
- Master process switches to reloading state.
- Some child has not set its own signal handlers.
- `SIGQUIT` and `SIGTERM` sent by master process are caught
  by signal handler set by master process and so they are ignored.
- A child is running, it has no reason to finish

Before pull request #4465 this scenario could cause deadlock,
however with 0ed6c37140 reload finishes after `SIGKILL`.

Use sigprocmask() around fork() to avoid race of delivery signal to children
and setting of own signal handlers.

Fixes bug #76601
2019-11-17 14:46:56 +00:00
Máté Kocsis
27e83d0fb8
Add union return types for function stubs 2019-11-11 14:54:55 +01:00
Nikita Popov
ac4e0f0852 Make zend_type a 2-field struct
We now store the pointer payload and the type mask separately. This
is in preparation for union types, where we will be using both at
the same time.

To avoid increasing the size of arginfo structures, the
pass_by_reference and is_variadic fields are now stored as part of
the type_mask (8-bit are reserved for custom use).

Different types of pointer payloads are distinguished based on bits
in the type_mask.
2019-11-08 15:15:48 +01:00
Fabien Villepinte
a555cc0b3d Clean DONE tags from tests
Remove most of the `===DONE===` tags and its variations.
Keep `===DONE===` if the test output otherwise becomes empty.

Closes GH-4872.
2019-11-07 21:31:47 +01:00
Nikita Popov
11649a6d77 Reduce size limit in parser fuzzer
Avoid stack overflows during compilation of deeply nested
expressions.
2019-11-07 21:20:34 +01:00
Nikita Popov
991a0250b5 Reduce oniguruma retry limit in fuzzer
For some patterns matching may take quite long even at retry limit
100000 and it seems that this is not easy to fix on the oniguruma
side.

Reduce the retry limit by another factor of 10 in hope of reducing
timeouts.
2019-11-02 10:40:41 +01:00
Máté Kocsis
ad9ea5abde Add stubs for various standard functions
Closes GH-4851.
2019-10-30 10:34:06 +01:00
Craig Duncan
1d631c18de Convert phpdbg arginfo to php stubs
Closes GH-4867.
2019-10-29 11:39:58 +01:00
Nikita Popov
1c9cbc911d Small phpdbg cleanups
Add a zpp_none() call, convert E_ERROR to ValueError.
2019-10-29 11:39:02 +01:00
Stanislav Malyshev
6bef57f2e2 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix bug #78599 (env_path_info underflow can lead to RCE) (CVE-2019-11043)
  bump versions after release
  set versions for release
2019-10-21 13:17:32 -07:00
Stanislav Malyshev
59953efc09 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix bug #78599 (env_path_info underflow can lead to RCE) (CVE-2019-11043)
  bump versions after release
  set versions for release
2019-10-21 13:17:27 -07:00
Stanislav Malyshev
57b4dcbe77 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix bug #78599 (env_path_info underflow can lead to RCE) (CVE-2019-11043)
  bump versions after release
  set versions for release
2019-10-21 13:17:19 -07:00
Stanislav Malyshev
4b5cdda0c7 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix bug #78599 (env_path_info underflow can lead to RCE) (CVE-2019-11043)
  bump versions after release
  set versions for release
2019-10-21 13:17:09 -07:00
Jakub Zelenka
ab061f95ca Fix bug #78599 (env_path_info underflow can lead to RCE) (CVE-2019-11043) 2019-10-20 22:50:04 -07:00
Jakub Zelenka
878f8b0b23 Merge branch 'PHP-7.4' 2019-10-20 16:59:30 +01:00
Maksim Nikulin
d537ae73e0 Skip fpm bug #74083 test on Windows
Have not expected side effects of `include`.
2019-10-20 16:08:55 +01:00
Maksim Nikulin
2f9f409156 Add (slow) test for fpm concurrent reloads #74083 2019-10-20 16:08:55 +01:00
Maksim Nikulin
ae5154c6c6 Block signals during fpm master initialization
Fix PHP-FPM failure in the case of concurrent reload attempts.

Postpone signal delivery to the fpm master process till proper signal
handlers are set. Prevent the following case:

- Running master process receives `SIGUSR2` and performs `execvp()`.
- Another `SIGUSR2` is arrived before signal handlers are set.
- Master process dies.
- Requests to the HTTP server handled by PHP-fpm can not be served
  any more.

Block some signals using `sigprocmask()` before `execvp()` and early
in the `main()` function. Unblock signals as soon as proper
handlers are set.

Fixes bug #74083
2019-10-20 16:08:55 +01:00
Christoph M. Becker
0436bc875e Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix miscellaneous typos in docs
2019-10-19 19:20:25 +02:00
Tyson Andre
38f388fba4 Fix miscellaneous typos in docs 2019-10-19 19:19:28 +02:00
Christoph M. Becker
273731fb76 Add Zend class/interface arginfo stubs
We also change `Generator::throw()` to expect a `Throwable` in the
first place, and we now throw a TypeError instead of returning `false`
from `Exception::getTraceAsString()`.
2019-10-15 16:21:00 +02:00
Nikita Popov
db233501ff Use clean shutdown on uncaught exception 2019-10-11 12:41:15 +02:00
Dmitry Stogov
b64a182233 Revert "Link executable files using non PIC object files. This reduces PIC overhead and improves performance."
This reverts commit eef85229d0.
2019-10-10 16:28:59 +03:00
Nikita Popov
f1aff654be Use php stream in exif fuzzer
This has the main benefit that we don't go through the
realpath cache, which will cause leak checking to be
disabled.
2019-10-10 12:33:15 +02:00
Nikita Popov
bd21e202b9 Reduce oniguruma limits in fuzzing sapi
The defaults are fairly conservative and may still take quite a
bit to match a single expression. Reduce them by a factor of 10x
to speed up fuzzing.
2019-10-08 17:38:49 +02:00
Fabien Villepinte
76c8f2ed34 Fix regex in generate_parser_corpus.php
The next section after --FILE-- is not necessarily --EXPECT--.
Accept any section.

Closes GH-4770.
2019-10-02 16:56:41 +02:00
Nikita Popov
872a759f88 Limit input size in exif fuzzer
Probably still too much...
2019-10-01 18:29:23 +02:00
Nikita Popov
4d49ec208e Add --enable-fuzzer-msan flag
To build fuzzers with memory sanitizer.
2019-10-01 13:04:47 +02:00
Nikita Popov
15761ef359 Pass mode to open() in exif fuzzer
Funny how despite all those sanitizers running, nothing ever
caught this...
2019-09-30 18:23:47 +02:00
Nikita Popov
235983dfde Merge branch 'PHP-7.4' 2019-09-30 17:52:39 +02:00
Fabien Villepinte
0aa3acc6c4 Fix borked SKIPIFs 2019-09-30 17:51:41 +02:00
Nikita Popov
b442a9b69b Merge branch 'PHP-7.4' 2019-09-30 12:54:45 +02:00
Nikita Popov
27f5785363 Merge branch 'PHP-7.3' into PHP-7.4 2019-09-30 12:54:18 +02:00
Sergei Turchanov
e546d721e8 Fix #78413: php-fpm request_terminate_timeout does not take effect after fastcgi_finish_request
To retain legacy behavior I decided to add an option to control request
termination logic. If request_terminate_timeout_track_finished is set,
then request will be tracked for time limits even after
fastcgi_finish_request was called.

This patch depends on the fix provided in BUG 78469 (otherwise php-fpm
workers listening on named pipes on Windows will be erroneously terminated)
(PR #4636)
2019-09-30 12:54:09 +02:00
Nikita Popov
61f8f68a79 Make fuzzing sapi i386 compatible
* Avoid an unnecessary -lstdc++ dependency. It's not going to be
   used in the end anyway, and is an unnecessary hassle to set up.
 * Use $LIB_FUZZING_ENGINE instead of hardcoding -lFuzzingEngine.
2019-09-27 23:58:48 +02:00
Nikita Popov
31ff9f3e29 Merge branch 'PHP-7.4' 2019-09-27 11:20:48 +02:00
Nikita Popov
f2826954ac XFAIL sapi/fpm/tests/log-bwd-multiple-msgs-stdout-stderr.phpt
This is supposed to be addressed by GH-4007, but that seems stalled
for now.
2019-09-27 11:18:50 +02:00
Nikita Popov
7e295da81c Limit max length for parser fuzzer
We're getting some very large inputs (~500KB) on OSS-Fuzz, which
slot down performance a lot. Let's try limiting this, starting
with a still fairly large value of 64KB.

Also remove the max_execution_time limit, so that slow test cases
cause a genuine libfuzzer timeout and we may investigate them.
2019-09-26 10:45:47 +02:00
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Nikita Popov
1fe47ad233 Add new entries for exif and unserialize fuzzing corpus 2019-09-24 12:34:30 +02:00
Nikita Popov
8d7911ef56 Standardize type printing in reflection
Use ?T instead of "T or NULL".
2019-09-23 15:40:03 +02:00
Nikita Popov
418d243e37 Change instructions to use oniguruma from git
Some bugs are already fixed there.

[ci skip]
2019-09-18 14:56:25 +02:00
Nikita Popov
d7b4cdff3f Add instructions for building an instrumented libonig
[ci skip]
2019-09-18 12:49:42 +02:00
Nikita Popov
f613e32058 Merge branch 'PHP-7.4' 2019-09-17 12:19:57 +02:00
Nikita Popov
1a5f04688e Merge branch 'PHP-7.3' into PHP-7.4 2019-09-17 12:19:45 +02:00
Nikita Popov
3a2fa489dd Merge branch 'PHP-7.2' into PHP-7.3 2019-09-17 12:19:39 +02:00
Drakano
252ebce0d7 Add tilde to allowed status/ping path
Because of user specific webdirs it should be possible to set a
status/ping path like "/~username/status".

Closes GH-4698.
2019-09-17 12:19:21 +02:00
Nikita Popov
c1adb7a74e Move scripts out of corpus/ directory 2019-09-16 20:18:29 +02:00
Nikita Popov
c4e2ca607f Various improvements to fuzzer SAPIs 2019-09-16 16:04:10 +02:00
Stanislav Malyshev
41f45647f9 Add fuzzer SAPIs to the core 2019-09-16 16:04:09 +02:00
Nikita Popov
a86e04876b Merge branch 'PHP-7.4' 2019-09-14 00:25:39 +02:00
Nikita Popov
fa07a9c223 Fix symtable_cache_limit assignment in phpdbg
The meaning of the limit changed in 7.4, it now points one past the
end. Adjust code accordingly.
2019-09-14 00:25:07 +02:00
Dmitry Stogov
eef85229d0 Link executable files using non PIC object files. This reduces PIC overhead and improves performance. 2019-09-07 11:59:11 +03:00
Dmitry Stogov
64b2ee606c Merge branch 'non_pic'
* non_pic:
  Link executable files using non PIC object files. This reduces PIC overhead and improves performance.
2019-09-06 11:45:43 +03:00
Nikita Popov
edf5896a4e Merge branch 'PHP-7.4' 2019-09-05 18:29:30 +02:00
Nikita Popov
9ec61e43d4 Fix pipe detection and stream position handling
There are two related changes here:
1. Also check for S_ISCHR/FILE_TYPE_CHAR when checking for pipes, so
   that we detect ttys as well, which are also not seekable.
2. Always set position=-1 (i.e. ftell will return false) when a pipe
   is detected. Previously position=0 was sometimes used, depending on
   whether we're on Windows/Linux and whether the FD or FILE codepath
   was used.
2019-09-05 18:29:15 +02:00