Skip to content
Merged
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
1 change: 0 additions & 1 deletion .github/scripts/windows/build_task.bat
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ set CFLAGS=/W1 /WX
cmd /c configure.bat ^
--enable-snapshot-build ^
--disable-debug-pack ^
--enable-com-dotnet=shared ^
--without-analyzer ^
--enable-object-out-dir=%PHP_BUILD_OBJ_DIR% ^
--with-php-build=%DEPS_DIR% ^
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ permissions:

jobs:
triage:
if: github.repository == 'php/php-src'
permissions:
pull-requests: write
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ PHP NEWS
- Core:
. Fixed bug GH-16665 (\array and \callable should not be usable in
class_alias). (nielsdos)
. Added PHP_BUILD_DATE constant. (cmb)

- Curl:
. Added curl_multi_get_handles(). (timwolla)
Expand Down
8 changes: 8 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ PHP 8.5 UPGRADE NOTES
10. New Global Constants
========================================

- Core:
. PHP_BUILD_DATE.

- POSIX:
. POSIX_SC_OPEN_MAX.

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

* COM:
. The extension is now build shared by default; previously it defaulted to a
static extension, although the official Windows binaries built a shared
extension.

* FFI:
. It is no longer necessary to specify the library when using FFI::cdef()
and FFI::load(). However, this convenience feature should not be used in
Expand Down
19 changes: 19 additions & 0 deletions Zend/tests/gh16630.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--TEST--
GH-16630 (UAF in lexer with encoding translation and heredocs)
--EXTENSIONS--
mbstring
--INI--
zend.multibyte=On
zend.script_encoding=ISO-8859-1
internal_encoding=EUC-JP
--FILE--
<?php
$data3 = <<<CODE
heredoc
text
CODE;
echo $data3;
?>
--EXPECT--
heredoc
text
13 changes: 7 additions & 6 deletions Zend/zend_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@
#define HASH_KEY_IS_LONG 2
#define HASH_KEY_NON_EXISTENT 3

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

#define HASH_FLAG_CONSISTENCY ((1<<0) | (1<<1))
#define HASH_FLAG_PACKED (1<<2)
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_language_scanner.l
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state)
CG(zend_lineno) = lex_state->lineno;
zend_restore_compiled_filename(lex_state->filename);

if (SCNG(script_filtered)) {
if (SCNG(script_filtered) && SCNG(script_filtered) != lex_state->script_filtered) {
efree(SCNG(script_filtered));
SCNG(script_filtered) = NULL;
}
Expand Down
2 changes: 1 addition & 1 deletion ext/com_dotnet/config.w32
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// vim:ft=javascript

ARG_ENABLE("com-dotnet", "COM and .Net support", "yes");
ARG_ENABLE("com-dotnet", "COM and .Net support", "yes,shared");

if (PHP_COM_DOTNET == "yes") {
CHECK_LIB('oleaut32.lib', 'com_dotnet');
Expand Down
6 changes: 4 additions & 2 deletions ext/opcache/config.w32
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG_ENABLE("opcache", "whether to enable Zend OPcache support", "yes");
ARG_ENABLE("opcache-jit", "whether to enable JIT", "yes");
ARG_ENABLE("opcache-jit", "whether to enable JIT (not supported for ARM64)", "yes");


if (PHP_OPCACHE != "no") {
Expand All @@ -22,7 +22,9 @@ if (PHP_OPCACHE != "no") {
ADD_EXTENSION_DEP('opcache', 'pcre');

if (PHP_OPCACHE_JIT == "yes") {
if (CHECK_HEADER_ADD_INCLUDE("ir/ir.h", "CFLAGS_OPCACHE", PHP_OPCACHE + ";ext\\opcache\\jit")) {
if (TARGET_ARCH == 'arm64') {
WARNING("JIT not enabled; not yet supported for ARM64");
} else if (CHECK_HEADER_ADD_INCLUDE("ir/ir.h", "CFLAGS_OPCACHE", PHP_OPCACHE + ";ext\\opcache\\jit")) {
var dasm_flags = (X64 ? "-D X64=1" : "") + (X64 ? " -D X64WIN=1" : "") + " -D WIN=1";
var ir_target = (X64 ? "IR_TARGET_X64" : "IR_TARGET_X86");
var ir_src = "ir_strtab.c ir_cfg.c ir_sccp.c ir_gcm.c ir_ra.c ir_save.c \
Expand Down
12 changes: 12 additions & 0 deletions ext/opcache/jit/zend_jit_ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1826,6 +1826,9 @@ static void jit_ZVAL_PTR_DTOR(zend_jit_ctx *jit,
ir_END_list(end_inputs);
ir_IF_FALSE(if_may_not_leak);

if (opline) {
jit_SET_EX_OPLINE(jit, opline);
}
ir_CALL_1(IR_VOID, ir_CONST_FC_FUNC(gc_possible_root), ref);
}

Expand Down Expand Up @@ -6518,6 +6521,9 @@ static int zend_jit_assign_to_variable(zend_jit_ctx *jit,
if (RC_MAY_BE_N(var_info) && (var_info & (MAY_BE_ARRAY|MAY_BE_OBJECT)) != 0) {
ir_ref if_may_leak = jit_if_GC_MAY_NOT_LEAK(jit, ref);
ir_IF_FALSE(if_may_leak);
if (opline) {
jit_SET_EX_OPLINE(jit, opline);
}
ir_CALL_1(IR_VOID, ir_CONST_FC_FUNC(gc_possible_root), ref);

if (Z_MODE(var_addr) == IS_REG || Z_MODE(res_addr) == IS_REG) {
Expand Down Expand Up @@ -6545,6 +6551,9 @@ static int zend_jit_assign_to_variable(zend_jit_ctx *jit,
if (var_info & (MAY_BE_ARRAY|MAY_BE_OBJECT)) {
ir_ref if_may_leak = jit_if_GC_MAY_NOT_LEAK(jit, ref);
ir_IF_FALSE(if_may_leak);
if (opline) {
jit_SET_EX_OPLINE(jit, opline);
}
ir_CALL_1(IR_VOID, ir_CONST_FC_FUNC(gc_possible_root), ref);
ir_END_list(simple_inputs);
ir_IF_TRUE(if_may_leak);
Expand Down Expand Up @@ -11410,6 +11419,9 @@ static int zend_jit_bind_global(zend_jit_ctx *jit, const zend_op *opline, uint32
ir_IF_TRUE(if_may_not_leak);
ir_END_list(end_inputs);
ir_IF_FALSE(if_may_not_leak);
if (opline) {
jit_SET_EX_OPLINE(jit, opline);
}
ir_CALL_1(IR_VOID, ir_CONST_FC_FUNC(gc_possible_root), ref2);
}
if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - (MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ PHPAPI ZEND_COLD void php_print_info(int flag)
php_info_print_box_end();
php_info_print_table_start();
php_info_print_table_row(2, "System", ZSTR_VAL(php_uname));
php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__);
php_info_print_table_row(2, "Build Date", php_build_date);
#ifdef PHP_BUILD_SYSTEM
php_info_print_table_row(2, "Build System", PHP_BUILD_SYSTEM);
#endif
Expand Down
6 changes: 4 additions & 2 deletions main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ PHPAPI size_t core_globals_offset;

#define SAFE_FILENAME(f) ((f)?(f):"-")

const char php_build_date[] = __DATE__ " " __TIME__;

PHPAPI const char *php_version(void)
{
return PHP_VERSION;
Expand All @@ -110,8 +112,8 @@ PHPAPI unsigned int php_version_id(void)
PHPAPI char *php_get_version(sapi_module_struct *sapi_module)
{
char *version_info;
spprintf(&version_info, 0, "PHP %s (%s) (built: %s %s) (%s)\nCopyright (c) The PHP Group\n%s%s",
PHP_VERSION, sapi_module->name, __DATE__, __TIME__,
spprintf(&version_info, 0, "PHP %s (%s) (built: %s) (%s)\nCopyright (c) The PHP Group\n%s%s",
PHP_VERSION, sapi_module->name, php_build_date,
#ifdef ZTS
"ZTS"
#else
Expand Down
7 changes: 7 additions & 0 deletions main/main.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@
* @cvalue PHP_VERSION_ID
*/
const PHP_VERSION_ID = UNKNOWN;

/**
* @var string
* @cvalue php_build_date
*/
const PHP_BUILD_DATE = UNKNOWN;

/**
* @var bool
* @cvalue PHP_ZTS
Expand Down
3 changes: 2 additions & 1 deletion main/main_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions main/php.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ END_EXTERN_C()
extern char **environ;
#endif /* ifndef PHP_WIN32 */

extern const char php_build_date[];

#ifdef PHP_PWRITE_64
ssize_t pwrite(int, void *, size_t, off64_t);
#endif
Expand Down
8 changes: 8 additions & 0 deletions tests/basic/build_date.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
--TEST--
PHP_BUILD_DATE
--FILE--
<?php
var_dump(PHP_BUILD_DATE);
?>
--EXPECTREGEX--
string\(20\) "[A-Za-z]{3} \d{2} \d{4} \d{2}:\d{2}:\d{2}"