Commit Graph

13953 Commits

Author SHA1 Message Date
Arnaud Le Blanc
349fdc9042 [ci skip] NEWS 2022-09-03 11:28:18 +02:00
Arnaud Le Blanc
840ea641b1 [ci skip] NEWS 2022-09-02 13:57:11 +02:00
Tim Düsterhus
c77bbf6fe5
Mark crypt()'s $string parameter as #[\SensitiveParameter] 2022-08-30 20:02:28 +02:00
Pierrick Charron
9f303cf7d3
Prepare NEWS for PHP 8.2.0RC2 2022-08-30 12:10:40 -04:00
Christoph M. Becker
853181a14d
Add NEWS and UPGRADING entries for GH-9296 2022-08-30 16:59:39 +02:00
Máté Kocsis
adb45a63c0
Fix GH-9186 @strict-properties can be bypassed using unserialization (#9354)
* Emit deprecation warnings when adding dynamic properties to classes during unserialization - this will become an Error in php 9.0.
  (Adding dynamic properties in other contexts was already a deprecation warning - the use case of unserialization was overlooked)
* Throw an error when attempting to add a dynamic property to a `readonly` class when unserializing
* Add new serialization methods `__serialize`/`__unserialize` for SplFixedArray to avoid creating deprecated dynamic
  properties that would then be added to the backing fixed-size array
* Don't add named dynamic/declared properties (e.g. $obj->foo) of SplFixedArray to the backing array when unserializing
* Update tests to declare properties or to expect the deprecation warning
* Add news entry

Co-authored-by: Tyson Andre <tysonandre775@hotmail.com>
2022-08-30 07:46:32 -04:00
Calvin Buckley
f3a14d1b1a
Fix GH-9347: Current ODBC liveness checks may be inadequate
We implement SQL_ATTR_CONNECTION_DEAD for ODBC and PDO_ODBC.

This is semantically appropriate and should be used whenever the
driver supports it. In the event that it fails or says the connection
isn't dead (which may be inaccurate in some cases), try the old
heuristic.

Closes GH-9353.
2022-08-29 18:32:31 +02:00
Derick Rethans
932586c426 Fixed bug GH-9431: DateTime::getLastErrors() not returning false when no errors/warnings
For PHP 8.2 and later only.
2022-08-29 14:33:41 +01:00
Markus Staab
386a044748
[ci skip] Fix typo (requst → request)
Closes GH-9443.
2022-08-28 15:29:52 +02:00
Jakub Zelenka
5e9af0d0b0
Update NEWS for CLI built-in server changes 2022-08-28 13:34:06 +01:00
Tim Starling
11796229f2
Add libxml_get_external_entity_loader()
Add libxml_get_external_entity_loader(), which returns the currently
installed external entity loader, i.e. the value which was passed to
libxml_set_external_entity_loader() or null if no loader was installed
and the default entity loader will be used.

This allows libraries to save and restore the loader, controlling entity
expansion without interfering with the rest of the application.

Add macro Z_PARAM_FUNC_OR_NULL_WITH_ZVAL(). This allows us to get the
zval for a callable parameter without duplicating callable argument
parsing.

The saved zval keeps the object needed for fcc/fci alive, simplifying
memory management.

Fixes #76763.
2022-08-28 12:47:20 +01:00
Jakub Zelenka
35e2a25d83
Add openssl_cipher_key_length function
This function works in exactly the same way as openssl_cipher_iv_length
but for a key length. This is especially useful to make sure that the
right key length is provided to openssl_encrypt and openssl_decrypt.

In addtion the change also updates implementation of
openssl_cipher_iv_length and adds a test for it.
2022-08-28 12:27:16 +01:00
Jakub Zelenka
1407968891
Implement FR #76935: OpenSSL chacha20-poly1305 AEAD support
This adds support for ChaCha20-Poly1305 AEAD algorithm so it is possible
to use it in the same way as AES GCM and other AEAD algorithms. This is
available in OpenSSL 1.1.0+.
2022-08-28 12:15:58 +01:00
Jakub Zelenka
505e8d2a04
Fix GH-9310: SSL local_cert and local_pk do not respect open_basedir restriction 2022-08-28 12:11:14 +01:00
Tim Düsterhus
cbb024cb3d
Select rand_rangeXX() variant only based on the requested range (#9418)
This fixes an incompatibility when wrapping native 32-bit engines with a userland
engine. The latter always used the 64-bit range function which then used two
32-bit numbers from the underlying engine to fill the 64-bit range, whereas the
native implementation used only one.

Now the selection of the range variant only depends on the requested range. A
32-bit range uses the 32-bit variant (even for 64-bit engines), whereas a
larger range uses the 64-bit variant.

This was found in https://github.com/php/php-src/pull/9410#discussion_r953213000
2022-08-25 09:42:32 +02:00
David CARLIER
e787d9a0dc GH-9370: Fix opcache jit protection bits.
Allow mprotect to occur, pthread_jit_write_np are just to allow mprotect
 flags to be used.

Closes #9371.
2022-08-24 16:11:35 +01:00
Tim Düsterhus
0f696e2934
Fix rand_range32() for umax = UINT32_MAX (#9416)
* Fix rand_range32() for umax = UINT32_MAX

This was introduced in the commit that added the random extension:
4d8dd8d258.

Resolves GH-9415

* [ci skip] Rename `$r` to `$randomizer` in gh9415.phpt

* Make gh9415.phpt deterministic

* Make gh9415.phpt compatible with 32-bit
2022-08-24 14:25:51 +02:00
Máté Kocsis
0897266219
Fix GH-9285 Traits cannot be used in readonly classes 2022-08-21 10:33:08 +02:00
George Peter Banyard
d766e91681 Merge branch 'PHP-8.1' 2022-08-19 13:57:59 +01:00
George Peter Banyard
eb8ea14c66 Merge branch 'PHP-8.0' into PHP-8.1 2022-08-19 13:57:19 +01:00
George Peter Banyard
d6831e9a5c Revert Fixed bug #79451
The fix for 8.1 and above is not identical and I don't know how to fix without breaking the whole build apparently
2022-08-19 13:54:54 +01:00
Christoph M. Becker
a1f5c8a587
Fix GH-9227: Trailing dots and spaces in filenames are ignored
Given that Windows ignores trailing dots and spaces in filenames, we
catch that ourselves to avoid confusion with the respective filenames
without these characters.

Closes GH-9229.
2022-08-19 14:23:57 +02:00
George Peter Banyard
6a7935351b Merge branch 'PHP-8.1' 2022-08-19 12:55:12 +01:00
George Peter Banyard
c36a1ea1ae Merge branch 'PHP-8.0' into PHP-8.1 2022-08-19 12:52:58 +01:00
Tim Starling
ba029fce68 Fix GH-9323: crash when the VM enters userspace code via the GC
Closes GH-9323
2022-08-19 12:50:02 +01:00
NathanFreeman
1d4300d870 Fix bug #79451: Using DOMDocument->replaceChild on doctype causes double free
Closes GH-9201
2022-08-19 12:46:23 +01:00
Christoph M. Becker
5d196d9e7c
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-9316: $http_response_header is wrong for long status line
2022-08-18 12:30:45 +02:00
Christoph M. Becker
72da418719
Fix GH-9316: $http_response_header is wrong for long status line
While the reason-phrase in a HTTP response status line is usually
short, there is no actual limit specified by the RFCs.  As such, we
must not assume that the line fits into the buffer (which is currently
128 bytes large).

Since there is no real need to present the complete status line, we
simply read and discard the rest of a long line.

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

Closes GH-9319.
2022-08-18 12:27:54 +02:00
Jakub Zelenka
93bed982e8
Merge branch 'PHP-8.0' into PHP-8.1 2022-08-17 19:50:16 +01:00
Jakub Zelenka
84dcf578b1
Fix GH-9339: OpenSSL oid_file path check warning contains uninitialized path 2022-08-17 19:49:36 +01:00
Gabriel Caruso
7c6316ad1c
Prepare for 8.0.24 2022-08-17 11:56:42 +02:00
Ben Ramsey
7f26661993
PHP-8.1 is now for PHP 8.1.11-dev 2022-08-16 10:45:29 -05:00
Pierrick Charron
a0455fe716
[ci skip] Update NEWS for PHP 8.2.0 RC1 2022-08-16 11:39:53 -04:00
twosee
fa83e37e73
[ci skip] Add missing NEWS entry for GH-9324 2022-08-15 23:59:58 +08:00
Christoph M. Becker
306da80f56
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Correct IntlDateFormatter::formatObject params
2022-08-15 17:58:52 +02:00
Gert de Pagter
05ed47ef12
Correct IntlDateFormatter::formatObject params
Closes GH-9341.
2022-08-15 17:56:34 +02:00
Jakub Zelenka
7f64a8d59f
[skip ci] Add missing NEWS entry for GH-8409 fix to PHP-8.1 branch (skip-ci) 2022-08-14 14:18:28 +01:00
twosee
b8d07451d4
Re-fix GH-8409: SSL handshake timeout persistent connections hanging
This fix is another solution to replace d0527427be, use zend_try and zend_catch to make sure persistent stream will be released when error occurred.

Closes GH-9332.
2022-08-14 20:13:36 +08:00
Jakub Zelenka
897ca85d33
Revert "Fix GH-8409: SSL handshake timeout persistent connections hanging"
This reverts commit d0527427be.

This patch makes Swoole/Swow can not work anymore, because Coroutine will yield to another one during socket operation, EG(record_errors) assertion will always fail, and zend_begin_record_errors() was only used during compile time before.
Note: zend_emit_recorded_errors() and the typo fix are reserved.
2022-08-14 19:41:06 +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
Jakub Zelenka
d0527427be
Fix GH-8409: SSL handshake timeout persistent connections hanging
This is not actually related to SSL handshake but stream socket creation
which does not clean errors if the error handler is set. This fix
prevents emitting errors until the stream is freed.
2022-08-12 17:09:24 +01:00
Christoph M. Becker
71c22efae7
Fix GH-9309: Segfault when connection is used after imap_close()
We actually need to check whether `php_imap_object.imap_stream` is
`NULL` to detect that the connection has already been closed.

Closes GH-9313.
2022-08-12 16:24:30 +02:00
Christoph M. Becker
7908aae30c
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-9296: `ksort` behaves incorrectly on arrays with mixed keys
2022-08-12 11:36:24 +02:00
Denis Vaksman
cd1aed8edd
Fix GH-9296: ksort behaves incorrectly on arrays with mixed keys
The comparator function used at ksort in SORT_REGULAR mode
need to be consistent with basic comparison rules. These rules
were changed in PHP-8.0 for numeric strings, but comparator
used at ksort kept the old behaviour. It leads to inconsistent
situations, when after ksort the first key is GREATER than some
of the next ones by according to the basic comparison operators.

Closes GH-9293.
2022-08-12 11:32:23 +02:00
Derick Rethans
15e3fcb468 Fixed GH-9200: setcookie has an obsolete expires date format 2022-08-11 16:27:25 +01:00
Michael Olšavský
0709578517
Fix GH-9266: GC root buffer keeps growing when dtors are present
Do not reset cleared count on GC rerun.

Closes GH-9265.
2022-08-09 14:16:11 +02: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
Jakub Zelenka
c9fa98a174
Merge branch 'PHP-8.0' into PHP-8.1 2022-08-07 14:21:39 +01:00
Jakub Zelenka
d9ff5e079f
Fix GH-8472: stream_socket_accept result may have incorrect metadata 2022-08-07 14:17:38 +01:00