Skip to content

Commit 83fdec5

Browse files
authored
Merge branch 'master' into typed-constant-in-intl-extension
2 parents 0cedce6 + 3bc63a3 commit 83fdec5

37 files changed

+487
-402
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Standard:
2525
. Partly fix GH-12143 (Incorrect round() result for 0.49999999999999994).
2626
(timwolla)
2727
. Fix GH-12252 (round(): Validate the rounding mode). (timwolla)
28+
. Increase the default BCrypt cost to 12. (timwolla)
2829

2930
XSL:
3031
. Implement request #64137 (XSLTProcessor::setParameter() should allow both

UPGRADING

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ PHP 8.4 UPGRADE NOTES
4343
. XSLTProcessor::setParameter() will now throw a ValueError when its arguments
4444
contain null bytes. This never actually worked correctly in the first place,
4545
which is why it throws an exception nowadays.
46+
. The typed properties XSLTProcessor::$cloneDocument and
47+
XSLTProcessor::$doXInclude are now declared.
4648

4749
========================================
4850
2. New Features
@@ -80,6 +82,10 @@ PHP 8.4 UPGRADE NOTES
8082
would have resulted in 1.0 instead of the correct result 0.0. Additional
8183
inputs might also be affected and result in different outputs compared to
8284
earlier PHP versions.
85+
. The default value of the 'cost' option for PASSWORD_BCRYPT for password_hash()
86+
has been increased from '10' to '12'.
87+
88+
RFC: https://wiki.php.net/rfc/bcrypt_cost_2023
8389

8490
========================================
8591
6. New Functions
@@ -103,6 +109,9 @@ PHP 8.4 UPGRADE NOTES
103109
- Intl:
104110
. The class constants are typed now.
105111

112+
- Spl:
113+
. The class constants are typed now.
114+
106115
========================================
107116
10. New Global Constants
108117
========================================

UPGRADING.INTERNALS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ PHP 8.4 INTERNALS UPGRADE NOTES
3636
instead of int.
3737
- The macros DOM_NO_ARGS() and DOM_NOT_IMPLEMENTED() have been removed.
3838

39+
b. ext/random
40+
- The macro RAND_RANGE_BADSCALING() has been removed. The implementation
41+
should either be inlined and undefined behavior fixed or it should be
42+
replaced by a non-biased scaler.
43+
3944
========================
4045
4. OpCode changes
4146
========================

docs/release-process.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,25 @@ feature development that cannot go into the new version.
904904
there is only a single section about PHP X.Y.0, instead of individual
905905
sections for each pre-release.
906906
907+
4. On the announcement day for the initial stable version (or shortly before),
908+
update the `Expires` field in the <https://www.php.net/.well-known/security.txt>
909+
file. The `Expires` field should be set to the expected date of the next X.Y.0
910+
release (following the one currently being prepared), which is usually the
911+
fourth Thursday of November in the next year.
912+
913+
Following the recommendation of [RFC 9116](https://www.rfc-editor.org/rfc/rfc9116),
914+
we maintain an `Expires` time of about a year for our security policies. This
915+
provides security researchers with confidence they are using our most
916+
up-to-date reporting policies.
917+
918+
The `security.txt` file is located in the [web-php repository](https://github.com/php/web-php)
919+
under the `.well-known/` directory. We may make changes to this file at other
920+
times, as needed, but we will always advance the `Expires` timestamp on a
921+
yearly cadence, coinciding with our X.Y.0 releases.
922+
923+
Please see the instructions for
924+
[making changes to security.txt](security-policies.md#making-changes-to-securitytxt).
925+
907926
908927
## Prime the selection of release managers for the next version
909928

docs/security-policies.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# PHP Security Policies and Process
2+
3+
> [!IMPORTANT]
4+
> This is a meta document discussing PHP security policies and processes. For the actual
5+
> PHP security policy, see the PHP [Vulnerability Disclosure Policy][] document.
6+
7+
## PHP.net security.txt file
8+
9+
PHP.net includes a [security.txt][] file that complements the
10+
[Vulnerability Disclosure Policy][], aiding security vulnerability disclosure.
11+
This file implements the standard defined in [RFC 9116][], and more information
12+
is available at <https://securitytxt.org>.
13+
14+
RFC 9116 requires an `Expires` field in `security.txt`, and its recommendation
15+
is for the `Expires` field to be less than a year in the future. This provides
16+
security researchers with confidence they are using our most up-to-date
17+
reporting policies. To facilitate yearly updates to the `Expires` field and
18+
ensure freshness of the information in `security.txt`, the PHP release managers
19+
[update the `Expires` field as part of the X.Y.0 GA release][expires-update].
20+
21+
From time-to-time, we may update `security.txt` with new information, outside
22+
of the yearly changes to the `Expires` field.
23+
24+
### Making changes to security.txt
25+
26+
All changes to `security.txt` must be signed by a PHP release manager for a
27+
[currently supported version of PHP][supported-versions] (at the time of the
28+
changes). Release managers are the most logical choice for signing this file,
29+
since we already [publish their PGP keys][rm-pgp-keys].
30+
31+
To make changes to `security.txt`:
32+
33+
1. Go to your local clone of [web-php][].
34+
35+
```bash
36+
cd /path/to/web-php/.well-known
37+
```
38+
39+
2. Remove the PGP signature that wraps the body of `security.txt`:
40+
41+
```bash
42+
gpg --decrypt --output security.txt security.txt
43+
```
44+
45+
> [!NOTE]
46+
> To "decrypt" `security.txt`, you will need the public key of the release
47+
> manager who last signed it in your GPG keychain.
48+
49+
3. Make and save your changes to this file, e.g., update the `Expires` timestamp.
50+
51+
There should be a "Signed by" comment in the file that looks similar to this:
52+
53+
```
54+
# Signed by Ben Ramsey <ramsey@php.net> on 2023-09-28.
55+
```
56+
57+
Update this line with your name, the email address associated with the key
58+
you're using to sign the file, and the current date.
59+
60+
4. Sign your changes:
61+
62+
```bash
63+
gpg --clearsign --local-user YOU@php.net --output security.txt.asc security.txt
64+
```
65+
66+
> [!WARNING]
67+
> You cannot use `--output` to output the signature to the same file as the
68+
> input file or `gpg` will result in a signature wrapped around empty content.
69+
70+
5. Last, replace `security.txt` with `security.txt.asc` and commit your changes:
71+
72+
```bash
73+
mv security.txt.asc security.txt
74+
git commit security.txt
75+
```
76+
77+
> [!NOTE]
78+
> You may verify the signature with the following command:
79+
>
80+
> ```bash
81+
> gpg --verify security.txt
82+
> ```
83+
84+
[security.txt]: https://www.php.net/.well-known/security.txt
85+
[vulnerability disclosure policy]: https://github.com/php/php-src/security/policy
86+
[rfc 9116]: https://www.rfc-editor.org/rfc/rfc9116
87+
[expires-update]: release-process.md#preparing-for-the-initial-stable-version-php-xy0
88+
[supported-versions]: https://www.php.net/supported-versions.php
89+
[rm-pgp-keys]: https://www.php.net/gpg-keys.php
90+
[web-php]: https://github.com/php/web-php

ext/pcre/php_pcre.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
#define PREG_SPLIT_DELIM_CAPTURE (1<<1)
3535
#define PREG_SPLIT_OFFSET_CAPTURE (1<<2)
3636

37-
#define PREG_REPLACE_EVAL (1<<0)
38-
3937
#define PREG_GREP_INVERT (1<<0)
4038

4139
#define PREG_JIT (1<<3)
@@ -737,14 +735,12 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, in
737735
break;
738736
case 'J': coptions |= PCRE2_DUPNAMES; break;
739737

740-
/* Custom preg options */
741-
case 'e': poptions |= PREG_REPLACE_EVAL; break;
742-
743738
case ' ':
744739
case '\n':
745740
case '\r':
746741
break;
747742

743+
case 'e': /* legacy eval */
748744
default:
749745
if (pp[-1]) {
750746
php_error_docref(NULL, E_WARNING, "Unknown modifier '%c'", pp[-1]);
@@ -760,16 +756,6 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, in
760756
}
761757
}
762758

763-
if (poptions & PREG_REPLACE_EVAL) {
764-
php_error_docref(NULL, E_WARNING, "The /e modifier is no longer supported, use preg_replace_callback instead");
765-
pcre_handle_exec_error(PCRE2_ERROR_INTERNAL);
766-
efree(pattern);
767-
if (key != regex) {
768-
zend_string_release_ex(key, 0);
769-
}
770-
return NULL;
771-
}
772-
773759
if (key != regex) {
774760
tables = (uint8_t *)zend_hash_find_ptr(&char_tables, BG(ctype_string));
775761
if (!tables) {

ext/pcre/tests/002.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ string(12) "a${1b${1c${1"
2424
Warning: preg_replace(): Compilation failed: missing terminating ] for character class at offset 8 in %s002.php on line %d
2525
NULL
2626

27-
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in %s on line %d
27+
Warning: preg_replace(): Unknown modifier 'e' in %s on line %d
2828
NULL

ext/pcre/tests/null_bytes.phpt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ var_dump(preg_match("[abc\0def]", "abc"));
2727
var_dump(preg_match("[abc\0def]", "abc\0def"));
2828
var_dump(preg_match("[abc\0def]", "abc\0fed"));
2929

30-
preg_replace("/foo/e\0/i", "echo('Eek');", "");
31-
3230
?>
3331
--EXPECTF--
3432
Warning: preg_match(): Delimiter must not be alphanumeric, backslash, or NUL in %snull_bytes.php on line 3
@@ -62,5 +60,3 @@ int(0)
6260
int(0)
6361
int(1)
6462
int(0)
65-
66-
Warning: preg_replace(): NUL is not a valid modifier in %snull_bytes.php on line 27

ext/random/php_random.h

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -35,34 +35,6 @@
3535

3636
PHPAPI double php_combined_lcg(void);
3737

38-
/*
39-
* A bit of tricky math here. We want to avoid using a modulus because
40-
* that simply tosses the high-order bits and might skew the distribution
41-
* of random values over the range. Instead we map the range directly.
42-
*
43-
* We need to map the range from 0...M evenly to the range a...b
44-
* Let n = the random number and n' = the mapped random number
45-
*
46-
* Then we have: n' = a + n(b-a)/M
47-
*
48-
* We have a problem here in that only n==M will get mapped to b which
49-
* means the chances of getting b is much much less than getting any of
50-
* the other values in the range. We can fix this by increasing our range
51-
* artificially and using:
52-
*
53-
* n' = a + n(b-a+1)/M
54-
*
55-
* Now we only have a problem if n==M which would cause us to produce a
56-
* number of b+1 which would be bad. So we bump M up by one to make sure
57-
* this will never happen, and the final algorithm looks like this:
58-
*
59-
* n' = a + n(b-a+1)/(M+1)
60-
*
61-
* -RL
62-
*/
63-
# define RAND_RANGE_BADSCALING(__n, __min, __max, __tmax) \
64-
(__n) = (__min) + (zend_long) ((double) ( (double) (__max) - (__min) + 1.0) * ((__n) / ((__tmax) + 1.0)))
65-
6638
# ifdef PHP_WIN32
6739
# define GENERATE_SEED() (((zend_long) ((zend_ulong) time(NULL) * (zend_ulong) GetCurrentProcessId())) ^ ((zend_long) (1000000.0 * php_combined_lcg())))
6840
# else

ext/spl/spl_array.stub.php

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,10 @@
44

55
class ArrayObject implements IteratorAggregate, ArrayAccess, Serializable, Countable
66
{
7-
/**
8-
* @var int
9-
* @cvalue SPL_ARRAY_STD_PROP_LIST
10-
*/
11-
const STD_PROP_LIST = UNKNOWN;
12-
/**
13-
* @var int
14-
* @cvalue SPL_ARRAY_ARRAY_AS_PROPS
15-
*/
16-
const ARRAY_AS_PROPS = UNKNOWN;
7+
/** @cvalue SPL_ARRAY_STD_PROP_LIST */
8+
public const int STD_PROP_LIST = UNKNOWN;
9+
/** @cvalue SPL_ARRAY_ARRAY_AS_PROPS */
10+
public const int ARRAY_AS_PROPS = UNKNOWN;
1711

1812
public function __construct(array|object $array = [], int $flags = 0, string $iteratorClass = ArrayIterator::class) {}
1913

@@ -92,16 +86,10 @@ public function __debugInfo(): array {}
9286

9387
class ArrayIterator implements SeekableIterator, ArrayAccess, Serializable, Countable
9488
{
95-
/**
96-
* @var int
97-
* @cvalue SPL_ARRAY_STD_PROP_LIST
98-
*/
99-
public const STD_PROP_LIST = UNKNOWN;
100-
/**
101-
* @var int
102-
* @cvalue SPL_ARRAY_ARRAY_AS_PROPS
103-
*/
104-
public const ARRAY_AS_PROPS = UNKNOWN;
89+
/** @cvalue SPL_ARRAY_STD_PROP_LIST */
90+
public const int STD_PROP_LIST = UNKNOWN;
91+
/** @cvalue SPL_ARRAY_ARRAY_AS_PROPS */
92+
public const int ARRAY_AS_PROPS = UNKNOWN;
10593

10694
public function __construct(array|object $array = [], int $flags = 0) {}
10795

@@ -246,11 +234,8 @@ public function __debugInfo(): array {}
246234

247235
class RecursiveArrayIterator extends ArrayIterator implements RecursiveIterator
248236
{
249-
/**
250-
* @var int
251-
* @cvalue SPL_ARRAY_CHILD_ARRAYS_ONLY
252-
*/
253-
public const CHILD_ARRAYS_ONLY = UNKNOWN;
237+
/** @cvalue SPL_ARRAY_CHILD_ARRAYS_ONLY */
238+
public const int CHILD_ARRAYS_ONLY = UNKNOWN;
254239

255240
/** @tentative-return-type */
256241
public function hasChildren(): bool {}

ext/spl/spl_array_arginfo.h

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)