Skip to content

Commit 2adb409

Browse files
committed
Merge branch 'master' into clone-all-syntax
2 parents 30762ab + 4a18c89 commit 2adb409

File tree

122 files changed

+1184
-428
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+1184
-428
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,13 @@ tmp-php.ini
294294
/junit.out.xml
295295
/.ccache/
296296

297+
# ------------------------------------------------------------------------------
298+
# Editor configuration directories
299+
# ------------------------------------------------------------------------------
300+
/.idea/
301+
/.vscode/
302+
/.zed/
303+
297304
# ------------------------------------------------------------------------------
298305
# Additional test build files
299306
# ------------------------------------------------------------------------------

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ PHP NEWS
7474
- DOM:
7575
. Added Dom\Element::$outerHTML. (nielsdos)
7676
. Added Dom\Element::insertAdjacentHTML(). (nielsdos)
77+
. Added $children property to ParentNode implementations. (nielsdos)
7778

7879
- Enchant:
7980
. Added enchant_dict_remove_from_session(). (nielsdos)

README.md

Lines changed: 47 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ blog to the most popular websites in the world. PHP is distributed under the
1515
[PHP License v3.01](LICENSE).
1616

1717
[![Push](https://github.com/php/php-src/actions/workflows/push.yml/badge.svg)](https://github.com/php/php-src/actions/workflows/push.yml)
18-
[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/php.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:php)
18+
[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/php.svg)](https://issues.oss-fuzz.com/issues?q=project:php)
1919

2020
## Documentation
2121

@@ -42,28 +42,50 @@ a default build, you will additionally need libxml2 and libsqlite3.
4242

4343
On Ubuntu, you can install these using:
4444

45-
sudo apt install -y pkg-config build-essential autoconf bison re2c \
46-
libxml2-dev libsqlite3-dev
45+
```shell
46+
sudo apt install -y pkg-config build-essential autoconf bison re2c libxml2-dev libsqlite3-dev
47+
```
4748

4849
On Fedora, you can install these using:
4950

50-
sudo dnf install re2c bison autoconf make libtool ccache libxml2-devel sqlite-devel
51+
```shell
52+
sudo dnf install re2c bison autoconf make libtool ccache libxml2-devel sqlite-devel
53+
```
54+
55+
On MacOS, you can install these using `brew`:
56+
57+
```shell
58+
brew install autoconf bison re2c iconv libxml2 sqlite
59+
```
60+
61+
or with `MacPorts`:
62+
63+
```shell
64+
sudo port install autoconf bison re2c libiconv libxml2 sqlite3
65+
```
5166

5267
Generate configure:
5368

54-
./buildconf
69+
```shell
70+
./buildconf
71+
```
5572

5673
Configure your build. `--enable-debug` is recommended for development, see
5774
`./configure --help` for a full list of options.
5875

59-
# For development
60-
./configure --enable-debug
61-
# For production
62-
./configure
76+
```shell
77+
# For development
78+
./configure --enable-debug
79+
# For production
80+
./configure
81+
```
6382

64-
Build PHP. To speed up the build, specify the maximum number of jobs using `-j`:
83+
Build PHP. To speed up the build, specify the maximum number of jobs using the
84+
`-j` argument:
6585

66-
make -j4
86+
```shell
87+
make -j4
88+
```
6789

6890
The number of jobs should usually match the number of available cores, which
6991
can be determined using `nproc`.
@@ -74,23 +96,33 @@ PHP ships with an extensive test suite, the command `make test` is used after
7496
successful compilation of the sources to run this test suite.
7597

7698
It is possible to run tests using multiple cores by setting `-jN` in
77-
`TEST_PHP_ARGS`:
99+
`TEST_PHP_ARGS` or `TESTS`:
78100

79-
make TEST_PHP_ARGS=-j4 test
101+
```shell
102+
make TEST_PHP_ARGS=-j4 test
103+
```
80104

81105
Shall run `make test` with a maximum of 4 concurrent jobs: Generally the maximum
82106
number of jobs should not exceed the number of cores available.
83107

108+
Use the `TEST_PHP_ARGS` or `TESTS` variable to test only specific directories:
109+
110+
```shell
111+
make TESTS=tests/lang/ test
112+
```
113+
84114
The [qa.php.net](https://qa.php.net) site provides more detailed info about
85115
testing and quality assurance.
86116

87117
## Installing PHP built from source
88118

89119
After a successful build (and test), PHP may be installed with:
90120

91-
make install
121+
```shell
122+
make install
123+
```
92124

93-
Depending on your permissions and prefix, `make install` may need super user
125+
Depending on your permissions and prefix, `make install` may need superuser
94126
permissions.
95127

96128
## PHP extensions

UPGRADING

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ PHP 8.5 UPGRADE NOTES
185185

186186
- DOM:
187187
. Added Dom\Element::$outerHTML.
188+
. Added $children property to Dom\ParentNode implementations.
188189

189190
- EXIF:
190191
. Add OffsetTime* Exif tags.

UPGRADING.INTERNALS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,17 @@ PHP 8.5 INTERNALS UPGRADE NOTES
4545
properties.
4646
. ZEND_IS_XDIGIT() macro was removed because it was unused and its name
4747
did not match its actual behavior.
48+
. zend_register_constant() now returns a pointer to the added constant
49+
on success and NULL on failure instead of SUCCESS/FAILURE.
4850

4951
========================
5052
2. Build system changes
5153
========================
5254

55+
- Abstract
56+
. Preprocessor macro SIZEOF_PTRDIFF_T has been removed.
57+
. Preprocessor macro SIZEOF_INTMAX_T has been removed.
58+
5359
- Windows build system changes
5460
. SAPI() and ADD_SOURCES() now suport the optional `duplicate_sources`
5561
parameter. If truthy, no rules to build the object files are generated.
@@ -69,6 +75,8 @@ PHP 8.5 INTERNALS UPGRADE NOTES
6975
. Autoconf macro PHP_DEF_HAVE has been removed (use AC_DEFINE).
7076
. Autoconf macro PHP_OUTPUT has been removed (use AC_CONFIG_FILES).
7177
. Autoconf macro PHP_TEST_BUILD has been removed (use AC_* macros).
78+
. Preprocessor macro HAVE_PTRDIFF_T has been removed.
79+
. Preprocessor macro HAVE_INTMAX_T has been removed.
7280

7381
========================
7482
3. Module changes
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
OSS-Fuzz #428053935
3+
--FILE--
4+
<?php
5+
namespace Foo; // Capital letter is important for the ns lookup
6+
#[Attr]
7+
const MyConst = '';
8+
9+
$rc = new \ReflectionConstant('Foo\\MyConst');
10+
var_dump($rc->getAttributes());
11+
?>
12+
--EXPECTF--
13+
array(1) {
14+
[0]=>
15+
object(ReflectionAttribute)#%d (1) {
16+
["name"]=>
17+
string(8) "Foo\Attr"
18+
}
19+
}

Zend/zend_builtin_functions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ ZEND_FUNCTION(define)
592592
/* non persistent */
593593
ZEND_CONSTANT_SET_FLAGS(&c, 0, PHP_USER_CONSTANT);
594594
c.name = zend_string_copy(name);
595-
if (zend_register_constant(&c) == SUCCESS) {
595+
if (zend_register_constant(&c) != NULL) {
596596
RETURN_TRUE;
597597
} else {
598598
RETURN_FALSE;

Zend/zend_constants.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -505,11 +505,11 @@ static void* zend_hash_add_constant(HashTable *ht, zend_string *key, zend_consta
505505
return ret;
506506
}
507507

508-
ZEND_API zend_result zend_register_constant(zend_constant *c)
508+
ZEND_API zend_constant *zend_register_constant(zend_constant *c)
509509
{
510510
zend_string *lowercase_name = NULL;
511511
zend_string *name;
512-
zend_result ret = SUCCESS;
512+
zend_constant *ret = NULL;
513513
bool persistent = (ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT) != 0;
514514

515515
#if 0
@@ -539,7 +539,7 @@ ZEND_API zend_result zend_register_constant(zend_constant *c)
539539
/* Check if the user is trying to define any special constant */
540540
if (zend_string_equals_literal(name, "__COMPILER_HALT_OFFSET__")
541541
|| (!persistent && zend_get_special_const(ZSTR_VAL(name), ZSTR_LEN(name)))
542-
|| zend_hash_add_constant(EG(zend_constants), name, c) == NULL
542+
|| (ret = zend_hash_add_constant(EG(zend_constants), name, c)) == NULL
543543
) {
544544
zend_error(E_WARNING, "Constant %s already defined", ZSTR_VAL(name));
545545
zend_string_release(c->name);
@@ -550,7 +550,6 @@ ZEND_API zend_result zend_register_constant(zend_constant *c)
550550
if (!persistent) {
551551
zval_ptr_dtor_nogc(&c->value);
552552
}
553-
ret = FAILURE;
554553
}
555554
if (lowercase_name) {
556555
zend_string_release(lowercase_name);

Zend/zend_constants.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ ZEND_API void zend_register_long_constant(const char *name, size_t name_len, zen
9797
ZEND_API void zend_register_double_constant(const char *name, size_t name_len, double dval, int flags, int module_number);
9898
ZEND_API void zend_register_string_constant(const char *name, size_t name_len, const char *strval, int flags, int module_number);
9999
ZEND_API void zend_register_stringl_constant(const char *name, size_t name_len, const char *strval, size_t strlen, int flags, int module_number);
100-
ZEND_API zend_result zend_register_constant(zend_constant *c);
100+
ZEND_API zend_constant *zend_register_constant(zend_constant *c);
101101
void zend_constant_add_attributes(zend_constant *c, HashTable *attributes);
102102
#ifdef ZTS
103103
void zend_copy_constants(HashTable *target, HashTable *source);

Zend/zend_portability.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,8 @@ extern "C++" {
496496

497497
#ifdef ZEND_WIN32
498498
#define ZEND_SECURE_ZERO(var, size) RtlSecureZeroMemory((var), (size))
499+
#elif defined(HAVE_MEMSET_EXPLICIT)
500+
#define ZEND_SECURE_ZERO(var, size) memset_explicit((var), 0, (size))
499501
#else
500502
#define ZEND_SECURE_ZERO(var, size) explicit_bzero((var), (size))
501503
#endif

0 commit comments

Comments
 (0)