Skip to content

Commit a212d4c

Browse files
committed
Merge remote-tracking branch 'php/master'
2 parents 8ea607c + f2f9831 commit a212d4c

40 files changed

+434
-47
lines changed

.github/scripts/windows/build_task.bat

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ set CFLAGS=/W1 /WX
3636
cmd /c configure.bat ^
3737
--enable-snapshot-build ^
3838
--disable-debug-pack ^
39-
--enable-com-dotnet=shared ^
4039
--without-analyzer ^
4140
--enable-object-out-dir=%PHP_BUILD_OBJ_DIR% ^
4241
--with-php-build=%DEPS_DIR% ^

.github/workflows/labeler.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ permissions:
77

88
jobs:
99
triage:
10+
if: github.repository == 'php/php-src'
1011
permissions:
1112
pull-requests: write
1213
runs-on: ubuntu-latest

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ PHP NEWS
88
- Core:
99
. Fixed bug GH-16665 (\array and \callable should not be usable in
1010
class_alias). (nielsdos)
11+
. Added PHP_BUILD_DATE constant. (cmb)
1112

1213
- Curl:
1314
. Added curl_multi_get_handles(). (timwolla)

UPGRADING

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ PHP 8.5 UPGRADE NOTES
129129
10. New Global Constants
130130
========================================
131131

132+
- Core:
133+
. PHP_BUILD_DATE.
134+
132135
- POSIX:
133136
. POSIX_SC_OPEN_MAX.
134137

@@ -147,6 +150,11 @@ PHP 8.5 UPGRADE NOTES
147150
PHP_RELEASE_VERSION are now always numbers. Previously, they have been
148151
strings for buildconf builds.
149152

153+
* COM:
154+
. The extension is now build shared by default; previously it defaulted to a
155+
static extension, although the official Windows binaries built a shared
156+
extension.
157+
150158
* FFI:
151159
. It is no longer necessary to specify the library when using FFI::cdef()
152160
and FFI::load(). However, this convenience feature should not be used in

Zend/tests/gh16630.phpt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
GH-16630 (UAF in lexer with encoding translation and heredocs)
3+
--EXTENSIONS--
4+
mbstring
5+
--INI--
6+
zend.multibyte=On
7+
zend.script_encoding=ISO-8859-1
8+
internal_encoding=EUC-JP
9+
--FILE--
10+
<?php
11+
$data3 = <<<CODE
12+
heredoc
13+
text
14+
CODE;
15+
echo $data3;
16+
?>
17+
--EXPECT--
18+
heredoc
19+
text

Zend/tests/gh16725.phpt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--TEST--
2+
GH-16725: Incorrect access check for non-hooked props in hooked object iterator
3+
--FILE--
4+
<?php
5+
6+
class C implements JsonSerializable
7+
{
8+
private string $prop1 { get => 'bar'; }
9+
10+
public function __construct(
11+
private string $prop2,
12+
) {}
13+
14+
public function jsonSerialize(): mixed {
15+
return get_object_vars($this);
16+
}
17+
}
18+
19+
$obj = new C('foo');
20+
var_dump(get_object_vars($obj));
21+
echo json_encode($obj);
22+
23+
?>
24+
--EXPECT--
25+
array(0) {
26+
}
27+
{"prop1":"bar","prop2":"foo"}

Zend/zend_hash.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@
3030
#define HASH_KEY_IS_LONG 2
3131
#define HASH_KEY_NON_EXISTENT 3
3232

33-
#define HASH_UPDATE (1<<0)
34-
#define HASH_ADD (1<<1)
35-
#define HASH_UPDATE_INDIRECT (1<<2)
36-
#define HASH_ADD_NEW (1<<3)
37-
#define HASH_ADD_NEXT (1<<4)
38-
#define HASH_LOOKUP (1<<5)
33+
#define HASH_UPDATE (1<<0) /* Create new entry, or update the existing one. */
34+
#define HASH_ADD (1<<1) /* Create new entry, or fail if it exists. */
35+
#define HASH_UPDATE_INDIRECT (1<<2) /* If the given ht entry is an indirect zval, unwrap it before writing to it. \
36+
* When used with HASH_ADD, writing is allowed if the target zval is IS_UNDEF. */
37+
#define HASH_ADD_NEW (1<<3) /* Used when the offset is known not to exist. */
38+
#define HASH_ADD_NEXT (1<<4) /* Append to an array. (e.g. $array[] = 42;) */
39+
#define HASH_LOOKUP (1<<5) /* Look up an existing entry, or create one with a NULL value. */
3940

4041
#define HASH_FLAG_CONSISTENCY ((1<<0) | (1<<1))
4142
#define HASH_FLAG_PACKED (1<<2)

Zend/zend_language_scanner.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state)
275275
CG(zend_lineno) = lex_state->lineno;
276276
zend_restore_compiled_filename(lex_state->filename);
277277

278-
if (SCNG(script_filtered)) {
278+
if (SCNG(script_filtered) && SCNG(script_filtered) != lex_state->script_filtered) {
279279
efree(SCNG(script_filtered));
280280
SCNG(script_filtered) = NULL;
281281
}

Zend/zend_property_hooks.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ static zend_array *zho_build_properties_ex(zend_object *zobj, bool check_access,
8989
if (UNEXPECTED(Z_TYPE_P(OBJ_PROP(zobj, prop_info->offset)) == IS_UNDEF)) {
9090
HT_FLAGS(properties) |= HASH_FLAG_HAS_EMPTY_IND;
9191
}
92-
zend_hash_update_ind(properties, property_name, OBJ_PROP(zobj, prop_info->offset));
92+
zval *tmp = zend_hash_lookup(properties, property_name);
93+
ZVAL_INDIRECT(tmp, OBJ_PROP(zobj, prop_info->offset));
9394
}
9495
skip_property:
9596
if (property_name != prop_info->name) {

ext/bcmath/bcmath.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,10 @@ PHP_FUNCTION(bcpow)
615615
goto cleanup;
616616
}
617617

618-
bc_raise(first, exponent, &result, scale);
618+
if (!bc_raise(first, exponent, &result, scale)) {
619+
zend_throw_exception_ex(zend_ce_division_by_zero_error, 0, "Negative power of zero");
620+
goto cleanup;
621+
}
619622

620623
RETVAL_NEW_STR(bc_num2str_ex(result, scale));
621624

@@ -1141,7 +1144,10 @@ static zend_result bcmath_number_pow_internal(
11411144
}
11421145
return FAILURE;
11431146
}
1144-
bc_raise(n1, exponent, ret, *scale);
1147+
if (!bc_raise(n1, exponent, ret, *scale)) {
1148+
zend_throw_exception_ex(zend_ce_division_by_zero_error, 0, "Negative power of zero");
1149+
return FAILURE;
1150+
}
11451151
bc_rm_trailing_zeros(*ret);
11461152
if (scale_expand) {
11471153
size_t diff = *scale - (*ret)->n_scale;

0 commit comments

Comments
 (0)