1
0
mirror of https://github.com/php/php-src.git synced 2026-04-12 18:43:37 +02:00
Commit Graph

128673 Commits

Author SHA1 Message Date
Ilija Tovilo
5a855ee8d6 Fix GH-8661: Nullsafe in coalesce triggers undefined variable warning
Closes GH-8690
2022-06-12 21:52:14 +02:00
Alex Dowad
880803a21e Use fast conversion filters to implement php_mb_ord
Even for single-character strings, this is about 50% faster for
ASCII, UTF-8, and UTF-16. For long strings, the performance gain is
enormous, since the old code would convert the ENTIRE string, just
to pick out the first codepoint.
2022-06-12 15:24:41 +02:00
Alex Dowad
9468fa7ff2 mbfl_strlen does not need to use old conversion filters any more 2022-06-12 15:24:41 +02:00
Alex Dowad
950a7db9fe Use fast text conversion filters to implement mb_check_encoding
Benchmarking reveals that this is about 8% slower for UTF-8 strings
which have a bad codepoint at the very beginning of the string.
For good strings, or those where the first bad codepoint is much
later in the string, it is significantly faster (2-3 times faster
in many cases).
2022-06-12 15:24:41 +02:00
Alex Dowad
8533fccd63 Assert minimum size of wchar buffer in text conversion filters
In all text conversion filters which require the wchar buffer used for output
to have some minimum size, it's better to include an assertion; this will
help us to catch bugs, and will also help future readers to understand what
we expect of the function arguments.

For UTF-7 and UTF7-IMAP, these assertions were already there, but I have
added comments explaining why the minimum size is what it is.
2022-06-12 15:24:40 +02:00
Alex Dowad
871e61f942 Fully use available buffer space where converting Base64
I didn't think this through carefully enough when first writing this code,
but it's not necessary to reserve space for the 1-2 wchars which may be emitted
before exiting the function.

Why? Well, we are guaranteed that when we enter the function, there are at
least 3 spaces in the wchar buffer. The only way those can be consumed is if
wchars are emitted in the main 'while' loop, but if it does emit any wchars,
it will set 'bits' to zero at the same time, which means the final part will
not emit anything. 'bits' can be incremented again by the main loop, but the
main loop only runs while there are still at least 3 spaces in the buffer.

So basically, we are guaranteed that when the main loop terminates, either
there are 3 or more spaces remaining in the wchar buffer, or else 'bits' is
zero, or both.
2022-06-12 15:24:40 +02:00
Rowan Tommins
d9f3ca705c Add deprecation notices to utf8_encode and utf8_decode
Implements initial stage of accepted RFC to remove them:
https://wiki.php.net/rfc/remove_utf8_decode_and_utf8_encode

Tests relating to SOAP and htmlspecialchars seem to have been
using this entirely unnecessarily, so have been fixed.

Closes GH-8726.
2022-06-12 13:37:23 +02:00
Ilija Tovilo
e79046fbe4 Fix redundant ZSTR_VAL condition in php_date.c (#8753)
ZSTR_VAL can never be NULL as zend_string.val is a char[1] which will
always decay to a non-nullable pointer.

This fails with -Werror on newer gcc versions.
2022-06-12 10:59:37 +02:00
Ilija Tovilo
3f7ec69b61 Collapse more generated files in PRs (#8754)
* The generated VM files
* tokenizer_data.c
2022-06-12 10:56:35 +02:00
Alex Dowad
13479ee2bd Restore backwards-compatible mappings for 0x5C/0x7E in SJIS (for fast conversion filter)
In d62f535caa, the legacy mbstring conversion filters for Shift-JIS
was updated to restore backwards-compatible mappings for 0x5C/0x7E.
Make the same change to the newer fast conversion filters.
2022-06-11 17:09:16 +02:00
Christoph M. Becker
85a95a2982 Merge branch 'PHP-8.1'
* PHP-8.1:
  Restore backwards-compatible mappings of 0x5C and 0x7E in SJIS
2022-06-11 16:32:33 +02:00
Alex Dowad
d62f535caa Restore backwards-compatible mappings of 0x5C and 0x7E in SJIS
According to the relevant Japan Industrial Standards Committee standards,
SJIS 0x5C is a Yen sign, and 0x7E is an overline.

However, this conflicts with the implementation of SJIS in various legacy
software (notably Microsoft products), where SJIS 0x5C and 0x7E are taken
as equivalent to the same ASCII bytes.

Prior to PHP 8.1, mbstring's implementation of SJIS handled these bytes
compatibly with Microsoft products. This was changed in PHP 8.1.0, in an
attempt to comply with the JISC specifications. However, after discussion
with various concerned Japanese developers, it seems that the historical
behavior was more useful in the majority of applications which process
SJIS-encoded text.

Since we are now treating SJIS 0x5C as equivalent to U+005C and 0x7E as
equivalent to U+007E, it does not make sense to convert U+203E (OVERLINE)
to 0x7E, nor does it make sense to convert U+00A5 (YEN SIGN) to 0x5C. Restore
the mappings for those codepoints from before PHP 8.1.0.

Fixes GH-8281.
2022-06-11 16:31:47 +02:00
David CARLIER
6b02cabc8a Add SO_SETFIB FreeBSD socket option constant.
Aims to set the route table.
Closes #8742.
2022-06-11 13:03:21 +01:00
Pierrick Charron
bad26b7560 Merge branch 'PHP-8.1' 2022-06-10 12:45:30 -04:00
Pierrick Charron
77ba689fd6 Merge branch 'PHP-8.0' into PHP-8.1 2022-06-10 12:44:39 -04:00
Pierrick Charron
df4dd82ea0 Fix bad integer promotion in mysqlnd big5 charset detection 2022-06-10 12:41:54 -04:00
Christoph M. Becker
d7bdc040b4 Join shm_pair.info and .segment of Windows shm implementation
There is not much point in having two distinct file mappings; since the
info mapping is very small and of fixed size, we can put it at the
beginning of a single mapping.  Besides the obvious resource savings,
that also simplifies the error handling.

Closes GH-8648.
2022-06-10 17:18:27 +02:00
Remi Collet
e9e3a1481b Merge branch 'PHP-8.1'
* PHP-8.1:
  [ci skip] missing CVE
2022-06-10 14:35:21 +02:00
Remi Collet
8b07921a0c [ci skip] missing CVE 2022-06-10 14:35:12 +02:00
Remi Collet
976f5fda87 Merge branch 'PHP-8.1'
* PHP-8.1:
  [ci skip] missing CVE
  [ci skip] missing CVE
2022-06-10 14:32:30 +02:00
Remi Collet
9261679560 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  [ci skip] missing CVE
  [ci skip] missing CVE
2022-06-10 14:32:06 +02:00
Remi Collet
62f64141ef [ci skip] missing CVE 2022-06-10 14:31:48 +02:00
Remi Collet
ba2d095fe6 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  [ci skip] missing CVE
2022-06-10 14:28:57 +02:00
Remi Collet
198f3f509d [ci skip] missing CVE 2022-06-10 14:28:31 +02:00
Derick Rethans
242b9438ea Fixed tests that relied on date.timezone=UTC to work 2022-06-10 12:00:25 +01:00
Christoph M. Becker
e86acb1861 Run POD_Firebird tests on AppVeyor CI
We also fix gh8626.phpt for the firebird driver by allowing negative
status codes as well.  We mark the other two test cases as xfail for
the firebird driver for now.

Closes GH-8666.
2022-06-10 12:22:44 +02:00
Jakub Zelenka
13e46a0cb1 Merge branch 'PHP-8.1' 2022-06-09 23:03:37 +01:00
Jakub Zelenka
56382493eb Merge branch 'PHP-8.0' into PHP-8.1 2022-06-09 23:02:50 +01:00
Jakub Zelenka
2f78c1f9d9 Fix and improve OpenSSL VCWD path checking test for bug #50293 2022-06-09 23:01:52 +01:00
Jakub Zelenka
03b9dbc9ce Merge branch 'PHP-8.1' 2022-06-09 20:10:28 +01:00
Jakub Zelenka
95f6984216 Merge branch 'PHP-8.0' into PHP-8.1 2022-06-09 20:09:57 +01:00
Jakub Zelenka
cb9a48a0c5 Pass signature to openssl_verify in bug81713 test 2022-06-09 20:09:08 +01:00
Jakub Zelenka
a6387fa383 Merge branch 'PHP-8.1' 2022-06-09 19:57:08 +01:00
Jakub Zelenka
976cbba76e Merge branch 'PHP-8.0' into PHP-8.1 2022-06-09 19:55:46 +01:00
Jakub Zelenka
b765d4cd41 Fix bug #50293 and #81713: file path checking in OpenSSL functions
It introduces a single function to check file paths passed to OpenSSL
functions. It expands the path, check null bytes and finally does
an open basedir check.
2022-06-09 19:49:59 +01:00
Pierrick Charron
0e062c8af8 Merge branch 'PHP-8.1' 2022-06-09 13:51:50 -04:00
Pierrick Charron
f97a650944 Merge branch 'PHP-8.0' into PHP-8.1 2022-06-09 13:49:45 -04:00
Pierrick Charron
e2d55f2f12 Fix LONG_CHECK_VALID_INT in socket extension 2022-06-09 13:48:02 -04:00
George Peter Banyard
bac8ccef09 Remove SIZEOF_OFF_T undef in PDO PGSQL driver (#8301)
This has been introduced as part of fixing https://bugs.php.net/79532 (67f9b0b754) because ``pg_config.h`` was included.

As this is no longer the case we don't need this undef any more.
2022-06-09 13:29:20 +01:00
George Peter Banyard
dbf1cafd77 Remove internal usage of SplFileInfo::_bad_state_ex() method (#8318)
* Use standard VM handling instead
 * Deprecate the method as it is now useless
2022-06-09 13:24:58 +01:00
Ilija Tovilo
c019421912 Fix regression from GH-8587 (#8615)
* Fix regression from GH-8587

Streams hold a reference to the stream wrapper. User stream wrappers
must not be released until the streams themselves are closed.

* Add test for directories
2022-06-09 13:49:41 +02:00
Christoph M. Becker
12a3066b2c Fix debug output 2022-06-09 13:42:45 +02:00
Bob Weinand
34208bfd81 Merge branch 'PHP-8.1' 2022-06-09 13:30:57 +02:00
Nicolas Grekas
96e3a9d316 Fix RC=1 references of declared properties when casting objects to arrays
Fixes GH-8655.
Closes GH-8737.
2022-06-09 13:28:12 +02:00
Christoph M. Becker
cb3bc659bf Revert "Run PDO_Firebird tests on AppVeyor CI"
This reverts commit b2d1d1b47d, because
of many test failures which need closer investigation.
2022-06-09 12:00:15 +02:00
Christoph M. Becker
b2d1d1b47d Run PDO_Firebird tests on AppVeyor CI
Closes GH-8666.
2022-06-09 11:02:47 +02:00
Máté Kocsis
7601068f3d Declare ext/libxml constants in stubs (#8721) 2022-06-09 08:18:44 +02:00
Ben Ramsey
c83b57096a [ci skip] Add list of repositories for RMs to clone 2022-06-08 19:03:02 -05:00
Ben Ramsey
82d1684e33 [ci skip] Update example commit messsages in RM doc 2022-06-08 18:49:35 -05:00
Ben Ramsey
526ee44534 [ci skip] Update and clarify release process document 2022-06-08 18:37:20 -05:00