Commit Graph

127646 Commits

Author SHA1 Message Date
Christoph M. Becker
aef7d810d3
Fix GH-9949: Partial content on incomplete POST request
`ap_get_brigade()` may fail for different reasons, and we must not
pretend that a partially read POST payload is fine; instead we report
a content length of zero what matches all other `read_post()` callbacks
of bundled SAPIs.

Closes GH-10059.
2022-12-13 15:21:42 +01:00
Alex Dowad
a1a69c3734 Support Microsoft's "Best Fit" mappings for Windows-1252 text encoding
In b5ff87ca71, I made a number of adjustments to our conversion code
for CP1252. One of the adjustments was to make the mappings match those
published by the Unicode Consortium in the file CP1252.TXT. These do
not include mappings for the CP1252 bytes 0x81, 0x8D, 0x8F, 0x90, and
0x9D.

Rostyslav Gulka reported that this caused a problem. His application
stores binary JPEG data in an MS-SQL database. When they SELECT the
binary data out of the database, it is treated as CP1252 text and
automatically converted to UTF-8. To recover the original binary
data, they then do a conversion from UTF-8 to CP1252.

Obviously, that does not work if certain CP1252 bytes do not map to
any Unicode codepoint at all.

While this is a very unusual application of text encoding conversion,
and we might choose not to support it if there was no other basis for
including those mappings, it seems that Microsoft does actually include
them in the Win32 API as "best fit" mappings. These are extra mappings
from Unicode to other text encodings, which the Win32 API function
WideCharToMultiByte uses by default unless the WC_NO_BEST_FIT_CHARS
flag was passed.

A list of these "best fit" mappings for CP1252 can be found here:

https://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit1252.txt
2022-12-09 15:18:37 +02:00
Daniel Black
c21a5920ac
ext/mysqli tests "using password" optional in error messages (part 2)
Like GH-10035 for ext/mysqli/tests/mysqli_connect.phpt test.

Closes GH-10064.
2022-12-08 14:23:33 +01:00
Ben Ramsey
696bb385df
PHP-8.1 is now for PHP 8.1.15-dev 2022-12-07 11:29:37 -06:00
Christoph M. Becker
2f6b9e6c63
Fix #81742: open_basedir bypass in SQLite3 by using file URI
A previous fix[1] was not sufficient to catch all potential file URIs,
because the patch did not cater to URL encoding.  Properly parsing and
decoding the URI may yield a different result than the handling of
SQLite3, so we play it safe, and reject any file URIs if open_basedir
is configured.

[1] <https://bugs.php.net/bug.php?id=77967>

Closes GH-10018.
2022-12-06 15:59:52 +01:00
Daniel Black
b6b4a628a5
ext/mysqli tests "using password" optional in error messages
Closes GH-10035.
2022-12-05 13:12:23 +01:00
Arnaud Le Blanc
adc23828b4
Fallback to first line of function when ex->opline is NULL (#10003)
ex->opline can be null due to missing SAVE_OPLINE() in the VM

Fixes GH-9933
2022-12-02 17:21:30 +01:00
George Peter Banyard
608ddb0321
Fix GH-10011 (Trampoline autoloader will get reregistered and cannot be unregistered)
There are two issues to resolve:
 1. The FCC is not refetch when trying to unregister a trampoline
 2. Comparing the function pointer of trampolines is meaningless as they are reallocated, thus we need to compare the name of the function

Found while working on GH-8294

Closes GH-10033
2022-12-02 12:47:25 +00:00
蝦米
93592ea743
Fix GH-9769: Misleading error message for unpacking of objects
Only arrays can be unpacked in constant expressions.

Closes GH-9776.
2022-12-02 13:10:59 +01:00
Derick Rethans
29f0f4edd2 Merge branch 'regression-tzid-with-numbers' into PHP-8.1 2022-12-01 10:59:01 +00:00
Derick Rethans
c87c803b96 Some (old, backwards compatible) TZIDs can have numbers in them 2022-12-01 10:58:37 +00:00
Derick Rethans
64f5f5333e Merge remote-tracking branch 'derickr/timelib-2021.18' into PHP-8.1 2022-11-30 15:53:52 +00:00
Derick Rethans
d021851171 Fixed GH-9699, GH-9866, and GH-9880 (problems with diff); and GH-9700 (greedy tzid parsing) 2022-11-30 15:47:43 +00:00
Derick Rethans
818b46acb0 Import timelib 2021.18 2022-11-30 15:42:11 +00:00
Christoph M. Becker
44377c3c70
Fix GH-9971: Incorrect NUMERIC value returned from PDO_Firebird
Dialect 1 databases store and transfer `NUMERIC(15,2)` values as
doubles, which we need to cater to in `firebird_stmt_get_col()` to
avoid `ZEND_ASSUME(0)` to ever be triggered, since that may result
in undefined behavior.

Since adding a regression test would require to create a dialect 1
database, we go without it.

Closes GH-10021.
2022-11-30 12:11:42 +01:00
Derick Rethans
bcc00304c7 Updated to version 2022.7 (2022g) 2022-11-29 18:25:15 +00:00
Jakub Zelenka
500b28ad04
Fix GH-10000: Test failures when OpenSSL compiled with no-dsa 2022-11-25 14:02:03 +00:00
Arnaud Le Blanc
4987e65a70 [ci skip] NEWS 2022-11-25 14:07:30 +01:00
Arnaud Le Blanc
91b3b58f71
Do not resolve constants on non-linked class during preloading (#9975)
Fixes GH-9968
2022-11-25 14:02:45 +01:00
Jakub Zelenka
ce57221376 Fix GH-9064: PHP fails to build if openssl was built with no-ec 2022-11-25 12:49:12 +00:00
Jakub Zelenka
9416186ff1
Add a note to php.ini-* regarding the required order for GH-8620 2022-11-24 11:54:15 +00:00
Jakub Zelenka
c9c1934ff0
Fix GH-8517: FPM child pointer can be potentially uninitialized
There might be a moment when the child log event is executed after
freeing a child. That could possibly happen if the child output is
triggered at the same as the terminating of the child. Then the output
event could be potentially processed after the terminating event which
would cause this kind of issue.

The issue might got more visible after introducing the log_stream on
a child because it is more likely that this cannot be dereferenced
after free. However it is very hard to reproduce this issue so there
is no test for this.

The fix basically prevents passing a child pointer and instead passes
the child PID and then looks the child up by the PID when it is being
processed. This is obviously slower but it is a safe way to do it and
the slow down should not be hopefully visible in a way that it would
overload a master process.
2022-11-23 11:25:51 +00:00
Jakub Zelenka
1767f32cb6
[ci skip] Fix NEWS FPM entries 2022-11-22 18:47:24 +00:00
Jakub Zelenka
5a4520bc2b
Fix bug #68207: Setting fastcgi.error_header can result in a WARNING 2022-11-22 18:17:16 +00:00
Jakub Zelenka
31b20f1737
Merge branch 'PHP-8.0' into PHP-8.1 2022-11-22 18:02:11 +00:00
Petr Sumbera
72da2b02e2
php-fpm: fix Solaris port events.mechanism
Closes GH-9959.
2022-11-22 18:01:15 +00:00
George Peter Banyard
6fbf81c674
Fix GH-9883 SplFileObject::__toString() reads next line
We need to overwrite the __toString magic method for SplFileObject, similarly to how DirectoryIterator overwrites it
Moreover, the custom cast handler is useless as we define __toString methods, so use the standard one instead.

Closes GH-9912
2022-11-22 12:21:14 +00:00
George Wang
aee1a2f4c0 Merge branch 'PHP-8.0' into PHP-8.1 2022-11-20 19:30:25 -05:00
George Wang
4bdfce6c1a Use __atomic_xxxx() instead of __sync_xxxx() for lsapi. 2022-11-20 19:30:07 -05:00
Christoph M. Becker
2d94ee5f20
Avoid undefined behavior in Windows ftok(3) emulation
`.nFileIndexHigh` is a unsigned 32bit number.  Casting that to `__int64`
and shifting left by 32bits triggers undefined behavior if the most
significant bit of `.nFileIndexHigh` is set.  We could avoid that by
casting to `(__uint64)`, but in that case the whole clause doesn't have
an effect anymore, so we drop it altogether.

Closes GH-9958.
2022-11-18 14:37:00 +01:00
Michael Voříšek
8d65c2fee5
Fix GH-9650: Can't initialize heap: [0x000001e7]
Closes GH-9721.
2022-11-17 14:16:10 +01:00
Ilija Tovilo
c53b065c48
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Add wordpress to community build
2022-11-17 11:34:08 +01:00
Ilija Tovilo
cdc0a8b06b
Add wordpress to community build
Closes GH-9942
2022-11-17 11:33:19 +01:00
David Carlier
a4298c14c1 Fix GH-9932: Discards further characters for session name.
As those are converted, it s better to make aware of the code caller of the naming inadequacy.
Closes GH-9940.
2022-11-15 12:27:44 +00:00
Dmitry Stogov
a8bd342397 Fix memory leak
Fizes oss-fuzz #53143
2022-11-14 12:35:09 +03:00
Jakub Zelenka
b8c1b5e9fa Merge branch 'PHP-8.0' into PHP-8.1 2022-11-13 19:06:10 +00:00
Jakub Zelenka
db2d32f476 Introduce TEST_FPM_EXTENSION_DIR for FPM tests with shared extensions 2022-11-13 19:04:43 +00:00
Alex Dowad
1562ba5b71 [ci skip] NEWS 2022-11-13 14:40:45 +02:00
NathanFreeman
fa0401b0b5 Fix GH-9535 (unintended behavior change for mb_strcut in PHP 8.1)
The existing implementation of mb_strcut extracts part of a
multi-byte encoded string by pulling out raw bytes and then running
them through a conversion filter to ensure that the output is valid
in the requested encoding.

If the conversion filter emits error markers when doing the final
'flush' operation which ends the conversion of the extracted bytes,
these error markers may (in some cases) be included in the output.
The conversion operation does not respect the value of
mb_substitute_character; rather, it always uses '?' as an error marker.
So this issue manifests itself as unwanted '?' characters being
inserted into the output.

This issue has existed for a long time, but became noticeable in PHP
8.1 because for at least some of the supported text encodings, mbstring
is now more strict about emitting error markers when strings end in an
illegal state.

The simplest fix is to suppress error markers during the final flush
operation.

While working on a fix for this problem, another problem with mb_strcut
was discovered; since it decides when to stop consuming bytes from
the input by looking at the byte length of its OUTPUT, anything which
causes extra bytes to be emitted to the output may cause mb_strcut to
not consume all the bytes in the requested range.

The one case where we DO emit extra output bytes is for encodings
which have a selectable mode, like ISO-2022-JP; if a string in such
an encoding ends in a mode which is not the default, we emit an ending
escape sequence which changes back to the default mode. This is done
so that concatenating strings in such encodings is safe.

However, as mentioned, this can cause the output of mb_strcut to be
shorter than it logically should be. This bug has existed for a long
time, and fixing it now will be a BC break, so we may not fix it right
away.

Therefore, tests for THIS fix which don't pass because of that OTHER
bug have been split out into a separate test file (gh9535b.phpt), and
that file has been marked XFAIL.
2022-11-13 14:37:55 +02:00
Arnaud Le Blanc
73583bb8c0 [ci skip] NEWS 2022-11-13 11:05:12 +01:00
Erki Aring
5ecbb1b39d Fix GH-9298: remove all registered signal handlers in pcntl RSHUTDOWN 2022-11-13 10:57:58 +01:00
Ilija Tovilo
a2dcb0364a
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  [skip ci] Skip function JIT in nightly for ASAN
2022-11-11 19:57:39 +01:00
Ilija Tovilo
da54664186
[skip ci] Skip function JIT in nightly for ASAN
This avoids the 6h timeout.
2022-11-11 19:57:00 +01:00
Ilija Tovilo
bea2dac23c
[skip ci] Backport XFAIL of failing test 2022-11-11 19:46:16 +01:00
Akama Hitoshi
af68beb16a
[ci skip] Fix GH-9918: License information for xxHash is not included in README.REDIST.BINS file
Closes GH-9919.
2022-11-10 12:37:08 +01:00
Christoph M. Becker
b2186ca7c4
Fix GH-9905: constant() behaves inconsistent when class is undefined
Directly referring to a constant of an undefined throws an exception;
there is not much point in `constant()` raising a fatal error in this
case.

Closes GH-9907.
2022-11-09 15:21:50 +01:00
Sara Golemon
e1c52d1a7c Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Bump for 8.0.27
2022-11-08 22:11:39 +00:00
Sara Golemon
ac508301c9
Bump for 8.0.27 2022-11-08 22:10:29 +00:00
Patrick Allaert
540488c74e
PHP-8.1 is now for PHP 8.1.14-dev 2022-11-08 17:57:34 +01:00
Christoph M. Becker
31cdda2440
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Don't skip test on Windows due to missing ext/posix
2022-11-07 15:07:09 +01:00