1
0
mirror of https://github.com/php/php-src.git synced 2026-04-17 13:01:02 +02:00
Commit Graph

129115 Commits

Author SHA1 Message Date
Máté Kocsis
6ab897c8d3 Declare ext/phar constants in stubs (#9094) 2022-07-22 13:09:23 +02:00
Máté Kocsis
17f3631d95 Declare ext/posix constants in stubs (#9095) 2022-07-22 13:08:58 +02:00
Máté Kocsis
f72d264560 Declare ext/pspell constants in stubs (#9096) 2022-07-22 13:08:44 +02:00
George Peter Banyard
0490f082e9 [run-tests.php] echo call performance optimization 2022-07-22 11:53:46 +01:00
Ayesh Karunaratne
3483a1f170 [run-tests.php] Combine multiple str_replace calls to a single strtr call
Makes the replacement easier to see, neatly aligned, and only takes one function call.
This is safe because none of the combined replacement values contain tokens that would be recursively replaced.

This also improves the readability on how the regular expressions in `EXPECTF` matcher is constructed.

Co-authored-by: Michael Voříšek <mvorisek@mvorisek.cz>
2022-07-22 11:53:46 +01:00
Ayesh Karunaratne
c83a10d8db [run-tests.php] Replace backtick operator string literals with shell_exec() calls
The rationale is that `shell_exec()` is identical to the backtick operator (both of which are disabled when `shell_exec` function is disabled) makes it very clear that it is a shell execution, and eases security audits too.
2022-07-22 11:53:46 +01:00
Ayesh Karunaratne
f958701dad [run-tests.php] Merge multiple unset() calls to a single call 2022-07-22 11:53:46 +01:00
Ayesh Karunaratne
056afc8daf [run-tests.php] Minor optimizations in if blocks by placing simple expressions first 2022-07-22 11:53:46 +01:00
Ayesh Karunaratne
51447fb47d [run-tests.php] Improve non-optimal nested if/elseif/else blocks with happy path optimizations
Simplifies and improves the readability of multiple `if`/`elseif`/`else` blocks by removing them when an earlier branch exists the execution flow by either returning or terminating the script.
2022-07-22 11:53:46 +01:00
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