Skip to content

Commit 8f15592

Browse files
authored
Merge branch 'php:master' into true-async-api
2 parents 1fa4663 + bbc465e commit 8f15592

File tree

20 files changed

+77
-56
lines changed

20 files changed

+77
-56
lines changed

.github/actions/freebsd/action.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
name: FreeBSD
2+
inputs:
3+
configurationParameters:
4+
default: ''
5+
required: false
26
runs:
37
using: composite
48
steps:
@@ -80,7 +84,9 @@ runs:
8084
--with-sodium \
8185
--enable-werror \
8286
--with-config-file-path=/etc \
83-
--with-config-file-scan-dir=/etc/php.d
87+
--with-config-file-scan-dir=/etc/php.d \
88+
${{ inputs.configurationParameters }}
89+
8490
gmake -j2
8591
mkdir /etc/php.d
8692
gmake install > /dev/null

.github/workflows/nightly.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ on:
2323
run_macos_arm64:
2424
required: true
2525
type: boolean
26+
run_freebsd_zts:
27+
required: true
28+
type: boolean
2629
ubuntu_version:
2730
required: true
2831
type: string
@@ -1052,7 +1055,13 @@ jobs:
10521055
- name: Test
10531056
run: .github/scripts/windows/test.bat
10541057
FREEBSD:
1055-
name: FREEBSD
1058+
strategy:
1059+
fail-fast: false
1060+
matrix:
1061+
zts: [true, false]
1062+
exclude:
1063+
- zts: ${{ !inputs.run_freebsd_zts && true || '*never*' }}
1064+
name: "FREEBSD_${{ matrix.zts && 'ZTS' || 'NTS' }}"
10561065
runs-on: ubuntu-latest
10571066
steps:
10581067
- name: git checkout
@@ -1061,3 +1070,6 @@ jobs:
10611070
ref: ${{ inputs.branch }}
10621071
- name: FreeBSD
10631072
uses: ./.github/actions/freebsd
1073+
with:
1074+
configurationParameters: >-
1075+
--${{ matrix.zts && 'enable' || 'disable' }}-zts

.github/workflows/root.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
run_alpine: ${{ (matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 4) || matrix.branch.version[0] >= 9 }}
5656
run_linux_ppc64: ${{ (matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 4) || matrix.branch.version[0] >= 9 }}
5757
run_macos_arm64: ${{ (matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 4) || matrix.branch.version[0] >= 9 }}
58+
run_freebsd_zts: ${{ (matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 3) || matrix.branch.version[0] >= 9 }}
5859
ubuntu_version: ${{
5960
(((matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 5) || matrix.branch.version[0] >= 9) && '24.04')
6061
|| '22.04' }}

UPGRADING.INTERNALS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,16 @@ 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

5355
- Abstract
5456
. Preprocessor macro SIZEOF_PTRDIFF_T has been removed.
57+
. Preprocessor macro SIZEOF_INTMAX_T has been removed.
5558

5659
- Windows build system changes
5760
. SAPI() and ADD_SOURCES() now suport the optional `duplicate_sources`
@@ -73,6 +76,7 @@ PHP 8.5 INTERNALS UPGRADE NOTES
7376
. Autoconf macro PHP_OUTPUT has been removed (use AC_CONFIG_FILES).
7477
. Autoconf macro PHP_TEST_BUILD has been removed (use AC_* macros).
7578
. Preprocessor macro HAVE_PTRDIFF_T has been removed.
79+
. Preprocessor macro HAVE_INTMAX_T has been removed.
7680

7781
========================
7882
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_vm_def.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8261,7 +8261,7 @@ ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST)
82618261
ZEND_CONSTANT_SET_FLAGS(&c, 0, PHP_USER_CONSTANT);
82628262
c.name = zend_string_copy(Z_STR_P(name));
82638263

8264-
if (zend_register_constant(&c) == FAILURE) {
8264+
if (zend_register_constant(&c) == NULL) {
82658265
}
82668266

82678267
FREE_OP1();
@@ -8274,7 +8274,7 @@ ZEND_VM_HANDLER(210, ZEND_DECLARE_ATTRIBUTED_CONST, CONST, CONST)
82748274
USE_OPLINE
82758275
zval *name;
82768276
zval *val;
8277-
zend_constant c;
8277+
zend_constant c, *registered;
82788278

82798279
SAVE_OPLINE();
82808280
name = GET_OP1_ZVAL_PTR(BP_VAR_R);
@@ -8293,17 +8293,16 @@ ZEND_VM_HANDLER(210, ZEND_DECLARE_ATTRIBUTED_CONST, CONST, CONST)
82938293
ZEND_CONSTANT_SET_FLAGS(&c, 0, PHP_USER_CONSTANT);
82948294
c.name = zend_string_copy(Z_STR_P(name));
82958295

8296-
if (zend_register_constant(&c) == FAILURE) {
8296+
registered = zend_register_constant(&c);
8297+
if (registered == NULL) {
82978298
FREE_OP1();
82988299
FREE_OP2();
82998300
/* two opcodes used, second one is the data with attributes */
83008301
ZEND_VM_NEXT_OPCODE_EX(1, 2);
83018302
}
83028303

83038304
HashTable *attributes = Z_PTR_P(GET_OP_DATA_ZVAL_PTR(BP_VAR_R));
8304-
zend_constant *registered = zend_get_constant_ptr(c.name);
83058305
ZEND_ASSERT(attributes != NULL);
8306-
ZEND_ASSERT(registered != NULL);
83078306
zend_constant_add_attributes(registered, attributes);
83088307

83098308
FREE_OP1();

Zend/zend_vm_execute.h

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

0 commit comments

Comments
 (0)