1
0
mirror of https://github.com/php/php-src.git synced 2026-04-12 10:33:11 +02:00
Commit Graph

13909 Commits

Author SHA1 Message Date
Pierrick Charron
212ebeed68 Making PHP 8.2.0 beta3 2022-08-16 11:23:58 -04:00
twosee
fa83e37e73 [ci skip] Add missing NEWS entry for GH-9324 2022-08-15 23:59:58 +08:00
Tim Düsterhus
b825756317 Update expires format for session cookie (#9304)
* Update expires format for session cookie

see GH-9200
see 15e3fcb468

* Add ext/session/tests/gh9200.phpt
2022-08-12 19:52:04 +02:00
Derick Rethans
15e3fcb468 Fixed GH-9200: setcookie has an obsolete expires date format 2022-08-11 16:27:25 +01:00
Tyson Andre
6a50af2604 Make "{$g{'h'}}" emit fatal error and no incorrect deprecation notice in 8.2 (#9264)
The ast node flag constants ZEND_DIM_ALTERNATIVE_SYNTAX and
ZEND_ENCAPS_VAR_DOLLAR_CURLY_VAR_VAR node have identical values (1<<1),
causing a deprecation notice to be incorrectly emitted before the fatal error
for unsupported syntax.

Fixes GH-9263

Explicitly check for AST_VAR/AST_DIM kind for future compatibility

`AST_PROP`/`AST_METHOD_CALL` and nullsafe variants can also be found in
encapsulated strings - currently they have no flags but they may have flags in
the future. This also clarifies that this deprecation warning can only happen
for AST_VAR/AST_DIM nodes for certain `attr` values.
2022-08-08 19:41:32 -04:00
Christoph M. Becker
d013d94985 Fix GH-9248: Segmentation fault in mb_strimwidth()
We need to initialize the optional argument `trimmarker` with its
default value.

Closes GH-9273.
2022-08-08 18:35:37 +02:00
Christoph M. Becker
ad04345eb3 Fix GH-9244: Segfault with array_multisort + array_shift
After restructuring non-packed arrays, we either need to pack them if
possible, or to rehash them.

Closes GH-9247.
2022-08-05 17:09:54 +02:00
zeriyoshi
19eecf16aa [ci skip] update NEWS
--CGI-- fixes for PHP 8.1 / 8.0
30ed8fb32d
2022-08-06 00:03:57 +09:00
Tim Düsterhus
1cd2d731ef Handle all-zero state in Xoshiro256** (#9250)
- Retry if the CSPRNG generates a zero state.
- Throw ValueError if the user passes a zero state.

Fixes GH-9249
2022-08-05 14:38:57 +02:00
sji
038c451c22 [ci skip] NEWS and UPGRADING for constants in traits (#9251)
see GH-8888
2022-08-04 23:18:50 +02:00
zeriyoshi
30ed8fb32d Merge remote-tracking branch 'upstream/PHP-8.1' 2022-08-05 00:08:36 +09:00
zeriyoshi
2d777466c0 Merge remote-tracking branch 'upstream/PHP-8.0' into PHP-8.1 2022-08-05 00:06:04 +09:00
zeriyoshi
1ce2b56227 [CI skip] update NEWS 2022-08-05 00:05:12 +09:00
Go Kudo
3725717de1 Remove ZEND_DVAL_TO_LVAL_CAST_OK (#9215)
* Remove ZEND_DVAL_TO_LVAL_CAST_OK
As far as I can see, this operation should always use the _slow method, and the results seem to be wrong when ZEND_DVAL_TO_LVAL_CAST_OK is enabled.

* update NEWS
2022-08-04 23:56:19 +09:00
Tim Düsterhus
60ace13f9c Fix undefined behavior of MT_RAND_PHP if range exceeds ZEND_LONG_MAX (#9197)
RAND_RANGE_BADSCALING() invokes undefined behavior when (max - min) >
ZEND_LONG_MAX, because the intermediate `double` might not fit into
`zend_long`.

Fix this by inlining a fixed version of the macro into Mt19937's range()
function. Fixing the macro itself cannot be done in the general case, because
the types of the inputs are not known. Instead of replacing one possibly broken
version with another possibly broken version, the macro is simply left as is
and should be removed in a future version.

The fix itself is simple: Instead of storing the "offset" in a `zend_long`, we
use a `zend_ulong` which is capable of storing the resulting double by
construction. With this fix the implementation of this broken scaling is
effectively identical to the implementation of php_random_range from a data
type perspective, making it easy to verify the correctness.

It was further empirically verified that the broken macro and the fix return
the same results for all possible values of `r` for several distinct pairs of
(min, max).

Fixes GH-9190
Fixes GH-9191
2022-08-03 18:46:36 +02:00
Tim Düsterhus
3331832b04 Add ext/random Exception hierarchy (#9220)
* Add Random\Random{Error,Exception} and Random\BrokenRandomEngineError

* Throw BrokenRandomEngineError

* Throw RandomException on seeding failure

* Throw RandomException when CSPRNG fails

* Remove unused include from ext/random/engine_combinedlcg.c

* Remove unused include from ext/random/engine_secure.c

* Remove unused include from ext/random/random.c

* [ci skip] Add ext/random Exception hierarchy to NEWS

* [ci skip] Add the change of Exception for random_(int|bytes) to UPGRADING
2022-08-02 20:04:28 +02:00
Jakub Zelenka
e5ab9f45d5 Fix bug #65489: glob() basedir check is inconsistent
This removes the inconsistent and incorrectly working open basedir check
on pattern in glob. It means that an empty array will be returned even
if the whole pattern is outside the open basedir restriction.
2022-08-02 18:36:29 +01:00
Tim Düsterhus
db84e44607 Fix PcgOneseq128XslRr64::__construct() definition in random.stub.php (#9235)
* Fix PcgOneseq128XslRr64::__construct() definition in random.stub.php

The second parameter does not actually exist for a Oneseq PCG. It was removed
from the RFC before it went into voting.

* [ci skip] Add PcgOneseq128XslRr64 stub fix to NEWS
2022-08-02 18:54:39 +02:00
Tim Düsterhus
822881b6fe [ci skip] Move the removal of the RuntimeException in ext/random to Beta 3
Didn't realize that Beta 2 was tagged before merging GH-9211 /
54e406cc50.
2022-08-02 17:37:47 +02:00
Tim Düsterhus
54e406cc50 Clean up nested exceptions without value-add in ext/random (#9211)
* Remove exception in Randomizer::shuffleBytes()

The only way that `php_binary_string_shuffle` fails is when the engine itself
fails. With the currently available list of engines we have:

- Mt19937            : Infallible.
- PcgOneseq128XslRr64: Infallible.
- Xoshiro256StarStar : Infallible.
- Secure             : Practically infallible on modern systems.
                       Exception messages were cleaned up in GH-9169.
- User               : Error when returning an empty string.
                       Error when seriously biased (range() fails).
                       And whatever Throwable the userland developer decides to use.

So the existing engines are either infallible or throw an Exception/Error with
a high quality message themselves, making this exception not a value-add and
possibly confusing.

* Remove exception in Randomizer::shuffleArray()

Same reasoning as in the previous commit applies.

* Remove exception in Randomizer::getInt()

Same reasoning as in the previous commit applies.

* Remove exception in Randomizer::nextInt()

Same reasoning as in the previous commit applies, except that it won't throw on
a seriously biased user engine, as `range()` is not used.

* Remove exception in Randomizer::getBytes()

Same reasoning as in the previous commit applies.

* Remove exception in Mt19937::generate()

This implementation is shared across all native engines. Thus the same
reasoning as the previous commits applies, except that the User engine does not
use this method. Thus is only applicable to the Secure engine, which is the
only fallible native engine.

* [ci skip] Add cleanup of Randomizer exceptions to NEWS
2022-08-02 17:29:36 +02:00
Sergey Panteleev
6a7fd48aae [ci skip] Update NEWS for PHP 8.2.0 beta3 2022-08-02 17:00:47 +03:00
Gabriel Caruso
a08ffc7052 [ci-skip] Fix for bug #80047 was included in previous release
We are removing the entry in 8.0.23, as the fix was included
in the 8.0.22 release. Given that an entry already exists, we
are just deleting extra lines.
2022-08-02 10:32:06 +02:00
Arnaud Le Blanc
5d5d9796fc [ci skip] NEWS 2022-08-01 19:34:28 +02:00
Arnaud Le Blanc
832e0ef31f [ci skip] NEWS 2022-08-01 19:32:02 +02:00
Tim Düsterhus
5e518c0552 [ci skip] Move 'Core' into the correct alphabetical order in NEWS
see f957e3e7f1
2022-08-01 17:39:12 +02:00
Tim Düsterhus
09e261e3b4 [ci skip] Update NEWS for ext/random
This adds 50bd8ba51c and fixes the formatting for
two other entries.
2022-08-01 17:39:05 +02:00
zeriyoshi
4e92c74654 random: split Randomizer::getInt() without argument to Randomizer::nextInt()
Since argument overloading is not safe for reflection, the method needed
to be split appropriately.

Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>

Closes GH-9057.
2022-08-01 12:19:22 +02:00
Nicolas Grekas
dd9f47758e Declare Transliterator::$id as readonly to unlock subclassing it
Closes GH-9167.
2022-08-01 10:46:57 +02:00
Ilija Tovilo
f957e3e7f1 Fix arrow function with never return type
Fixes GH-7900
Closes GH-9103
2022-07-29 12:25:09 +02:00
Ilija Tovilo
565a416e87 Fix attribute target validation on fake closures
Fixes GH-8982
Closes GH-9173
2022-07-29 12:14:44 +02:00
Derick Rethans
a50499bbaf Merge branch 'PHP-8.1' 2022-07-28 15:15:15 +01:00
Derick Rethans
a0c01f385c Add test case for GH-9601: DateInterval 1.5s added to DateTimeInterface is rounded down since PHP 8.1.0 2022-07-28 11:55:35 +01:00
Jakub Zelenka
1a9e6895f1 Fix #65069: GlobIterator incorrect handling of open_basedir check
This PR changes the glob stream wrapper so it impacts "glob://"
streamsas well. The idea is to do a check for each found path instead
of the pattern which was not working correctly.
2022-07-28 11:42:42 +01:00
Derick Rethans
001e7dbb04 Fixed bug #80047 (DatePeriod doesn't warn with custom DateTimeImmutable) 2022-07-28 10:28:10 +01:00
jcm
520bb2ec6c Fix get/set priority - error handling for MacOS and extra tests
Closes GH-9044.
2022-07-27 13:53:42 +02:00
Christoph M. Becker
ca84d06bbc Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-9032: SQLite3 authorizer crashes on NULL values
2022-07-27 13:06:15 +02:00
Christoph M. Becker
8ed21a89f3 Fix GH-9032: SQLite3 authorizer crashes on NULL values
The arguments 3 to 6 of the authorizer callback may be `NULL`[1], and
we have to properly deal with that.  Instead of causing a segfault, we
deny authorization, which is still better than a crash, and apparently,
we cannot do better anyway.

[1] <https://www.sqlite.org/c3ref/set_authorizer.html>

Closes GH-9040.
2022-07-27 12:49:16 +02:00
Christoph M. Becker
cf1664e91d Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-9155: dba_open("non-existing", "c-", "flatfile") segfaults
2022-07-27 12:13:32 +02:00
Christoph M. Becker
a442e29485 Fix GH-9155: dba_open("non-existing", "c-", "flatfile") segfaults
We must not assume that the lock file has been opened.

Closes GH-9156.
2022-07-27 12:08:36 +02:00
Adam Saponara
8cf9c2f200 Fix GH-9090: Support assigning function pointers in FFI
Closes GH-9107.
2022-07-27 10:42:25 +02:00
Tim Düsterhus
d058acb4ac Use ValueError if an invalid mode is passed to Mt19937 (#9159) 2022-07-27 09:03:02 +02:00
Christoph M. Becker
5d52d472ef Fix #69181: READ_CSV|DROP_NEW_LINE drops newlines within fields
One may argue that `DROP_NEW_LINE` does not make sense in combination
with `READ_CSV`, but without `DROP_NEW_LINE`, `SKIP_EMPTY` does not
skip empty lines at all.  We could fix that, but do not for BC reasons.
Instead we no longer drop newlines in `spl_filesystem_file_read_ex()`
when reading CSV, but handle that in `spl_filesystem_file_read_csv()`
by treating lines with only (CR)LF as being empty as well.

Closes GH-7618.
2022-07-26 18:33:57 +02:00
David Carlier
9090e2602e sockets ext for solaris update.
socket filter support, system can support up to 32 filters giving the possibility to retrive the full list.
Closes #8191.
2022-07-25 19:28:25 +01:00
Christoph M. Becker
4834cfea1a Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-9033: Loading blacklist file can fail due to negative length
2022-07-25 16:32:18 +02:00
Christoph M. Becker
35fd97c3c9 Fix GH-9033: Loading blacklist file can fail due to negative length
If the blacklist file contains a line with a single double-quote, we
called `zend_strndup(pbuf, -1)` what causes an unnecessary bail out;
instead we just ignore that line.

If the blacklist file contains an empty line, we may have caused an OOB
read; instead we just ignore that line.

Closes GH-9036.
2022-07-25 16:30:19 +02:00
Martin Herndl
229b189293 [ci skip] Fix str_split NEWS and UPGRADE note
Closes GH-9123.
2022-07-25 13:45:01 +02:00
Go Kudo
34b352d121 Fix memory leak on Randomizer::__construct() call twice (#9091)
When Radomizer::__construct() was called with no arguments, Randomizer\Engine\Secure was implicitly instantiate and memory was leaking.
Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
2022-07-24 03:09:14 +09:00
George Peter Banyard
3c372901bd Add support to pass driver flags to DBA handlers
Currently only LMDB with DBA_LMDB_USE_SUB_DIR/DBA_LMDB_NO_SUB_DIR are supported
2022-07-23 18:38:27 +01:00
Tim Düsterhus
eff9aed159 [ci skip] Update NEWS for byte expansion in rand_rangeXX()
see GH-9083
see GH-9088
see GH-9056
2022-07-22 18:52:47 +02:00
Derick Rethans
1d0e5eddd5 Add test case for bug #80483/#75035 2022-07-22 15:34:57 +01:00