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
13 changes: 13 additions & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,19 @@ PHP 8.6 INTERNALS UPGRADE NOTES
2. Build system changes
========================

- Abstract:
. Minimum required PHP version found on the host system for running scripts
like build/gen_stub.php during development has been updated from 7.4 to 8.1.
. build/gen_stub.php may now generate a _decl.h file in addition to
the _arginfo.h file, if the stub declares enums and is annotated with
@generate-c-enums. For each enum the file will contain a C enum. Enum
values can be compared to the result of
zend_enum_fetch_case_id(zend_object*).

- Unix build system changes:
. Symbol HAVE_ST_BLOCKS has been removed from php_config.h (use
HAVE_STRUCT_STAT_ST_BLOCKS).

========================
3. Module changes
========================
Expand All @@ -100,6 +107,12 @@ PHP 8.6 INTERNALS UPGRADE NOTES
`void **mod_data, zend_string *save_path, zend_string *session_name`
rather than
`void **mod_data, const char *save_path, const char *session_name`
. PS_FUNCS() now includes the PS_VALIDATE_SID_FUNC()
. PS_MOD() now requires that the PS_CREATE_SID_FUNC() and
PS_VALIDATE_SID_FUNC() functions are defined.
. PS_FUNCS_SID() and PS_MOD_SID() have been removed.
Either use PS_FUNCS()/PS_MOD() or PS_FUNCS_UPDATE_TIMESTAMP()/
PS_MOD_UPDATE_TIMESTAMP() if timestamp support exists.

- ext/standard:
. _php_error_log() now has a formal return type of zend_result.
Expand Down
14 changes: 7 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ PHP_RUNPATH_SWITCH
dnl Checks for some support/generator progs.
PHP_PROG_BISON([3.0.0])
PHP_PROG_RE2C([1.0.3], [--no-generation-date])
dnl Find installed PHP. Minimum supported version for gen_stub.php is PHP 7.4.
PHP_PROG_PHP([7.4])
dnl Find installed PHP. Minimum supported version for gen_stub.php is PHP 8.1.
PHP_PROG_PHP([8.1])

PHP_ARG_ENABLE([re2c-cgoto],
[whether to enable computed goto extension with re2c],
Expand Down Expand Up @@ -504,11 +504,11 @@ AS_VAR_IF([php_cv_have_alignof], [yes],

dnl Check for structure members.
AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include <time.h>])
AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev])
dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exist.
if test "$(uname -s 2>/dev/null)" != "QNX"; then
AC_STRUCT_ST_BLOCKS
fi
AC_CHECK_MEMBERS(m4_normalize([
struct stat.st_blksize,
struct stat.st_blocks,
struct stat.st_rdev
]))

dnl Checks for types.
AC_TYPE_UID_T
Expand Down
5 changes: 1 addition & 4 deletions ext/dom/xpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,7 @@ PHP_METHOD(DOMXPath, registerNamespace)
RETURN_THROWS();
}

if (xmlXPathRegisterNs(ctxp, prefix, ns_uri) != 0) {
RETURN_FALSE;
}
RETURN_TRUE;
RETURN_BOOL(xmlXPathRegisterNs(ctxp, prefix, ns_uri) == 0);
}
/* }}} */

Expand Down
5 changes: 1 addition & 4 deletions ext/ftp/php_ftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -678,11 +678,8 @@ PHP_FUNCTION(ftp_pasv)
}
GET_FTPBUF(ftp, z_ftp);

if (!ftp_pasv(ftp, pasv ? 1 : 0)) {
RETURN_FALSE;
}
RETURN_BOOL(ftp_pasv(ftp, pasv ? 1 : 0));

RETURN_TRUE;
}
/* }}} */

Expand Down
4 changes: 3 additions & 1 deletion ext/phar/func_interceptors.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,10 @@ static void phar_file_stat(const char *filename, size_t filename_length, int typ
if (data) {
sb.st_ino = data->inode;
}
#ifndef PHP_WIN32
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
sb.st_blksize = -1;
#endif
#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
sb.st_blocks = -1;
#endif
phar_fancy_stat(&sb, type, return_value);
Expand Down
4 changes: 3 additions & 1 deletion ext/phar/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,10 @@ void phar_dostat(phar_archive_data *phar, phar_entry_info *data, php_stream_stat
if (!is_temp_dir) {
ssb->sb.st_ino = data->inode;
}
#ifndef PHP_WIN32
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
ssb->sb.st_blksize = -1;
#endif
#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
ssb->sb.st_blocks = -1;
#endif
}
Expand Down
6 changes: 2 additions & 4 deletions ext/readline/readline.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,10 +495,8 @@ PHP_FUNCTION(readline_completion_function)

/* NOTE: The rl_attempted_completion_function variable (and others) are part of the readline library, not php */
rl_attempted_completion_function = php_readline_completion_cb;
if (rl_attempted_completion_function == NULL) {
RETURN_FALSE;
}
RETURN_TRUE;

RETURN_BOOL(rl_attempted_completion_function != NULL);
}

/* }}} */
Expand Down
42 changes: 21 additions & 21 deletions ext/session/mod_mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ static zend_result ps_mm_key_exists(ps_mm *data, const zend_string *key)
}

const ps_module ps_mod_mm = {
PS_MOD_SID(mm)
PS_MOD(mm)
};

#define PS_MM_DATA ps_mm *data = PS_GET_MOD_DATA()
Expand Down Expand Up @@ -346,26 +346,7 @@ PS_READ_FUNC(mm)

mm_lock(data->mm, MM_LOCK_RD);

/* If there is an ID and strict mode, verify existence */
if (PS(use_strict_mode)
&& ps_mm_key_exists(data, key) == FAILURE) {
/* key points to PS(id), but cannot change here. */
if (key) {
efree(PS(id));
PS(id) = NULL;
}
PS(id) = PS(mod)->s_create_sid((void **)&data);
if (!PS(id)) {
return FAILURE;
}
if (PS(use_cookies)) {
PS(send_cookie) = true;
}
php_session_reset_id();
PS(session_status) = php_session_active;
}

sd = ps_sd_lookup(data, PS(id), false);
sd = ps_sd_lookup(data, key, false);
if (sd) {
*val = zend_string_init(sd->data, sd->datalen, false);
ret = SUCCESS;
Expand Down Expand Up @@ -488,4 +469,23 @@ PS_CREATE_SID_FUNC(mm)
return sid;
}

/*
* Check session ID existence for use_strict_mode support.
* PARAMETERS: PS_VALIDATE_SID_ARGS in php_session.h
* RETURN VALUE: SUCCESS or FAILURE.
*
* Return SUCCESS for valid key(already existing session).
* Return FAILURE for invalid key(non-existing session).
* *mod_data, *key are guaranteed to have non-NULL values.
*/
PS_VALIDATE_SID_FUNC(mm)
{
PS_MM_DATA;

mm_lock(data->mm, MM_LOCK_RD);
zend_result ret = ps_mm_key_exists(data, key)
mm_unlock(data->mm);
return ret;
}

#endif
27 changes: 5 additions & 22 deletions ext/session/php_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,40 +62,23 @@ typedef struct ps_module_struct {
#define PS_VALIDATE_SID_FUNC(x) zend_result ps_validate_sid_##x(PS_VALIDATE_SID_ARGS)
#define PS_UPDATE_TIMESTAMP_FUNC(x) zend_result ps_update_timestamp_##x(PS_UPDATE_TIMESTAMP_ARGS)

/* Legacy save handler module definitions */
/* Save handler module definitions without timestamp enabled */
#define PS_FUNCS(x) \
PS_OPEN_FUNC(x); \
PS_CLOSE_FUNC(x); \
PS_READ_FUNC(x); \
PS_WRITE_FUNC(x); \
PS_DESTROY_FUNC(x); \
PS_GC_FUNC(x); \
PS_CREATE_SID_FUNC(x)
PS_CREATE_SID_FUNC(x) \
PS_VALIDATE_SID_FUNC(x);

#define PS_MOD(x) \
#x, ps_open_##x, ps_close_##x, ps_read_##x, ps_write_##x, \
ps_delete_##x, ps_gc_##x, php_session_create_id, \
php_session_validate_sid, php_session_update_timestamp

/* Legacy SID creation enabled save handler module definitions */
#define PS_FUNCS_SID(x) \
PS_OPEN_FUNC(x); \
PS_CLOSE_FUNC(x); \
PS_READ_FUNC(x); \
PS_WRITE_FUNC(x); \
PS_DESTROY_FUNC(x); \
PS_GC_FUNC(x); \
PS_CREATE_SID_FUNC(x); \
PS_VALIDATE_SID_FUNC(x); \
PS_UPDATE_TIMESTAMP_FUNC(x);

#define PS_MOD_SID(x) \
#x, ps_open_##x, ps_close_##x, ps_read_##x, ps_write_##x, \
ps_delete_##x, ps_gc_##x, ps_create_sid_##x, \
php_session_validate_sid, php_session_update_timestamp
ps_validate_sid_##x, NULL

/* Update timestamp enabled save handler module definitions
New save handlers should use this API */
/* Save handlers with timestamp enabled, it is recommended to use this API */
#define PS_FUNCS_UPDATE_TIMESTAMP(x) \
PS_OPEN_FUNC(x); \
PS_CLOSE_FUNC(x); \
Expand Down
4 changes: 3 additions & 1 deletion ext/zip/zip_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,10 @@ static int php_zip_ops_stat(php_stream *stream, php_stream_statbuf *ssb) /* {{{
ssb->sb.st_ctime = sb.mtime;
ssb->sb.st_nlink = 1;
ssb->sb.st_rdev = -1;
#ifndef PHP_WIN32
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
ssb->sb.st_blksize = -1;
#endif
#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
ssb->sb.st_blocks = -1;
#endif
ssb->sb.st_ino = -1;
Expand Down
4 changes: 3 additions & 1 deletion main/streams/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,10 @@ static int php_stream_memory_stat(php_stream *stream, php_stream_statbuf *ssb) /
/* generate unique inode number for alias/filename, so no phars will conflict */
ssb->sb.st_ino = 0;

#ifndef PHP_WIN32
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
ssb->sb.st_blksize = -1;
#endif
#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
ssb->sb.st_blocks = -1;
#endif

Expand Down
Loading