Skip to content

Fix PHP 8.5 #5817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion .github/workflows/ext.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ '8.1', '8.2', '8.3', '8.4' ]
php-version: [ '8.1', '8.2', '8.3', '8.4', '8.5' ]
max-parallel: 8
fail-fast: false
continue-on-error: ${{ matrix.php-version == '8.5' }}
steps:
- uses: actions/checkout@v4
- name: build
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/framework.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: [ '8.1', '8.2', '8.3', '8.4' ]
php-version: [ '8.1', '8.2', '8.3', '8.4', '8.5' ]
framework: [ 'Laravel Octane', 'Hyperf', 'Simps' ]
continue-on-error: ${{ matrix.php-version == '8.5' }}
name: ${{ matrix.framework }} - PHP ${{ matrix.php-version }}
steps:
- name: Checkout code
Expand Down Expand Up @@ -86,8 +87,9 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: [ '8.1', '8.2', '8.3' ]
php-version: [ '8.1', '8.2', '8.3', '8.5' ]
framework: [ 'Simps' ]
continue-on-error: ${{ matrix.php-version == '8.5' }}
name: ${{ matrix.framework }} - PHP ${{ matrix.php-version }} - macOS
steps:
- name: Checkout code
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/iouring.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '8.1', '8.2', '8.3', '8.4' ]
php: [ '8.1', '8.2', '8.3', '8.4', '8.5' ]
os: [ ubuntu-24.04, ubuntu-24.04-arm ]
continue-on-error: ${{ matrix.php == '8.5' }}
name: ${{ matrix.php }}-${{ matrix.os }}-iouring
runs-on: ${{ matrix.os }}
steps:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/thread.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['8.1-zts', '8.2-zts', '8.3-zts', '8.4-zts']
php: ['8.1-zts', '8.2-zts', '8.3-zts', '8.4-zts', '8.5-zts']
os: [ ubuntu-24.04, ubuntu-24.04-arm ]
continue-on-error: ${{ matrix.php == '8.5-zts' }}
name: ${{ matrix.php }}-thread-${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2', '8.3', '8.4']
php: ['8.1', '8.2', '8.3', '8.4', '8.5']
os: [ ubuntu-24.04, ubuntu-24.04-arm ]
continue-on-error: ${{ matrix.php == '8.5' }}
name: ${{ matrix.php }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -50,8 +51,9 @@ jobs:
strategy:
fail-fast: false
matrix:
# php-version: [ '8.1', '8.2', '8.3', '8.4' ]
# php-version: [ '8.1', '8.2', '8.3', '8.4', '8.5' ]
php-version: [ '8.1' ]
continue-on-error: ${{ matrix.php-version == '8.5' }}
name: ${{ matrix.php-version }} - macOS
steps:
- name: Checkout code
Expand Down
4 changes: 4 additions & 0 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -1343,20 +1343,24 @@ EOF
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php81/pdo_pgsql)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php83/pdo_pgsql)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php84/pdo_pgsql)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php85/pdo_pgsql)
fi
if test "$PHP_SWOOLE_ODBC" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php81/pdo_odbc)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php83/pdo_odbc)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php84/pdo_odbc)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php85/pdo_odbc)
fi
if test "$PHP_SWOOLE_ORACLE" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php81/pdo_oci)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php83/pdo_oci)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php84/pdo_oci)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php85/pdo_oci)
fi
if test "$PHP_SWOOLE_SQLITE" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php81/pdo_sqlite)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php83/pdo_sqlite)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php84/pdo_sqlite)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php85/pdo_sqlite)
fi
fi
4 changes: 3 additions & 1 deletion ext-src/php_swoole_odbc.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ BEGIN_EXTERN_C()
#include "thirdparty/php81/pdo_odbc/php_pdo_odbc_int.h"
#elif PHP_VERSION_ID >= 80300 && PHP_VERSION_ID < 80400
#include "thirdparty/php83/pdo_odbc/php_pdo_odbc_int.h"
#else
#elif PHP_VERSION_ID >= 80400 && PHP_VERSION_ID < 80500
#include "thirdparty/php84/pdo_odbc/php_pdo_odbc_int.h"
#else
#include "thirdparty/php85/pdo_odbc/php_pdo_odbc_int.h"
#endif

extern const pdo_driver_t swoole_pdo_odbc_driver;
Expand Down
4 changes: 3 additions & 1 deletion ext-src/php_swoole_oracle.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ BEGIN_EXTERN_C()
#include "thirdparty/php81/pdo_oci/php_pdo_oci_int.h"
#elif PHP_VERSION_ID >= 80300 && PHP_VERSION_ID < 80400
#include "thirdparty/php83/pdo_oci/php_pdo_oci_int.h"
#else
#elif PHP_VERSION_ID >= 80400 && PHP_VERSION_ID < 80500
#include "thirdparty/php84/pdo_oci/php_pdo_oci_int.h"
#else
#include "thirdparty/php85/pdo_oci/php_pdo_oci_int.h"
#endif

extern const pdo_driver_t swoole_pdo_oci_driver;
Expand Down
4 changes: 3 additions & 1 deletion ext-src/php_swoole_pgsql.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ BEGIN_EXTERN_C()
#include "thirdparty/php81/pdo_pgsql/php_pdo_pgsql_int.h"
#elif PHP_VERSION_ID >= 80300 && PHP_VERSION_ID < 80400
#include "thirdparty/php83/pdo_pgsql/php_pdo_pgsql_int.h"
#else
#elif PHP_VERSION_ID >= 80400 && PHP_VERSION_ID < 80500
#include "thirdparty/php84/pdo_pgsql/php_pdo_pgsql_int.h"
#else
#include "thirdparty/php85/pdo_pgsql/php_pdo_pgsql_int.h"
#endif


Expand Down
4 changes: 3 additions & 1 deletion ext-src/php_swoole_sqlite.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ BEGIN_EXTERN_C()
#include "thirdparty/php81/pdo_sqlite/php_pdo_sqlite_int.h"
#elif PHP_VERSION_ID >= 80300 && PHP_VERSION_ID < 80400
#include "thirdparty/php83/pdo_sqlite/php_pdo_sqlite_int.h"
#else
#elif PHP_VERSION_ID >= 80400 && PHP_VERSION_ID < 80500
#include "thirdparty/php84/pdo_sqlite/php_pdo_sqlite_int.h"
#else
#include "thirdparty/php85/pdo_sqlite/php_pdo_sqlite_int.h"
#endif

extern const pdo_driver_t swoole_pdo_sqlite_driver;
Expand Down
12 changes: 12 additions & 0 deletions ext-src/swoole_runtime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,24 @@ static zend_internal_arg_info *copy_arginfo(const zend_function *zf, zend_intern
memcpy(new_list, old_list, ZEND_TYPE_LIST_SIZE(old_list->num_types));
ZEND_TYPE_SET_PTR(new_arg_info[i].type, new_list);

#if PHP_VERSION_ID >= 80500
// For PHP 8.5+, ZEND_TYPE_LIST_FOREACH gives a const pointer, which we can't modify.
// We must use a manual loop over the list we allocated ourselves.
for (uint32_t j = 0; j < new_list->num_types; j++) {
zend_type *list_type = &new_list->types[j];
if (ZEND_TYPE_HAS_NAME(*list_type)) {
zend_string *name = zend_string_dup(ZEND_TYPE_NAME(*list_type), 1);
ZEND_TYPE_SET_PTR(*list_type, name);
}
}
#else
zend_type *list_type;
ZEND_TYPE_LIST_FOREACH(new_list, list_type) {
zend_string *name = zend_string_dup(ZEND_TYPE_NAME(*list_type), true);
ZEND_TYPE_SET_PTR(*list_type, name);
}
ZEND_TYPE_LIST_FOREACH_END();
#endif
} else if (ZEND_TYPE_HAS_NAME(arg_info[i].type)) {
zend_string *name = zend_string_dup(ZEND_TYPE_NAME(arg_info[i].type), true);
ZEND_TYPE_SET_PTR(new_arg_info[i].type, name);
Expand Down
6 changes: 5 additions & 1 deletion thirdparty/php/main/SAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ static void swoole_php_treat_data(int arg, char *str, zval *destArray) {

switch (arg) {
case PARSE_STRING:
separator = PG(arg_separator).input;
#if PHP_VERSION_ID >= 80500
separator = ZSTR_VAL(PG(arg_separator).input);
#else
separator = PG(arg_separator).input;
#endif
break;
case PARSE_COOKIE:
separator = (char *) ";\0";
Expand Down
162 changes: 162 additions & 0 deletions thirdparty/php85/curl/curl_arginfo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: ddfcdd8a0bf0ee6c338ec1689c6de5d7fd87303d */
#include "swoole_curl_interface.h"

#if defined(SW_USE_CURL) && PHP_VERSION_ID >= 80400
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_swoole_native_curl_close, 0, 1, IS_VOID, 0)
ZEND_ARG_OBJ_INFO(0, handle, CurlHandle, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_swoole_native_curl_copy_handle, 0, 1, CurlHandle, MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, handle, CurlHandle, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_swoole_native_curl_errno, 0, 1, IS_LONG, 0)
ZEND_ARG_OBJ_INFO(0, handle, CurlHandle, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_swoole_native_curl_error, 0, 1, IS_STRING, 0)
ZEND_ARG_OBJ_INFO(0, handle, CurlHandle, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_swoole_native_curl_escape, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, handle, CurlHandle, 0)
ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
ZEND_END_ARG_INFO()

#define arginfo_swoole_native_curl_unescape arginfo_swoole_native_curl_escape

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_swoole_native_curl_multi_setopt, 0, 3, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, multi_handle, CurlMultiHandle, 0)
ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_swoole_native_curl_exec, 0, 1, MAY_BE_STRING|MAY_BE_BOOL)
ZEND_ARG_OBJ_INFO(0, handle, CurlHandle, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_swoole_native_curl_getinfo, 0, 1, IS_MIXED, 0)
ZEND_ARG_OBJ_INFO(0, handle, CurlHandle, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, option, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_swoole_native_curl_init, 0, 0, CurlHandle, MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, url, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()

#if LIBCURL_VERSION_NUM >= 0x073E00 /* Available since 7.62.0 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_swoole_native_curl_upkeep, 0, 1, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, handle, CurlHandle, 0)
ZEND_END_ARG_INFO()
#endif

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_swoole_native_curl_multi_add_handle, 0, 2, IS_LONG, 0)
ZEND_ARG_OBJ_INFO(0, multi_handle, CurlMultiHandle, 0)
ZEND_ARG_OBJ_INFO(0, handle, CurlHandle, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_swoole_native_curl_multi_close, 0, 1, IS_VOID, 0)
ZEND_ARG_OBJ_INFO(0, multi_handle, CurlMultiHandle, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_swoole_native_curl_multi_errno, 0, 1, IS_LONG, 0)
ZEND_ARG_OBJ_INFO(0, multi_handle, CurlMultiHandle, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_swoole_native_curl_multi_exec, 0, 2, IS_LONG, 0)
ZEND_ARG_OBJ_INFO(0, multi_handle, CurlMultiHandle, 0)
ZEND_ARG_INFO(1, still_running)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_swoole_native_curl_multi_getcontent, 0, 1, IS_STRING, 1)
ZEND_ARG_OBJ_INFO(0, handle, CurlHandle, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_swoole_native_curl_multi_info_read, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, multi_handle, CurlMultiHandle, 0)
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, queued_messages, "null")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_swoole_native_curl_multi_init, 0, 0, CurlMultiHandle, 0)
ZEND_END_ARG_INFO()

#define arginfo_swoole_native_curl_multi_remove_handle arginfo_swoole_native_curl_multi_add_handle

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_swoole_native_curl_multi_select, 0, 1, IS_LONG, 0)
ZEND_ARG_OBJ_INFO(0, multi_handle, CurlMultiHandle, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timeout, IS_DOUBLE, 0, "1.0")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_swoole_native_curl_multi_strerror, 0, 1, IS_STRING, 1)
ZEND_ARG_TYPE_INFO(0, error_code, IS_LONG, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_swoole_native_curl_pause, 0, 2, IS_LONG, 0)
ZEND_ARG_OBJ_INFO(0, handle, CurlHandle, 0)
ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
ZEND_END_ARG_INFO()

#define arginfo_swoole_native_curl_reset arginfo_swoole_native_curl_close

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_swoole_native_curl_setopt_array, 0, 2, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, handle, CurlHandle, 0)
ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_swoole_native_curl_setopt, 0, 3, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, handle, CurlHandle, 0)
ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0)
ZEND_END_ARG_INFO()

#define arginfo_swoole_native_curl_strerror arginfo_swoole_native_curl_multi_strerror

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_swoole_native_curl_version, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_END_ARG_INFO()

static const zend_function_entry swoole_native_curl_functions[] = {
ZEND_FE(swoole_native_curl_close, arginfo_swoole_native_curl_close)
ZEND_FE(swoole_native_curl_copy_handle, arginfo_swoole_native_curl_copy_handle)
ZEND_FE(swoole_native_curl_errno, arginfo_swoole_native_curl_errno)
ZEND_FE(swoole_native_curl_error, arginfo_swoole_native_curl_error)
ZEND_FE(swoole_native_curl_escape, arginfo_swoole_native_curl_escape)
ZEND_FE(swoole_native_curl_unescape, arginfo_swoole_native_curl_unescape)
ZEND_FE(swoole_native_curl_multi_setopt, arginfo_swoole_native_curl_multi_setopt)
ZEND_FE(swoole_native_curl_exec, arginfo_swoole_native_curl_exec)
ZEND_FE(swoole_native_curl_getinfo, arginfo_swoole_native_curl_getinfo)
ZEND_FE(swoole_native_curl_init, arginfo_swoole_native_curl_init)
#if LIBCURL_VERSION_NUM >= 0x073E00 /* Available since 7.62.0 */
ZEND_FE(swoole_native_curl_upkeep, arginfo_swoole_native_curl_upkeep)
#endif
ZEND_FE(swoole_native_curl_multi_add_handle, arginfo_swoole_native_curl_multi_add_handle)
ZEND_FE(swoole_native_curl_multi_close, arginfo_swoole_native_curl_multi_close)
ZEND_FE(swoole_native_curl_multi_errno, arginfo_swoole_native_curl_multi_errno)
ZEND_FE(swoole_native_curl_multi_exec, arginfo_swoole_native_curl_multi_exec)
ZEND_FE(swoole_native_curl_multi_getcontent, arginfo_swoole_native_curl_multi_getcontent)
ZEND_FE(swoole_native_curl_multi_info_read, arginfo_swoole_native_curl_multi_info_read)
ZEND_FE(swoole_native_curl_multi_init, arginfo_swoole_native_curl_multi_init)
ZEND_FE(swoole_native_curl_multi_remove_handle, arginfo_swoole_native_curl_multi_remove_handle)
ZEND_FE(swoole_native_curl_multi_select, arginfo_swoole_native_curl_multi_select)
ZEND_FE(swoole_native_curl_multi_strerror, arginfo_swoole_native_curl_multi_strerror)
ZEND_FE(swoole_native_curl_pause, arginfo_swoole_native_curl_pause)
ZEND_FE(swoole_native_curl_reset, arginfo_swoole_native_curl_reset)
ZEND_FE(swoole_native_curl_setopt_array, arginfo_swoole_native_curl_setopt_array)
ZEND_FE(swoole_native_curl_setopt, arginfo_swoole_native_curl_setopt)
ZEND_FE(swoole_native_curl_strerror, arginfo_swoole_native_curl_strerror)
ZEND_FE(swoole_native_curl_version, arginfo_swoole_native_curl_version)
ZEND_FE_END
};

static const zend_function_entry class_CurlHandle_methods[] = {
ZEND_FE_END
};

static const zend_function_entry class_CurlMultiHandle_methods[] = {
ZEND_FE_END
};

static const zend_function_entry class_CurlShareHandle_methods[] = {
ZEND_FE_END
};
#endif
Loading
Loading