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

129106 Commits

Author SHA1 Message Date
Tim Düsterhus
ab5491f505 Fix shift in rand_rangeXX() (#9088)
The previous shifting logic is problematic for two reasons:

1. It invokes undefined behavior when the `->last_generated_size` is at least
as large as the target integer in `result`, because the shift is larger than
the target integer. This was reported in GH-9083.

2. It expands the returned bytes in a big-endian fashion: Earlier bytes are
shifting into the most-significant position. As all the other logic in the
random extension treats byte-strings as little-endian numbers this is
inconsistent.

By fixing the second issue, we can implicitly fix the first one: Instead of
shifting the existing bits by the number of "newly added" bits, we shift the
newly added bits by the number of existing bits. As we stop requesting new bits
once the total_size reached the size of the target integer we can be sure to
never invoke undefined behavior during shifting.

The get_int_user.phpt test was adjusted to verify the little-endian behavior.
It generates a single byte per call and we expect the first byte generated to
appear at the start of the resulting number.

see GH-9056 for a previous fix in the same area.
Fixes GH-9083 which reports the undefined behavior.
Resolves GH-9085 which was an alternative attempt to fix GH-9083.
2022-07-22 10:45:17 +01:00
George Peter Banyard
c8f4801382 Convert client->request.request_uri to zend_string (#9086) 2022-07-22 10:39:13 +01:00
Máté Kocsis
dd00296722 Declare ext/pdo constants in stubs (#9078) 2022-07-22 09:46:47 +02:00
Tim Düsterhus
c5f9b2f292 [ci skip] Fix version of NEWS entry
see 133b9b08da
2022-07-22 09:06:12 +02:00
Go Kudo
133b9b08da Avoid signed integer overflow in php_random_range() (#9066) 2022-07-22 10:57:32 +09:00
Tim Düsterhus
dfbe96489d [ci skip] Add "segmentation fault if user engine throws" to NEWS
see GH-9055
2022-07-21 19:32:01 +02:00
Go Kudo
e4c894984f [ci skip] Update EXTENSIONS and Author(s) in ext/random (#9074)
php.net account is better suited for this cases.
2022-07-21 17:53:32 +02:00
Ilija Tovilo
ec52da150c Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix spl test cleanup
2022-07-21 17:21:38 +02:00
Ilija Tovilo
5c10aa43c2 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix spl test cleanup
2022-07-21 17:21:18 +02:00
Ilija Tovilo
3962f00b01 Fix spl test cleanup 2022-07-21 17:20:30 +02:00
Ilija Tovilo
b5ab0e06b8 Assert all test files are cleaned up in CI (#8977)
Closes GH-8427
2022-07-21 16:06:14 +01:00
Ilija Tovilo
0f7d0a3b2a Merge branch 'PHP-8.1'
* PHP-8.1:
  Re-add MSAN in nightly
2022-07-21 16:51:39 +02:00
Ilija Tovilo
37b351ba94 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Re-add MSAN in nightly
2022-07-21 16:51:17 +02:00
Ilija Tovilo
ad136e6a6d Re-add MSAN in nightly
This was lost when migrating to GitHub actions. I'll move this one to
GitHub as well at a later point.
2022-07-21 16:49:52 +02:00
George Peter Banyard
cd640778f7 [skip ci] Add comment about LMDB env_close function call 2022-07-21 14:48:25 +01:00
George Peter Banyard
11c424c9fb Remove unnecessary include in SPL 2022-07-21 14:46:39 +01:00
George Peter Banyard
f60f6be66b Update NEWS 2022-07-21 14:10:31 +01:00
George Peter Banyard
d0542a6b5c Merge branch 'PHP-8.1'
* PHP-8.1:
  Update NEWS
  Fix memory leak in LMDB driver
2022-07-21 14:10:01 +01:00
George Peter Banyard
6cdfaf97e0 Update NEWS 2022-07-21 14:09:27 +01:00
George Peter Banyard
c7a0439d60 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix memory leak in LMDB driver
2022-07-21 14:08:40 +01:00
Ilija Tovilo
41a5b46e7d Fix RC debug of stub attribute (#9082) 2022-07-21 15:06:04 +02:00
George Peter Banyard
5b83b3a933 Fix memory leak in LMDB driver 2022-07-21 14:05:48 +01:00
Ilija Tovilo
d4a9cc8856 Fix rc info of iterator_to_array (#9080)
This function can now return a copy of the provided array, resulting in
a value of RC != 1.
2022-07-21 15:05:34 +02:00
David Carlier
067a3022f8 Sockets disable zerocopy test on ppc based arch.
Failure reported by alpine maintainers.
Closes #9081.
2022-07-21 13:36:49 +01:00
dixyes
02881a76a8 Port win32/codepage.c codes for windows arm64
Closes GH-7702.
2022-07-21 14:02:25 +02:00
Derick Rethans
1c8e566fb5 Update NEWS 2022-07-21 12:35:13 +01:00
Derick Rethans
a71ebb58e0 Merge branch 'PHP-8.1' 2022-07-21 12:34:52 +01:00
Derick Rethans
3edf93d7ee Update NEWS 2022-07-21 12:34:45 +01:00
Derick Rethans
41694cfe13 Merge branch 'PHP-8.1' 2022-07-21 12:32:40 +01:00
Derick Rethans
b66b04dde4 Merge remote-tracking branch 'derickr/timelib-sync-tests' into PHP-8.1 2022-07-21 12:29:13 +01:00
Máté Kocsis
28944b8fbe Declare ext/pcre constants in stubs (#9077) 2022-07-21 13:21:02 +02:00
Derick Rethans
557e02bf9f Merge timelib 2021.14 2022-07-21 12:11:42 +01:00
Derick Rethans
355995735b Fixed diff, again 2022-07-21 12:11:42 +01:00
Derick Rethans
37d460b64a Fixed #81263: Wrong result from DateTimeImmutable::diff 2022-07-21 12:11:42 +01:00
Derick Rethans
cc9c57722a Fixed GH-8730: DateTime::diff miscalculation is same time zone of different type 2022-07-21 12:11:42 +01:00
Christoph M. Becker
8487d8fa91 Fix GH-9067: random extension is not thread safe
For thread-safety, we need to initialize global variables in GINIT (or
RINIT), but not in MINIT.

Closes GH-9070.
2022-07-21 12:53:07 +02:00
Derick Rethans
eea2283693 Merge timelib 2021.13 2022-07-21 11:42:35 +01:00
iamluc
eac6330c72 [ci skip] Fix typo (proloading → preloading)
Closes GH-9076.
2022-07-21 12:35:15 +02:00
Tim Düsterhus
804c3fc821 Fix byte expansion in rand_rangeXX() (#9056)
* Fix shift in rand_range??()

The last generated size is in bytes, whereas the shift is in bits. Multiple the
generated size by 8 to correctly handle each byte once.

* Correctly handle user engines returning less than 4 bytes in rand_rangeXX()

We need to loop until we accumulate sufficient bytes, instead of just checking
once. The version in the rejection loop was already correct.

* Clean up some repetition in rand_rangeXX()
2022-07-20 17:33:10 +02:00
Tim Düsterhus
998ede7123 Fix segmentation fault in Randomizer::getBytes() if a user engine throws (#9055)
This fixes:

    ==374077== Use of uninitialised value of size 8
    ==374077==    at 0x532B06: generate (engine_user.c:39)
    ==374077==    by 0x533F71: zim_Random_Randomizer_getBytes (randomizer.c:152)
    ==374077==    by 0x7F581D: ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER (zend_vm_execute.h:1885)
    ==374077==    by 0x8725BE: execute_ex (zend_vm_execute.h:55930)
    ==374077==    by 0x877DB4: zend_execute (zend_vm_execute.h:60253)
    ==374077==    by 0x7B0FD4: zend_execute_scripts (zend.c:1770)
    ==374077==    by 0x6F1647: php_execute_script (main.c:2535)
    ==374077==    by 0x937DA4: do_cli (php_cli.c:964)
    ==374077==    by 0x938C3A: main (php_cli.c:1333)
    ==374077==
    ==374077== Invalid read of size 8
    ==374077==    at 0x532B06: generate (engine_user.c:39)
    ==374077==    by 0x533F71: zim_Random_Randomizer_getBytes (randomizer.c:152)
    ==374077==    by 0x7F581D: ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER (zend_vm_execute.h:1885)
    ==374077==    by 0x8725BE: execute_ex (zend_vm_execute.h:55930)
    ==374077==    by 0x877DB4: zend_execute (zend_vm_execute.h:60253)
    ==374077==    by 0x7B0FD4: zend_execute_scripts (zend.c:1770)
    ==374077==    by 0x6F1647: php_execute_script (main.c:2535)
    ==374077==    by 0x937DA4: do_cli (php_cli.c:964)
    ==374077==    by 0x938C3A: main (php_cli.c:1333)
    ==374077==  Address 0x11 is not stack'd, malloc'd or (recently) free'd
2022-07-20 17:32:22 +02:00
Ayesh Karunaratne
5c2c688c17 phpinfo HTML Output: Make module title names clickable and link to the URL fragment
Each section of `phpinfo` is titled with an `<h2><a name="module_NAME">NAME</a></h2>` tag. While the `name=module_NAME` attribute allows linking to that section using a URL fragment (e.g `info.php#module_NAME`), it lacks discoverability because the `<a>` tag does not contain an `href` attribute. This is also highlighted in accessibility scans (in Firefox for instance).

This adds a link to the `<a>` tag that links to the URL fragment, fixing the accessibility remark and improving the discoverability of the clickable section titles. Also contains minor CSS changes to account for the dark theme CSS.

Closes GH-9054.
2022-07-20 17:18:34 +02:00
Christoph M. Becker
3e922bf08f Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix GH-9008: mb_detect_encoding(): wrong results with null $encodings
2022-07-20 17:01:42 +02:00
Christoph M. Becker
c2bdaa48e1 Fix GH-9008: mb_detect_encoding(): wrong results with null $encodings
Passing `null` to `$encodings` is supposed to behave like passing the
result of `mb_detect_order()`.  Therefore, we need to remove the non-
encodings from the `elist` in this case as well.  Thus, we duplicate
the global `elist`, so we can modify it.

Closes GH-9063.
2022-07-20 16:58:55 +02:00
Máté Kocsis
b358834c72 Declare ext/openssl constants in stubs (#9046) 2022-07-20 15:40:10 +02:00
Christoph M. Becker
de6d708f63 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix --CGI-- support of run-tests.php
2022-07-20 14:42:42 +02:00
Christoph M. Becker
d430652935 Fix --CGI-- support of run-tests.php
The `--CGI--` section is supposed to be just a marker, and to be empty
as such.  However, a previous refactoring[1] broke that.

[1] <9140c9038a>

Closes GH-9061.
2022-07-20 14:41:28 +02:00
Máté Kocsis
236fd4ced2 Declare ext/odbc constants in stubs (#9045) 2022-07-20 11:49:22 +02:00
David CARLIER
1977ef92de opcache find best candidate near .text segment for large maps on FreeBSD.
Follow up on #8890 using similar workflow, we go through the php binary mapping per address boundaries.

Closes #8908.
2022-07-20 09:15:37 +01:00
Alex Dowad
6d525a425e Fix legacy conversion filter for ISO-2022-KR 2022-07-20 07:44:20 +02:00
Alex Dowad
8a915ed26c Fix legacy conversion filter for SJIS-2004 2022-07-20 07:44:20 +02:00