1
0
mirror of https://github.com/php/php-src.git synced 2026-04-20 22:41:20 +02:00
Commit Graph

130619 Commits

Author SHA1 Message Date
Alex Dowad
4ebfddfad4 Move mobile variants of SJIS into mbfilter_sjis.c 2022-12-12 16:28:49 +02:00
Alex Dowad
005e49e552 Optimize MacJapanese decoder for speed
On longer MacJapanese strings, conversion speed is boosted by 60-80%.
On medium-length strings, conversion speed is boosted around 20-30%.
For very short strings, there is no appreciable difference.
2022-12-12 16:28:49 +02:00
Alex Dowad
4072a76e3f Move MacJapanese implementation into mbfilter_sjis.c 2022-12-12 16:28:49 +02:00
Alex Dowad
b3d197d688 Optimize SJIS decoder for speed
While benchmarking the new implementation of mb_substr, I found it was
slower than the old one only when the selected encoding was SJIS.
Investigation showed that the new text conversion filter for SJIS
was a touch slower than the old one.

With this optimization, the new SJIS decoder is about 20% faster than
the old one.
2022-12-12 16:28:49 +02:00
Alex Dowad
0c0774f5b4 Use fast text conversion filters for mb_strpos, mb_stripos, mb_substr, etc
This boosts the performance of mb_strpos, mb_stripos, mb_strrpos,
mb_strripos, mb_strstr, mb_stristr, mb_strrchr, and mb_strrichr when
used on non-UTF-8 strings. mb_substr is also faster.

With UTF-8 input, there is no appreciable difference in performance for
mb_strpos, mb_stripos, mb_strrpos, etc. This is expected, since the only
real difference here (aside from shorter and simpler code) is that the
new text conversion code is used when converting non-UTF-8 input strings
to UTF-8. (This is done because internally, mb_strpos, etc. work only
on UTF-8 text.)

For ASCII, speed is boosted by 30-65%. For other legacy text encodings,
the degree of performance improvement will depend on how slow the
legacy conversion code was.

One other minor, but notable difference is that strings encoded using
UTF-8 variants from Japanese mobile vendors (SoftBank, KDDI, Docomo)
will not undergo encoding conversion but will be processed "as is". It
is expected that this will result in a large performance boost for
such input strings; but realistically, the number of users who work
with such strings is probably minute.

I was not originally planning to include mb_substr in this commit, but
fuzzing of the reimplemented mb_strstr revealed that mb_substr needed
to be reimplemented, too; using the old mbfl_substr, which was based
on the old text conversion filters, in combination with functions which
use the new text conversion filters caused bugs.

The performance boost for mb_substr varies from 10%-500%, depending
on the encoding and input string used.
2022-12-12 16:28:49 +02:00
Ilija Tovilo
b96b88b669 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix compilation on RHEL 7 ppc64le (gcc 4.8)
2022-12-11 17:30:56 +01:00
Mattias Ellert
a83923044c Fix compilation on RHEL 7 ppc64le (gcc 4.8)
Fixes GH-10077
Closes GH-10078
2022-12-11 17:30:31 +01:00
David Carlier
91e70a4e6b Merge branch 'PHP-8.2' 2022-12-10 14:14:20 +00:00
David Carlier
8a221e2763 fix litespeed SAPI build warnings.
- helpers only called on linux anyway.
- proper C calls prototypes.

Closes GH-10068.
2022-12-10 14:13:30 +00:00
Elan Ruusamäe
e114f32596 Avoid code duplication in php_ini.c (#4512) 2022-12-10 12:51:13 +01:00
David Carlier
6422cf6f1a intl extension: msgfmt_set_pattern add pattern format error informations. 2022-12-09 17:10:51 +00:00
Tim Düsterhus
b34cdc582f [ci skip] Fix json_validate() formatting in NEWS
It is expected that each entry ends with a `.`. I've removed the RFC link here,
as NEWS entries do not contain links, when looking at the past branches. The
RFC link is available in UPGRADING since the previous commit.
2022-12-09 17:58:04 +01:00
Tim Düsterhus
16ce751f39 [ci skip] Add json_validate() RFC link to UPGRADING 2022-12-09 17:55:32 +01:00
Joshua Rüsweg
ac3ecd03af Add Randomizer::getBytesFromString() method (#9664)
* Add `Randomizer::getBytesFromAlphabet()` method

* Rename `getBytesFromAlphabet` to `getBytesFromString`

* [ci skip] Add NEWS/UPGRADING for Randomizer::getBytesFromString()

Co-authored-by: Tim Düsterhus <tim@bastelstu.be>
2022-12-09 17:39:13 +01:00
Christoph M. Becker
1b503a1f52 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix mysqli test wrt. MariaDB
2022-12-09 16:10:36 +01:00
Daniel Black
b77edf82ac Fix mysqli test wrt. MariaDB
The test results under MariaDB, except they report "MariaDB" instead
of MySQL.

Closes GH-10029.
2022-12-09 16:09:23 +01:00
Alex Dowad
14110bff7f Merge branch 'PHP-8.2'
* PHP-8.2:
  Support Microsoft's "Best Fit" mappings for Windows-1252 text encoding
2022-12-09 15:41:07 +02:00
Alex Dowad
b79a86f53a Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Support Microsoft's "Best Fit" mappings for Windows-1252 text encoding
2022-12-09 15:37:56 +02: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
David CARLIER
faef55d638 standard/basic_functions.c remove x bit on this file (#10069) 2022-12-09 08:38:52 +00:00
Christoph M. Becker
005a765ded Merge branch 'PHP-8.2'
* PHP-8.2:
  ext/mysqli tests "using password" optional in error messages (part 2)
2022-12-08 14:24:52 +01:00
Christoph M. Becker
a76bbd39b6 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  ext/mysqli tests "using password" optional in error messages (part 2)
2022-12-08 14:24:01 +01: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
Christoph M. Becker
b628989f27 [ci skip] Merge branch 'PHP-8.2'
* PHP-8.2:
  PHP-8.1 is now for PHP 8.1.15-dev
2022-12-08 14:19:31 +01:00
Christoph M. Becker
01eabdc4ec [ci skip] Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  PHP-8.1 is now for PHP 8.1.15-dev
2022-12-08 14:19:02 +01:00
Christoph M. Becker
3f3c1df8b6 [ci skip] Fix GH-10056: [grammar] "less security-conscience applications" 2022-12-08 13:38:28 +01:00
Niels
11b612af6d Rename PHP_STREAM_TO_ZVAL to PHP_STREAM_FROM_ZVAL (#10065) 2022-12-07 19:57:50 +01:00
Ben Ramsey
35a4950ffa Replace Azure DevOps link with GitHub Actions 2022-12-07 11:53:15 -06: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
568ed4721e Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix #81742: open_basedir bypass in SQLite3 by using file URI
2022-12-06 16:01:24 +01:00
Christoph M. Becker
830180341b Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix #81742: open_basedir bypass in SQLite3 by using file URI
2022-12-06 16:00:49 +01: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
Christoph M. Becker
e4ef394c6b Drop superfluous check for imap_stream
`GET_IMAP_STREAM` already checks whether `.imap_stream` is `NULL`, and
bails out in that case.

Closes GH-10053.
2022-12-06 11:01:18 +01:00
Christoph M. Becker
4ae1f080e7 Merge branch 'PHP-8.2'
* PHP-8.2:
  ext/mysqli tests "using password" optional in error messages
2022-12-05 13:13:21 +01:00
Christoph M. Becker
0ac9e8e4e2 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  ext/mysqli tests "using password" optional in error messages
2022-12-05 13:12:54 +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
Christoph M. Becker
6109b80926 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fallback to first line of function when ex->opline is NULL (#10003)
2022-12-05 12:45:49 +01:00
Christoph M. Becker
b683a7e470 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fallback to first line of function when ex->opline is NULL (#10003)
2022-12-05 12:45:22 +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
d952419a2b Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-10011 (Trampoline autoloader will get reregistered and cannot be unregistered)
2022-12-02 12:49:08 +00:00
George Peter Banyard
334d108a2e Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10011 (Trampoline autoloader will get reregistered and cannot be unregistered)
2022-12-02 12:48:41 +00: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
George Peter Banyard
c4a0fc62a2 Fix zend_fcc_equals() with trampolines (#10012)
We cannot compare the function handler pointer directly for trampolines, as they may be reallocated
2022-12-02 12:34:11 +00:00
Christoph M. Becker
9f0e4a55e7 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-9769: Misleading error message for unpacking of objects
2022-12-02 13:12:14 +01:00
Christoph M. Becker
6b1f4c5a44 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-9769: Misleading error message for unpacking of objects
2022-12-02 13:11:51 +01: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
Ilija Tovilo
683d81e4bd Fix incorrect short-circuiting in constant expressions (#10030)
Fixes GH-10014
2022-12-01 19:30:44 +01:00
Christoph M. Becker
d4c804b98e [ci skip] Add missing entries to php.ini quick reference
Closes GH-9889.
2022-12-01 14:59:28 +01:00
Derick Rethans
853e9caaa3 Merge branch 'PHP-8.2' 2022-12-01 11:11:42 +00:00
Derick Rethans
1316a5b8fb Merge branch 'PHP-8.1' into PHP-8.2 2022-12-01 11:08:38 +00:00