Commit Graph

1208 Commits

Author SHA1 Message Date
pakutoma
b721d0f71e Fix phpGH-10648: add check function pointer into mbfl_encoding
Previously, mbstring used the same logic for encoding validation as for
encoding conversion.

However, there are cases where we want to use different logic for validation
and conversion. For example, if a string ends up with missing input
required by the encoding, or if a character is input that is invalid
as an encoding but can be converted, the conversion should succeed and
the validation should fail.

To achieve this, a function pointer mb_check_fn has been added to
struct mbfl_encoding to implement the logic used for validation.
Also, added implementation of validation logic for UTF-7, UTF7-IMAP,
ISO-2022-JP and JIS.

(The same change has already been made to PHP 8.2 and 8.3; see
6fc8d014df. This commit is backporting the change to PHP 8.1.)
2023-03-25 09:52:10 +02:00
Remi Collet
e9cf14e89c
add note in UPGRADING 2021-10-19 15:54:00 +02:00
Colin O'Dell
fe36b81d5e Update Unicode tables to 14.0.0
Closes GH-7502.
2021-09-20 09:58:20 +02:00
Kamil Tekiela
d4ea11d0dc
typo 2021-09-12 20:19:03 +01:00
Derick Rethans
a6d50d21d9 Fixed typo 2021-09-03 18:21:10 +01:00
Nikita Popov
a968055b77 Add UPGRADING for ini parser changes
Missed the "git add" once again...

[ci skip]
2021-08-31 10:09:34 +02:00
Nikita Popov
7b34db0659 Switch default PKCS7/CMS cipher to AES-128-CBC
Switch default cipher for openssl_pkcs7_encrypt() and
openssl_cms_encrypt() from RC2-40 to AES-128-CBC.

The RC2-40 cipher is considered insecure and is not loaded by
default in OpenSSL 3, which means that these functions will
always fail with default arguments.

As the used algorithm is embedded in the result (which makes this
different from the openssl_encrypt() case) changing the default
algorithm should be safe.

Closes GH-7357.
2021-08-16 12:31:48 +02:00
Ben Morss
eb6c9eb936
Lossless conversion for webp
Propagating lossless conversion from libgd to our bundled gd.
Changing "quantization" to "quality" as in libgd.
Adding test.

IMG_WEBP_LOSSLESS is only defined, if lossless WebP encoding is
supported by the libgd used.

Closes GH-7348.
2021-08-12 23:19:13 +02:00
Remi Collet
1100a079ed
NEWS 2021-08-11 14:21:18 +02:00
Remi Collet
5d57d9073c
NEWS 2021-08-11 13:04:23 +02:00
Nikita Popov
f2d3e75933 Do not special case export of EC keys
All other private keys are exported in PKCS#8 format, while EC
keys use traditional format. Switch them to use PKCS#8 format as
well.

As the OpenSSL docs say:

> PEM_write_bio_PrivateKey_traditional() writes out a private key
> in the "traditional" format with a simple private key marker and
> should only be used for compatibility with legacy programs.
2021-08-06 11:25:44 +02:00
Christoph M. Becker
ff8e04ac30
[ci skip] UPGRADING: oci8.old_oci_close_semantics has been deprecated 2021-07-25 14:51:15 +02:00
Nikita Popov
6780aaa532 Implement readonly properties
Add support for readonly properties, for which only a single
initializing assignment from the declaring scope is allowed.

RFC: https://wiki.php.net/rfc/readonly_properties_v2

Closes GH-7089.
2021-07-20 12:05:46 +02:00
Kamil Tekiela
052af90b86 Deprecate autovivification on false
Deprecate automatically converting "false" into an empty array
on write operands. Autovivification continues to be supported
for "null" values, as well as undefined/uninitialized values.

RFC: https://wiki.php.net/rfc/autovivification_false

Closes GH-7131.

Co-authored-by: Tyson Andre <tysonandre775@hotmail.com>
Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2021-07-19 14:49:37 +02:00
George Peter Banyard
453a5163ce [skip-ci] Fixup UPGRADING documents
Some entries were in the wrong section/wrong document.
2021-07-17 23:27:26 +02:00
Nikita Popov
edb6b375dd Don't return bool from Phar::offsetUnset()
This violates the ArrayAccess interface. Use offsetExists() to
check if an entry exists.
2021-07-16 16:39:27 +02:00
Nikita Popov
172f84bfe4 Add UPGRADING entry for socket options
[ci skip]
2021-07-16 12:21:21 +02:00
George Peter Banyard
0ba155cd57 Make syslog() binary safe
Closes GH-7245

Co-authored-by: Nikita Popov <nikita.ppv@googlemail.com>
2021-07-15 19:08:26 +02:00
Nikita Popov
53aed48e5d Allow objects in define()
This was separately discussed in https://externals.io/message/114863,
but also necessary for consistency now that
https://wiki.php.net/rfc/new_in_initializers has landed.

Closes GH-7149.
2021-07-15 10:09:56 +02:00
Joe Watkins
d0b09a7be4 Add first-class callables
Support acquiring a Closure to a callable using the syntax
func(...), $obj->method(...), etc. This is essentially a
shortcut for Closure::fromCallable().

RFC: https://wiki.php.net/rfc/first_class_callable_syntax

Closes GH-7019.

Co-Authored-By: Nikita Popov <nikita.ppv@gmail.com>
2021-07-14 14:37:25 +02:00
Christoph M. Becker
e1285c4aa5
Deprecate $num_points parameter of image(open|filled)polygon
Cf. <https://wiki.php.net/rfc/deprecations_php_8_1#num_points_parameter_of_image_open_filled_polygon>.

Co-authored-by: Máté Kocsis <kocsismate@woohoolabs.com>
Co-authored-by: George Peter Banyard <7906688+Girgias@users.noreply.github.com>

Closes GH-6789.
2021-07-14 10:56:24 +02:00
Nikita Popov
4b3615a33f Deprecate strftime() and gmstrftime()
These are deprecated in favor of date()/DateTime::format() (for
locale-indendent formatting) and IntlDateFormatter::format()
(for locale-dependent formatting).

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-14 09:38:43 +02:00
Nikita Popov
9491694903 Deprecate SoapClient ssl_method option
Instead use ssl stream context options instead. The direct
equivalent would be crypto_method, but min_proto_version /
max_proto_version are recommended instead.

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-14 09:36:26 +02:00
Nikita Popov
52d3d0d8d7 Add limited support for new in initializers
Add support for new expressions inside parameter default values,
static variable initializers, global constant initializers and
attribute arguments.

RFC: https://wiki.php.net/rfc/new_in_initializers

Closes GH-7153.
2021-07-13 14:03:20 +02:00
Nikita Popov
aa733e8ac8 Deprecate filter.default
There's a subtlety here regarding filter.default_flags. The RFC
stated that no separate deprecation warning will be emitted for
it, on the premise that it is only meaningful if filter.default
is set. However, it turns out that even FILTER_UNSAFE_RAW (which
is the "no-op filter") can be combined with stripping flags.
However, this is compensated by the fact that this doesn't actually
work when setting filter.default=unsafe_raw and non-default
filter.default_flags -- the flags are simply ignored in that case.
So everything works out in the end.

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-12 09:33:08 +02:00
George Peter Banyard
1f42777927 Deprecate using the implicit default PgSQL connection
The DB connection should be provided in all cases as the first argument.
The overloaded function signatures will be removed in the future.
Warn about this change.

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-09 23:12:37 +02:00
Nikita Popov
a80360dbed Deprecate direct access to static trait members
Static trait members may only be accessed through a class in which
the trait is used, not directly on the trait.

A complication here is that we should not store static
methods/properties for which a deprecation is triggered in a
cache slot. As the check for this is simple and cheap, I'm handling
this in the cache slot population code in the VM. The alternative
would be to pass the cache slot down into the fetching code.

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-09 14:12:28 +02:00
Nikita Popov
08069165aa Deprecate ctype_*() on non-string arguments
Non-string arguments will be interpreted as strings in the future.
Warn about the upcoming behavior change.

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-09 12:00:35 +02:00
Nikita Popov
232aa34b9f Deprecate auto_detect_line_endings
Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-09 10:05:57 +02:00
Nikita Popov
bed7139375 Deprecate strptime()
Use date_parse_from_format() or IntlDateFormatter::parse() instead.

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-09 10:03:45 +02:00
Nikita Popov
2bc23cc6e3 Deprecate imap NIL constant
Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-08 16:48:16 +02:00
Nikita Popov
f0b190c32d Deprecate return by ref from void function
Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-08 16:47:37 +02:00
Nikita Popov
bf94010b4b Deprecate FILTER_SANITIZE_STRING/STRIPPED
Deprecate the FILTER_SANITIZE_STRING and FILTER_SANITIZE_STRIPPED
filters.

This is part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-08 16:46:59 +02:00
Nikita Popov
1c07b11b1c Deprecate odbc_result_all()
Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-08 16:46:08 +02:00
Nikita Popov
625b89af2f Deprecate mysqli::init()
In favor of parent::__construct().

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-08 16:45:05 +02:00
Nikita Popov
bf0c1ce1a0 Deprecate mhash
Deprecate mhash(), mhash_keygen_s2k(), mhash_count(),
mhash_get_block_size() and mhash_get_hash_name() in favor of the
normal hash_*() functions.

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-08 15:34:51 +02:00
Nikita Popov
1c50784ae7 Deprecate IntlCalendar::roll() with bool argument
Pass 1 instead of true and -1 instead of false.

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-08 15:34:51 +02:00
Nikita Popov
92f6e21523 Deprecate FILE_BINARY and FILE_TEXT constants
These constants have no effect.

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-08 15:34:51 +02:00
Nikita Popov
639015845f Deprecate calling mb_check_encoding() without argument
Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-08 15:34:49 +02:00
Nikita Popov
dcc8463ae5 Deprecate IAP functions on objects
Deprecate use of key(), current(), next(), prev(), reset() and
end() on objects. Cast the object to array first.

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-08 15:28:33 +02:00
Nikita Popov
5bb83b3778 Deprecate date_sunrise() and date_sunset()
date_sunrise() and date_sunset() are deprecated in favor of
date_sun_info().

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-08 15:27:08 +02:00
Marco Pivetta
6e16e1daa9 Make ReflectionProperty/Method always accessible
With this patch, it is no longer required to call
`ReflectionProperty#setAccessible()` or
`ReflectionMethod#setAccessible()` with `true`.

If a userland consumer already got to the point of accessing
object/class information via reflection, it makes little sense
for `ext/reflection` to disallow accessing `private`/`protected`
symbols by default.

After this patch, calling `ReflectionProperty#setAccessible(true)`
or `ReflectionMethod#setAccessible(true)` on newly instantiated
`ReflectionProperty` or `ReflectionMethod` respectively will have
no effect.

RFC: https://wiki.php.net/rfc/make-reflection-setaccessible-no-op

Closes GH-5412.
2021-07-08 10:55:38 +02:00
Máté Kocsis
a5360e80c2
Add support for final class constants
RFC: https://wiki.php.net/rfc/final_class_const

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2021-07-06 21:42:38 +02:00
George Peter Banyard
069a9fa5e4
Pure Intersection types (#6799)
Implement pure intersection types RFC

RFC: https://wiki.php.net/rfc/pure-intersection-types

Co-authored-by: Nikita Popov <nikic@php.net>
Co-authored-by: Ilija Tovilo <ilutov@php.net>
2021-07-05 14:11:03 +02:00
Cameron Porter
b11785c5e4 Fixed bug #81085: Add version 7.71.0 blob options.
Adds support for the following options beginning with version 7.71.0:

    CURLOPT_ISSUERCERT_BLOB
    CURLOPT_PROXY_ISSUERCERT
    CURLOPT_PROXY_ISSUERCERT_BLOB
    CURLOPT_PROXY_SSLCERT_BLOB
    CURLOPT_PROXY_SSLKEY_BLOB
    CURLOPT_SSLCERT_BLOB
    CURLOPT_SSLKEY_BLOB

Closes GH-7194.
2021-06-28 09:54:45 +02:00
Juliette
fb70194850
UPGRADING: update information re: return type for internal methods (#7182)
As discussed in 7051.
2021-06-22 08:33:55 +02:00
Joe Watkins
ed88daecf4
missing news/upgrading entry 2021-06-18 11:25:36 +02:00
Nikita Popov
deb7955bf4 Fix #81150 Add UPGRADING note for float to int deprecation
[ci skip]
2021-06-17 09:52:44 +02:00
Nikita Popov
1c08f8a48a Allow named args after unpack
Currently, argument unpacking and named arguments cannot be mixed
at all. This relaxes the restriction to allow
foo(...$args, named: $arg). The variant foo(named: $arg, ...$args)
is still forbidden, because we can't ensure that positional
parameters come before named parameters in that case (without more
intrusive changes). Effectively this just enforces a required style,
as the order of unpack and named args doesn't matter for the cases
where both could be well-defined.

ML discussion: https://externals.io/message/114589

Closes GH-7009.
2021-06-14 10:32:36 +02:00
Nikita Popov
805471e86b Fix bug #81112: Implement JsonSerializable for SplFixedArray
This returns an array for SplFixedArray JSON encoding, which
is more appropriate than an object with integer string keys.

Closes GH-7117.
2021-06-14 10:07:45 +02:00