Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ PHP NEWS

- Core:
. Fixed line number of JMP instruction over else block. (ilutov)
. Fixed use-of-uninitialized-value with ??= on assert. (ilutov)

- OpenSSL
. Added support for additional EC parameters in openssl_pkey_new. (Eno-CN)

06 Jul 2023, PHP 8.3.0alpha3

Expand Down
4 changes: 4 additions & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ PHP 8.3 INTERNALS UPGRADE NOTES
- zend_set_user_opcode_handler
- zend_ssa_inference
* Removed unused macros PHP_FNV1_32A_INIT and PHP_FNV1A_64_INIT. See GH-11114.
* _php_stream_dirent now has an extra d_type field that is used to store the
directory entry type. This can be used to avoid additional stat calls for
types when the type is already known.

========================
2. Build system changes
Expand Down Expand Up @@ -115,6 +118,7 @@ PHP 8.3 INTERNALS UPGRADE NOTES
e. ext/spl
- The PHPAPI spl_iterator_apply() function now returns zend_result instead of int.
There are no functional changes.
- The field _spl_filesystem_object->is_recursive has been removed.

f. ext/dom
- A new function dom_get_doc_props_read_only() is added to gather the document
Expand Down
13 changes: 13 additions & 0 deletions Zend/tests/gh11580.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--TEST--
GH-11580: assert() with ??= operator can lead to use-of-uninitialized-value
--INI--
zend.assertions=0
--FILE--
<?php
assert(y)[y] ??= y;
?>
--EXPECTF--
Fatal error: Uncaught Error: Undefined constant "y" in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
6 changes: 6 additions & 0 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -4203,6 +4203,10 @@ static void zend_compile_assert(znode *result, zend_ast_list *args, zend_string
zend_op *opline;
uint32_t check_op_number = get_next_op_number();

/* Assert expression may not be memoized and reused as it may not actually be evaluated. */
int orig_memoize_mode = CG(memoize_mode);
CG(memoize_mode) = ZEND_MEMOIZE_NONE;

zend_emit_op(NULL, ZEND_ASSERT_CHECK, NULL, NULL);

if (fbc && fbc_is_finalized(fbc)) {
Expand Down Expand Up @@ -4236,6 +4240,8 @@ static void zend_compile_assert(znode *result, zend_ast_list *args, zend_string
opline = &CG(active_op_array)->opcodes[check_op_number];
opline->op2.opline_num = get_next_op_number();
SET_NODE(opline->result, result);

CG(memoize_mode) = orig_memoize_mode;
} else {
if (!fbc) {
zend_string_release_ex(name, 0);
Expand Down
10 changes: 10 additions & 0 deletions Zend/zend_virtual_cwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ typedef unsigned short mode_t;
#else
#ifdef HAVE_DIRENT_H
#include <dirent.h>

#ifndef DT_UNKNOWN
# define DT_UNKNOWN 0
#endif
#ifndef DT_DIR
# define DT_DIR 4
#endif
#ifndef DT_REG
# define DT_REG 8
#endif
#endif

#define DEFAULT_SLASH '/'
Expand Down
Loading