Commit Graph

5658 Commits

Author SHA1 Message Date
Stanislav Malyshev
6559fe9126 Do not decode cookie names anymore 2020-09-26 23:47:04 -07:00
Christoph M. Becker
ffa57164a8 Clear error flag instead of toggling it
The toggling of the `REPORT_ERRORS` looks fishy, and likely was
intented as clearing.

Closes GH-6190.
2020-09-23 23:26:58 +02:00
Christoph M. Becker
05edf64436 Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Fix #76735: Incorrect message in fopen on invalid mode
2020-09-23 11:14:06 +02:00
Christoph M. Becker
a89ac98f15 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #76735: Incorrect message in fopen on invalid mode
2020-09-23 10:54:59 +02:00
Christoph M. Becker
2576c57a51 Fix #76735: Incorrect message in fopen on invalid mode
We have to log errors in `stream_opener` callbacks to the wrapper's
error log, because otherwise we may pick up an unrelated `errno` or a
most generic message.

Closes GH-6187.
2020-09-23 10:54:06 +02:00
Christoph M. Becker
544dbe8ef9 Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Fix #76943: Inconsistent stream_wrapper_restore() errors
2020-09-22 16:14:03 +02:00
Christoph M. Becker
ff0f6c26c2 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #76943: Inconsistent stream_wrapper_restore() errors
2020-09-22 16:12:37 +02:00
Christoph M. Becker
5ed0602ec6 Fix #76943: Inconsistent stream_wrapper_restore() errors
If restoring of any not registered built-in wrapper is requested, the
function is supposed to fail with a warning, so we have to check this
condition first.

Furthermore, to be able to detect whether a built-in wrapper has been
changed, it is not sufficient to check whether *any* userland wrapper
has been registered, but rather whether the specific wrapper has been
modified.

Closes GH-6183.
2020-09-22 16:11:35 +02:00
Christoph M. Becker
d893404fb9 Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Fix #79423: copy command is limited to size of file it can copy
2020-09-22 13:19:06 +02:00
Christoph M. Becker
f445e9cb93 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79423: copy command is limited to size of file it can copy
2020-09-22 13:16:59 +02:00
Christoph M. Becker
4000780b3d Fix #79423: copy command is limited to size of file it can copy
Passing `NULL` as `lpFileSizeHigh` to `GetFileSize()` gives wrong
results for files larger than 0xFFFFFFFF bytes.  We fix this by using
`GetFileSizeEx()`, and let the mapping fail, if the file size is too
large for the architecture.

Closes GH-5319.
2020-09-22 13:15:07 +02:00
Christoph M. Becker
3e33e1e86d Check linker compatibility directly from HMODULE
Checking the linker compatibility with extranous `ImageLoad()` calls is
possible, but unnecessary, since the modules are either already loaded
or loaded shortly afterwards, so that we can get the required
information directly from the module handles.  And actually, doing
`ImageLoad()` as well as `LoadLibrary()` leaves a tiny room for a race
condition, because both functions will lookup the module in the search
path, so there is no *guarantee* that both are dealing with the same
module.  Dropping the `ImageLoad()` calls also has the advantage to no
longer face the issue reported in bug #79557.  A very minor additional
advantage is that we no longer have to link against Imagehlp.dll.

Furthermore, there is no need to check for CRT compatibility multiple
times, so we can simplify the signature of `php_win32_crt_compatible`,
and at the same time clean up main.c a bit.

These changes require to change the signature of the exported
`php_win32_image_compatible` and `php_win32_crt_compatible` functions,
which now expect a `HMODULE` and nothing, respectively, instead of the
module name.
2020-09-21 16:25:31 +02:00
Christoph M. Becker
6fa2493789 Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Fix mmap copying
2020-09-21 16:09:17 +02:00
Christoph M. Becker
19c844594e Fix mmap copying
Instead of attempting to map large files into memory at once, we map
chunks of at most `PHP_STREAM_MMAP_MAX` bytes, and repeat that until we
hit the point where `php_stream_seek()` fails (see bug 54902), and copy
the rest of the file by reading and writing small chunks.

We also fix the mapping behavior for zero bytes on Windows, which did
not error (as with `mmap()`), but would have mapped the remaining file.
2020-09-21 16:07:57 +02:00
Sammy Kaye Powers
12306728c5
Add system ID entropy API
The `zend_system_id` is a (true global) system ID that fingerprints a process state. When extensions add engine hooks during MINIT/startup, entropy is added the system ID for each hook. This allows extensions to identify that changes have been made to the engine since the last PHP process restart.

Closes GH-5871
2020-09-18 14:26:44 -07:00
Máté Kocsis
46d22e435f
Change int parameter types to bool when the parameter behaves as bool
Closes GH-6148
2020-09-17 09:38:18 +02:00
Christoph M. Becker
edddddcea8 7.3.24 is next 2020-09-15 10:51:41 +02:00
Nikita Popov
ec3f3002cd Fix observer leak
Make sure to startup observer infrastructure before we register
the first observer...
2020-09-15 10:41:19 +02:00
Benjamin Eberlei
1359a52d5b Rename zend_error_notify APIs to zend_observer_error* 2020-09-14 19:29:14 +02:00
Christoph M. Becker
4d86000541 Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Fix #80067: Omitting the port in bindto setting errors
2020-09-11 14:49:07 +02:00
Christoph M. Becker
e41867888a Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80067: Omitting the port in bindto setting errors
2020-09-11 14:46:51 +02:00
Christoph M. Becker
dfb3a79914 Fix #80067: Omitting the port in bindto setting errors
A recent commit[1] which fixed a memory leak introduced a regression
regarding the formerly liberal handling of IP addresses to bind to.  We
fix this by reverting that commit, and fix the memory leak where it
actually occurs.  In other words, this fix is less intrusive than the
former fix.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=0b8c83f5936581942715d14883cdebddc18bad30>

Closes GH-6104.
2020-09-11 14:44:12 +02:00
twosee
bd1d11d352 Simplify error type filter
Closes GH-6049.
2020-09-10 17:36:04 +08:00
Dmitry Stogov
4a2ae84188 Add "const". Move constant strings to read-only memory. 2020-09-07 21:35:48 +03:00
Christoph M. Becker
c7cba01b88 Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Fix #80048: Bug #69100 has not been fixed for Windows
2020-09-03 15:46:30 +02:00
Christoph M. Becker
2f4a2a9316 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80048: Bug #69100 has not been fixed for Windows
2020-09-03 15:45:33 +02:00
Christoph M. Becker
1848ccdae2 Fix #80048: Bug #69100 has not been fixed for Windows
We fix the erroneous length calculation on Windows, too.

Closes GH-6067.
2020-09-03 15:43:19 +02:00
Levi Morrison
66c3e900e2 Add zend_observer API
Closes GH-5857.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
Co-authored-by: Sammy Powers <sammyk@datadoghq.com>
2020-09-01 09:59:59 -06:00
Nikita Popov
2c15c9ce80 Rehash function table after disabling functions
To perform fast shutdown without full table cleanup we need all
internal functions to be in one continuous chunk. This was
violated when functions were deleted via disable_functions.

This drops the zend_disable_function() API in favor of
zend_disable_functions(), which disables the given list of
functions and performs the necessary rehash afterwards.

Also drop PG(disabled_functions), which is no longer used.
2020-08-28 16:50:07 +02: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
George Peter Banyard
1b2ec73c1d Drop various unused macros/APIs
Also convert_libmagic_pattern() to return a zend_string*

Closes GH-6029
2020-08-26 12:59:43 +02:00
Christoph M. Becker
ff14b7adad 7.3.23 is next 2020-08-18 09:55:37 +02:00
Derick Rethans
499bf91cd0 Prepare for 7.4.11 2020-08-18 08:06:20 +01:00
Nikita Popov
824541d57e Disable report_zend_debug by default
We might just want to drop this completely, but at least don't
enable it by default. It already gets disabled by a number of
SAPIs, but we should make that the default state.
2020-08-12 10:36:40 +02:00
Nikita Popov
7c3e487289 Fixed bug #65275
Make EG(exit_status) the single source of truth for the exit status,
instead of having two variables that we cannot really keep
synchronized.
2020-08-10 12:40:26 +02:00
Nikita Popov
896dad4c79 Fixed bug #77561
Unconditionally strip shebang lines when using the CLI SAPI,
independently of whether they occur in the primary or non-primary
script. It's unlikely that someone intentionally wants to print
that shebang line when including a script, and this regularly
causes issues when scripts are used in multiple contexts, e.g.
for direct invocation and as a phar bootstrap.
2020-08-10 10:38:33 +02:00
Máté Kocsis
af80d8a14e
Add more argument types to stubs
Closes GH-5943
2020-08-07 12:35:30 +02:00
Nikita Popov
2965c8f868 Prefer strtoll over atoll
Both are specified by C99, but strtoll has specified overflow
behavior while atoll does not, so prefer using it.
2020-08-05 18:40:23 +02:00
Nikita Popov
52047addc7 Only force log startup errors if display_startup_errors disabled
Otherwise this results in duplicate errors.

Closes GH-5941.
2020-08-05 18:17:00 +02:00
Nikita Popov
4cc4f9c00a Use standard types in fopencookie test
Instead of internal __size_t / __off64_t types use ssize_t and off64_t.
This makes it work on musl as well.
2020-08-05 10:39:37 +02:00
Nikita Popov
b0d139456a Use standard types in fopencookie test
Instead of internal __size_t / __off64_t types use ssize_t and off64_t.
This makes it work on musl as well.
2020-08-05 09:45:51 +02:00
Gabriel Caruso
7479ab9f80 Update API version numbers
In preparation for PHP 8.0.
2020-08-04 22:25:28 +02:00
Nikita Popov
0d836a39a7 Revert "Prepare for PHP 8.1"
This reverts commit 1ab4d0e6b7.
This reverts commit a359635cb1.
2020-08-04 22:24:44 +02:00
Gabriel Caruso
a359635cb1
Prepare for PHP 8.1 2020-08-04 18:46:14 +02:00
Gabriel Caruso
1ab4d0e6b7
Update API version numbers
In preparation for PHP 8.0.
2020-08-04 18:07:16 +02:00
Remi Collet
6b8ffdbdeb bump version to 7.2.34-dev 2020-08-04 09:55:29 +02:00
George Peter Banyard
c3105a1f8d ValueError for empty path in stream code
Closes GH-5902
2020-07-31 13:39:58 +01:00
twosee
ab9d10d023 Merge branch 'PHP-7.4'
* PHP-7.4:
  Handle bindto error
2020-07-29 17:48:01 +08:00
twosee
12bd3cc146 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Handle bindto error
2020-07-29 17:46:57 +08:00
twosee
0b8c83f593 Handle bindto error
Closes GH-5903.
2020-07-29 17:46:27 +08:00
George Peter Banyard
73e070a614 Refactor user streams to use ZPP class check
Closes GH-5876
2020-07-28 17:12:40 +01:00
Derick Rethans
877a351ea8 PHP-7.4 is 7.4.10-dev now 2020-07-26 10:08:52 +01:00
Tyson Andre
07db64156e [RFC] Make string length for getTraceAsString() configurable
Add a `zend.exception_string_param_max_len` ini setting.
(same suffix as `log_errors_max_len`)

Allow values between 0 and 1000000 bytes.
For example, with zend.exception_string_param_max_len=0,
"" would represent the empty string, and "..." would represent something
longer than the empty string.
Previously, this was hardcoded as exactly 15 bytes.

Discussion: https://externals.io/message/110717

Closes GH-5769
2020-07-25 09:50:57 -04:00
Nikita Popov
a1ab7bbc3a Simplify user_stream_create_object 2020-07-23 16:20:25 +02:00
Christoph M. Becker
fc4d462e94 Fix #78236: convert error on receiving variables when duplicate [
When an input variable name contains a non matched open bracket, we not
only have to replace that with an underscore, but also all following
forbidden characters.
2020-07-23 15:48:09 +02:00
Nikita Popov
93594862f4 Remove no longer needed stdint compatibility defines
Closes GH-5886.
2020-07-23 13:00:04 +02:00
twosee
6e92487f66 Fix warnings of strict-prototypes
Closes GH-5887.
2020-07-23 00:59:00 +08:00
Christoph M. Becker
2c0a6977dd 7.3 is now 7.3.22-dev 2020-07-21 09:18:07 +02:00
Benjamin Eberlei
6c8b94eb42 Introduce error notification callbacks that are run independant of zend_error_cb 2020-07-17 15:08:11 +02:00
Martin Schröder
547d98b81d Support socketpairs in proc_open()
Closes GH-5777.
2020-07-14 10:35:45 +02:00
Máté Kocsis
d30cd7d7e7
Review the usage of apostrophes in error messages
Closes GH-5590
2020-07-10 21:05:28 +02:00
Nikita Popov
302933daea Remove no_separation flag 2020-07-07 09:30:24 +02:00
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Nikita Popov
0280b83e11 Avoid some unnecessary uses of no_separation=0
For the rare cases where references are part of the API,
construct them explicitly. Otherwise do not allow separation.
2020-07-06 19:05:57 +02:00
Christoph M. Becker
2ecb4680ad Update php_version.h
That has apparently been overlooked.
2020-07-02 15:30:13 +02:00
Christoph M. Becker
43b5d58341 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79756: finfo_file crash (FILEINFO_MIME)
2020-06-29 17:47:21 +02:00
Christoph M. Becker
dfac28f8d8 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79756: finfo_file crash (FILEINFO_MIME)
2020-06-29 17:46:46 +02:00
Christoph M. Becker
816b4c1235 Fix #79756: finfo_file crash (FILEINFO_MIME)
If `ctime` or `asctime` return `NULL`, we must not attempt to copy the
buffer, but rather return `NULL` as well.
2020-06-29 17:45:28 +02:00
Nikita Popov
afafe5443c Clear last error before shutting down memory manager
The last error is allocated using ZMM, make sure it's cleared
beforehand.

It would probably be better to allocate it persistently outside
of requests.
2020-06-26 09:30:08 +02:00
Alex Dowad
e673c63989 Correct comment in plain_wrapper.c (refers to microseconds, not milliseconds) 2020-06-24 22:26:00 +02:00
Christoph M. Becker
91982bad63 7.3 is now 7.3.21-dev 2020-06-23 10:29:42 +02:00
Christoph M. Becker
34ede22fd8 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix possibly unsupported timercmp() usage
2020-06-09 16:56:35 +02:00
Christoph M. Becker
3c12c41927 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix possibly unsupported timercmp() usage
2020-06-09 16:54:43 +02:00
Christoph M. Becker
7ac0fb5ae4 Fix possibly unsupported timercmp() usage
The `timercmp()` manpage[1] points out that some systems have a broken
implementation which does not support `>=`.  This is definitely the
case for the Windows SDK, which only supports `<` and `>`.

[1] <https://linux.die.net/man/3/timercmp>
2020-06-09 16:52:19 +02:00
George Peter Banyard
c14371ef7b Fix incorrect zend_bool usage for display_errors 2020-06-09 11:43:37 +02:00
twosee
83a77015ad Add helper APIs for maybe-interned string creation
Add ZVAL_CHAR/RETVAL_CHAR/RETURN_CHAR as a shortcut for using
ZVAL_INTERNED_STRING and ZSTR_CHAR.

Add zend_string_init_fast() as a helper for the empty string /
one char interned string / zend_string_init() pattern.

Also add corresponding ZVAL_STRINGL_FAST etc macros.

Closes GH-5684.
2020-06-08 15:31:52 +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
6260bc218f Remove duplicate zend_try
Closes GH-5672.
2020-06-07 10:37:14 +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
Nikita Popov
e949f306be Fixed bug #72089: Throw Error on require failure
It should be noted that we still throw the usual fopen warnings,
but the final fatal error becomes an Error exception. Combine
with @ to suppress FS warnings.

Closes GH-5641.
2020-06-05 09:46:39 +02:00
Daniel Ruf
cf513c2dc8 Fix small typo in comment 2020-05-31 15:03:09 +02:00
Christoph M. Becker
c249f593ef 7.3.20 will be next 2020-05-26 10:53:22 +02:00
Christoph M. Becker
c4badcbec4 Bump version
Seems that has been forgotten.
2020-05-19 17:24:18 +02:00
Christoph M. Becker
5a17694304 Merge branch 'PHP-7.4'
* PHP-7.4:
  Check compatibility with proper runtime DLL
2020-05-14 15:59:34 +02:00
Christoph M. Becker
bfcee2c746 Check compatibility with proper runtime DLL
In practise, this likely does not matter, because usually these DLLs
are installed side by side, but still we should check the proper DLL.
2020-05-14 15:57:55 +02:00
George Peter Banyard
8e66d22f7e Fix [-Wundef] warning in streams implementation 2020-05-12 22:01:20 +02:00
George Peter Banyard
1df3f97c21 Fix [-Wundef] warning in main folder 2020-05-12 22:01:00 +02:00
Remi Collet
4cf8be71df bump version to 7.2.32-dev 2020-05-12 09:16:01 +02:00
Stanislav Malyshev
c317c420b0 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78876: Long variables cause OOM and temp files are not cleaned
  Fix #78875: Long filenames cause OOM and temp files are not cleaned
  Update NEWS for 7.2.31
  Update CREDITS for PHP 7.2.30
  Update NEWS for PHP 7.2.30
2020-05-11 14:21:25 -07:00
Stanislav Malyshev
355e36e4f6 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78876: Long variables cause OOM and temp files are not cleaned
  Fix #78875: Long filenames cause OOM and temp files are not cleaned
  Update NEWS for 7.2.31
  Update CREDITS for PHP 7.2.30
  Update NEWS for PHP 7.2.30
2020-05-11 14:20:47 -07:00
Stanislav Malyshev
f43041250f Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78876: Long variables cause OOM and temp files are not cleaned
  Fix #78875: Long filenames cause OOM and temp files are not cleaned
  Update NEWS for 7.2.31
  Update CREDITS for PHP 7.2.30
  Update NEWS for PHP 7.2.30
2020-05-11 14:20:41 -07:00
Christoph M. Becker
3c8582ca4b Fix #78876: Long variables cause OOM and temp files are not cleaned
We use the proper type for size calculations, which is `size_t`.
2020-05-11 13:48:40 -07:00
Christoph M. Becker
1c9bd513ac Fix #78875: Long filenames cause OOM and temp files are not cleaned
We must not cast `size_t` to `int` (unless the `size_t` value is
guaranteed to be less than or equal to `INT_MAX`).  In this case we can
declare `array_len` as `size_t` in the first place.
2020-05-11 13:47:38 -07:00
Nikita Popov
89b4a46d56 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix default sendmail path when not found during build
2020-05-11 10:46:07 +02:00
Nikita Popov
d050d74477 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix default sendmail path when not found during build
2020-05-11 10:46:00 +02:00
Indrek Ardel
517431892b Fix default sendmail path when not found during build
Closes GH-5548.
2020-05-11 10:45:23 +02:00
Máté Kocsis
4a816584a4
Make float to string casts locale-independent
From now on, float to string casting will always behave locale-independently.
RFC: https://wiki.php.net/rfc/locale_independent_float_to_string
Closes GH-5224

Co-authored-by: George Peter Banyard <girgias@php.net>
2020-05-08 10:52:23 +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
Christoph M. Becker
69888c3ff1 Fix #79467: data:// wrappers are writable
Despite the docs claiming that data: wrappers would not be writable[1],
they are implemented as writing to a memory stream.  That does not seem
to be particularly sensible, so we disallow writing altogether.

[1] <https://www.php.net/manual/en/wrappers.data.php#refsect1-wrappers.data-options>
2020-05-03 12:19:37 +02:00
Nikita Popov
c4ad8beaa8 Do not inherit LC_CTYPE locale from environment
Treatment of locales in PHP is currently inconsistent: The LC_ALL
locale is set to "C", as is standard behavior on program startup.
The LC_CTYPE locale is set to "", which will inherit it from the
environment. However, the inherited LC_CTYPE locale will only be
used in some cases, while in other cases it is necessary to perform
an explicit setlocale() call in PHP first. This is the case for
the locale-sensitive handling in the PCRE extension.

Make things consistent by *never* inheriting any locales from the
environment. LC_ALL, including LC_CTYPE will be "C" on startup.
A locale can be set or inherited through an explicit setlocale()
call, at which point the behavior will be fully consistent and
predictable.

Closes GH-5488.
2020-04-30 10:22:51 +02:00
Alex Dowad
8ddaf13ed3 Code tweaks: Remove unneeded semicolons 2020-04-29 23:17:40 +02:00
Christoph M. Becker
6998cc5029 Bump version 2020-04-28 09:10:50 +02:00
Nikita Popov
41c7d28c11 Add macro to get ini target address 2020-04-27 10:30:00 +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
dinosaur
13842eda37 Fixed bug #79468
Close the stream filter resources when removing them from the stream.
2020-04-14 10:27:28 -04:00
Nikita Popov
56d30bb35a Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #79468
2020-04-14 12:02:22 +02:00
Nikita Popov
ef56b2c977 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79468
2020-04-14 12:01:51 +02:00
dinosaur
95eaccd0bb Fixed bug #79468
Close the stream filter resources when removing them from the stream.
2020-04-14 11:59:51 +02:00
Nikita Popov
78d3af4529 Make sure php_get_internal_encoding() returns non-empty
Even if default_charset is set to "", we should still return
"UTF-8" as the default value here. Setting default_charset to ""
suppresses the header emission, but shouldn't change anything
about our encoding defaults.
2020-03-31 11:06:15 +02:00
Christoph M. Becker
33226c3a17 Next is 7.3.18 2020-03-31 10:22:55 +02:00
Nikita Popov
e8e09b60b4 Remove rand_r implementation
We already use our own mt13397 implementation nowadays, so we no
longer need this shim.
2020-03-26 11:49:27 +01:00
Remi Collet
3072b77c21 bump verison to 7.2.30-dev 2020-03-17 11:28:34 +01:00
Christoph M. Becker
f078bca729 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78210: Invalid pointer address
2020-03-11 11:32:46 +01:00
Christoph M. Becker
8657f03084 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78210: Invalid pointer address
2020-03-11 11:31:26 +01:00
Christoph M. Becker
53797c206a Fix #78210: Invalid pointer address
This is actually about three distinct issues:

* If an empty string is passed as $address to `stream_socket_sendto()`,
  the `sa` is not initialized, so we must not pass it as `addr` to
  `php_stream_xport_sendto()`.

* On POSIX, `recvfrom()` truncates messages which are too long to fit
  into the specified buffer (unless `MSG_PEEK` is given), discards the
  excessive bytes, and returns the buffer length.  On Windows, the same
  happens, but `recvfrom()` returns `SOCKET_ERROR` with the error code
  `WSAEMSGSIZE`.  We have to catch this for best POSIX compatibility.

* In `php_network_parse_network_address_with_port()`, we have to zero
  `in6` (not only its alias `sa`) to properly support IPv6.

Co-Authored-By: Nikita Popov <nikita.ppv@googlemail.com>
2020-03-11 11:30:15 +01:00
Christoph M. Becker
02beefd5af PHP-7.4 is now 7.4.5-dev 2020-03-06 17:49:55 +01:00
Nikita Popov
941a3b6ccd Remove unnecessary uses of CHECK_SILENT
If no error is passed, it is always silent.
2020-03-06 16:36:45 +01:00
Christoph M. Becker
9dda3b9eb2 Next is 7.3.17 2020-03-03 10:19:31 +01:00
Nikita Popov
84854a72c7 Remove mergesort implementation
php_mergesort() isn't being used for anything, and hasn't been for
a long time. Even if we wanted to use a stable sort, this isn't
the implementation we'd use...
2020-02-27 10:36:01 +01:00
Bishop Bettini
fb57ae9084 Improve comment on RFC 1867 filename handling
It was pointed out on the internals ML[1] that the basename comment
around RFC 1867 file handling was confusing. The comment seemed to
say that the basename handling was only necessary because of some
esoteric bug in Windows IE. In fact that comment applied to earlier
versions of the code and was, therefore, misleading. The comment
needs to clear that basename is required per RFC 7578[2].

[1]:https://externals.io/message/108624
[2]:https://tools.ietf.org/html/rfc7578
2020-02-19 11:30:32 -05:00
Remi Collet
63f6608f89 bump version to 7.2.29 2020-02-18 11:00:28 +01:00
Christoph M. Becker
69819baee3 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79254: getenv() w/o arguments not showing changes
2020-02-11 12:08:25 +01:00
Christoph M. Becker
93b183ed55 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79254: getenv() w/o arguments not showing changes
2020-02-11 11:57:57 +01:00
Christoph M. Becker
7b464ce6f3 Fix #79254: getenv() w/o arguments not showing changes
To be able to see changes done only with `SetEnvironmentVariable()`, we
have to use `GetEnvironmentStrings()` instead of `environ`, because the
latter sees only changes done with `putenv()`.

For best backward compatibility we're using `GetEnvironmentStringsA()`;
switching to the wide string version likely makes sense for master,
though.
2020-02-11 11:47:29 +01:00
George Peter Banyard
b3f17ea5d5 Promote invalid mode/unknow option from Warning to ValueError for plain streams.
Closes GH-5076
2020-02-04 22:25:43 +01:00
Christoph M. Becker
e3632fdc0d Next is 7.3.16 2020-02-04 11:38:29 +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
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
Nikita Popov
a2e4392439 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #78902
  Add unit test for bug #78902
2020-01-23 14:58:15 +01:00
Nikita Popov
6489e29831 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #78902
  Add unit test for bug #78902
2020-01-23 14:58:10 +01:00
liudaixiao
67421a780d Fixed bug #78902 2020-01-23 14:57:16 +01:00
George Peter Banyard
2b5fb76de6 Apply custom format/length modifier removal to spprintf
This mimicks the changes made to the custom snprintf implementation
by removing the custom 'v' format and custom 'I' length modifier
from the spprintf implementation.

Closes GH-5108
2020-01-23 13:45:28 +01:00
Remi Collet
7e2bd95fa5 next will be 7.2.28 2020-01-22 09:17:00 +01:00
George Peter Banyard
13178087c7 Drop the custom 'v' format from snprintf custom implementation.
Extensions should instead use the standard 's' format.

Closes GH-5100
2020-01-21 13:18:13 +01:00
George Peter Banyard
aaa1f90e3f Drop the custom I length modifier from snprintf custom implementation.
Extensions should rather use the ZEND_LONG_FMT, ZEND_ULONG_FMT and
ZEND_XLONG_FMT macros defined in php-src/Zend/zend_long.h

Closes GH-5089
2020-01-20 23:03:10 +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
Nikita Popov
018251a7c4 Fixed bug #71876
This is a backport of fcdc0a6db0
to the PHP-7.3 branch. We need to make sure that OnUpdateString
is also called for a NULL value, otherwise the reset of the encoding
at the end of the request will not work.

I believe I already tried to land this before once, but it didn't
actually end up on the PHP-7.3 branch due to a push conflict that
I only noticed just now.
2020-01-17 09:47:31 +01:00
Máté Kocsis
0b4778c377
Fix #78880: Another bunch of spelling errors 2020-01-16 09:46:47 +01:00
Christoph M. Becker
7ea4f0e47e Bump version 2020-01-08 18:26:14 +01:00
Christoph M. Becker
38c0a53b60 Bump version 2020-01-07 11:03:19 +01:00
Nikita Popov
3262c28d5c Merge branch 'PHP-7.4'
* PHP-7.4:
  Also propagate include exceptions in opcache
  Make url_stats in resolve_path quiet
2019-12-30 23:22:39 +01:00
Nikita Popov
003be875e4 Make url_stats in resolve_path quiet
These stats are used to check whether the file exists -- they
should not generate errors. Having the flag set is particularly
important for custom stream wrappers.
2019-12-30 23:22:26 +01:00
Nikita Popov
d5c886ab7d Merge branch 'PHP-7.4'
* PHP-7.4:
  Properly propagate url_stat exceptions during include
2019-12-30 22:57:07 +01:00
Nikita Popov
f77747b06c Properly propagate url_stat exceptions during include
Make sure we abort operations early, and that we don't emit
additional warnings or errors if an exception has been thrown.
2019-12-30 22:56:42 +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
388c582ee9 Clarify usage of max_fd in php_poll2() on Windows
Actually, `max_fd` is not used on Windows, since `PHP_SAFE_MAX_FD` and
`select` ignore it; so it makes no sense to calculate it in the loop.
Even worse, since `php_socket_t` is unsigned on Windows, it will never
be modified during the loop, because `SOCK_ERR` is already the largest
representable value of that type.

Therefore we skip the loop on Windows, and add a clarifying comment.
2019-12-27 13:41:29 +01:00