Skip to content

PHPC-2230: Drop support for PHP 7.2 and 7.3 #1450

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

Merged
merged 8 commits into from
Aug 16, 2023
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
14 changes: 3 additions & 11 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1100,14 +1100,6 @@ axes:
display_name: "PHP 7.4"
variables:
PHP_VERSION: "7.4"
- id: "7.3"
display_name: "PHP 7.3"
variables:
PHP_VERSION: "7.3"
- id: "7.2"
display_name: "PHP 7.2"
variables:
PHP_VERSION: "7.2"

- id: php-edge-versions
display_name: PHP Version
Expand All @@ -1117,9 +1109,9 @@ axes:
variables:
PHP_VERSION: "8.2"
- id: "oldest-supported"
display_name: "PHP 7.2"
display_name: "PHP 7.4"
variables:
PHP_VERSION: "7.2"
PHP_VERSION: "7.4"

- id: os
display_name: OS
Expand Down Expand Up @@ -1231,7 +1223,7 @@ buildvariants:
# Exclude "latest-stable" PHP version for Debian 11 (see: test-mongodb-versions matrix)
- { "os": "debian11", "mongodb-edge-versions": "*", "php-versions": "8.2" }
# Exclude PHP versions older than 8.1 on RHEL 9 and Ubuntu 22.04 (OpenSSL 3 is only supported on PHP 8.1+)
- { "os": ["rhel90", "ubuntu2204-arm64", "ubuntu2204"], "mongodb-edge-versions": "*", "php-versions": ["7.2", "7.3", "7.4", "8.0"] }
- { "os": ["rhel90", "ubuntu2204-arm64", "ubuntu2204"], "mongodb-edge-versions": "*", "php-versions": ["7.4", "8.0"] }
tasks:
- name: "test-standalone-ssl"
- name: "test-replicaset-auth"
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,25 +81,17 @@ jobs:

windows-tests:
name: "Windows Tests"
runs-on: ${{ matrix.os }}
runs-on: windows-2022
defaults:
run:
shell: cmd

strategy:
fail-fast: true
matrix:
os: [ windows-2019, windows-2022 ]
php: [ "7.2", "7.3", "7.4", "8.0", "8.1", "8.2" ]
php: [ "7.4", "8.0", "8.1", "8.2" ]
arch: [ x64, x86 ]
ts: [ ts, nts ]
exclude:
- { os: windows-2019, php: "8.2" }
- { os: windows-2019, php: "8.1" }
- { os: windows-2019, php: "8.0" }
- { os: windows-2019, php: "7.4" }
- { os: windows-2019, php: "7.3" }
- { os: windows-2022, php: "7.2" }

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows-release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
fail-fast: false
matrix:
# Note: keep this in sync with the Windows matrix in tests.yml
php: [ "7.2", "7.3", "7.4", "8.0", "8.1", "8.2" ]
php: [ "7.4", "8.0", "8.1", "8.2" ]
arch: [ x64, x86 ]
ts: [ ts, nts ]
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ if test "$PHP_MONGODB" != "no"; then
fi

AC_MSG_RESULT($PHP_MONGODB_PHP_VERSION)
if test "$PHP_MONGODB_PHP_VERSION_ID" -lt "70200"; then
AC_MSG_ERROR([not supported. Need a PHP version >= 7.2.0 (found $PHP_MONGODB_PHP_VERSION)])
if test "$PHP_MONGODB_PHP_VERSION_ID" -lt "70400"; then
AC_MSG_ERROR([not supported. Need a PHP version >= 7.4.0 (found $PHP_MONGODB_PHP_VERSION)])
fi

PHP_ARG_ENABLE([mongodb-developer-flags],
Expand Down
5 changes: 2 additions & 3 deletions config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,10 @@ ARG_WITH("mongodb-client-side-encryption", "MongoDB: Enable client-side encrypti

if (PHP_MONGODB != "no") {
/* Note: ADD_EXTENSION_DEP() only reports the date and standard extensions as
* installed in PHP 7.3.25+, 7.4.13+, and 8.0.0+). On other versions, assume
* that they're always enabled. */
* installed in PHP 7.4.13+ and 8.0.0+). On other versions, assume that
* they're always enabled. */
if (
PHP_VERSION >= 8 ||
(PHP_VERSION == 7 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION >= 25) ||
(PHP_VERSION == 7 && PHP_MINOR_VERSION == 4 && PHP_RELEASE_VERSION >= 13)
) {
ADD_EXTENSION_DEP("mongodb", "date", false);
Expand Down
2 changes: 1 addition & 1 deletion src/BSON/Document.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ static PHP_METHOD(MongoDB_BSON_Document, fromPHP)
zval* data;

PHONGO_PARSE_PARAMETERS_START(1, 1)
PHONGO_PARAM_ARRAY_OR_OBJECT(data)
Z_PARAM_ARRAY_OR_OBJECT(data)
PHONGO_PARSE_PARAMETERS_END();

object_init_ex(&zv, php_phongo_document_ce);
Expand Down
2 changes: 0 additions & 2 deletions src/BSON/Int64.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,7 @@ static zend_result php_phongo_int64_cast_object(phongo_compat_object_handler_typ
return SUCCESS;

case IS_LONG:
#if PHP_VERSION_ID >= 70300
case _IS_NUMBER:
#endif
#if SIZEOF_ZEND_LONG == 4
if (intern->integer > INT32_MAX || intern->integer < INT32_MIN) {
zend_error(E_WARNING, "Truncating 64-bit integer value %" PRId64 " to 32 bits", intern->integer);
Expand Down
2 changes: 1 addition & 1 deletion src/BSON/functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ PHP_FUNCTION(fromPHP)
bson_t* bson;

PHONGO_PARSE_PARAMETERS_START(1, 1)
PHONGO_PARAM_ARRAY_OR_OBJECT(data)
Z_PARAM_ARRAY_OR_OBJECT(data)
PHONGO_PARSE_PARAMETERS_END();

bson = bson_new();
Expand Down
8 changes: 4 additions & 4 deletions src/MongoDB/BulkWrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ static PHP_METHOD(MongoDB_Driver_BulkWrite, insert)
intern = Z_BULKWRITE_OBJ_P(getThis());

PHONGO_PARSE_PARAMETERS_START(1, 1)
PHONGO_PARAM_ARRAY_OR_OBJECT(zdocument)
Z_PARAM_ARRAY_OR_OBJECT(zdocument)
PHONGO_PARSE_PARAMETERS_END();

bson_flags |= PHONGO_BSON_RETURN_ID;
Expand Down Expand Up @@ -429,8 +429,8 @@ static PHP_METHOD(MongoDB_Driver_BulkWrite, update)
intern = Z_BULKWRITE_OBJ_P(getThis());

PHONGO_PARSE_PARAMETERS_START(2, 3)
PHONGO_PARAM_ARRAY_OR_OBJECT(zquery)
PHONGO_PARAM_ARRAY_OR_OBJECT(zupdate)
Z_PARAM_ARRAY_OR_OBJECT(zquery)
Z_PARAM_ARRAY_OR_OBJECT(zupdate)
Z_PARAM_OPTIONAL
Z_PARAM_ARRAY_OR_NULL(zoptions)
PHONGO_PARSE_PARAMETERS_END();
Expand Down Expand Up @@ -494,7 +494,7 @@ static PHP_METHOD(MongoDB_Driver_BulkWrite, delete)
intern = Z_BULKWRITE_OBJ_P(getThis());

PHONGO_PARSE_PARAMETERS_START(1, 2)
PHONGO_PARAM_ARRAY_OR_OBJECT(zquery)
Z_PARAM_ARRAY_OR_OBJECT(zquery)
Z_PARAM_OPTIONAL
Z_PARAM_ARRAY_OR_NULL(zoptions)
PHONGO_PARSE_PARAMETERS_END();
Expand Down
2 changes: 1 addition & 1 deletion src/MongoDB/ClientEncryption.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ static PHP_METHOD(MongoDB_Driver_ClientEncryption, rewrapManyDataKey)
const bson_t* bulk_write_result;

PHONGO_PARSE_PARAMETERS_START(1, 2)
PHONGO_PARAM_ARRAY_OR_OBJECT(zfilter)
Z_PARAM_ARRAY_OR_OBJECT(zfilter)
Z_PARAM_OPTIONAL
Z_PARAM_ARRAY_OR_NULL(options)
PHONGO_PARSE_PARAMETERS_END();
Expand Down
2 changes: 1 addition & 1 deletion src/MongoDB/Command.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ static PHP_METHOD(MongoDB_Driver_Command, __construct)
intern = Z_COMMAND_OBJ_P(getThis());

PHONGO_PARSE_PARAMETERS_START(1, 2)
PHONGO_PARAM_ARRAY_OR_OBJECT(document)
Z_PARAM_ARRAY_OR_OBJECT(document)
Z_PARAM_OPTIONAL
Z_PARAM_ARRAY_OR_NULL(options)
PHONGO_PARSE_PARAMETERS_END();
Expand Down
2 changes: 1 addition & 1 deletion src/MongoDB/Query.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ static PHP_METHOD(MongoDB_Driver_Query, __construct)
zval* options = NULL;

PHONGO_PARSE_PARAMETERS_START(1, 2)
PHONGO_PARAM_ARRAY_OR_OBJECT(filter)
Z_PARAM_ARRAY_OR_OBJECT(filter)
Z_PARAM_OPTIONAL
Z_PARAM_ARRAY_OR_NULL(options)
PHONGO_PARSE_PARAMETERS_END();
Expand Down
2 changes: 1 addition & 1 deletion src/MongoDB/Session.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ static PHP_METHOD(MongoDB_Driver_Session, advanceClusterTime)
SESSION_CHECK_LIVELINESS(intern, "advanceClusterTime")

PHONGO_PARSE_PARAMETERS_START(1, 1)
PHONGO_PARAM_ARRAY_OR_OBJECT(zcluster_time)
Z_PARAM_ARRAY_OR_OBJECT(zcluster_time)
PHONGO_PARSE_PARAMETERS_END();

php_phongo_zval_to_bson(zcluster_time, PHONGO_BSON_NONE, &cluster_time, NULL);
Expand Down
30 changes: 0 additions & 30 deletions src/phongo_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,6 @@

#include "phongo_compat.h"

#ifdef ZEND_HASH_GET_APPLY_COUNT /* PHP 7.2 or earlier recursion protection */
zend_bool php_phongo_zend_hash_apply_protection_begin(HashTable* ht)
{
if (!ht) {
return 1;
}
if (ZEND_HASH_GET_APPLY_COUNT(ht) > 0) {
return 0;
}
if (ZEND_HASH_APPLY_PROTECTION(ht)) {
ZEND_HASH_INC_APPLY_COUNT(ht);
}
return 1;
}

zend_bool php_phongo_zend_hash_apply_protection_end(HashTable* ht)
{
if (!ht) {
return 1;
}
if (ZEND_HASH_GET_APPLY_COUNT(ht) == 0) {
return 0;
}
if (ZEND_HASH_APPLY_PROTECTION(ht)) {
ZEND_HASH_DEC_APPLY_COUNT(ht);
}
return 1;
}
#else /* PHP 7.3 or later */
zend_bool php_phongo_zend_hash_apply_protection_begin(zend_array* ht)
{
if (GC_IS_RECURSIVE(ht)) {
Expand All @@ -68,7 +39,6 @@ zend_bool php_phongo_zend_hash_apply_protection_end(zend_array* ht)
}
return 1;
}
#endif /* ZEND_HASH_GET_APPLY_COUNT */

#if PHP_VERSION_ID < 80200
const char* zend_get_object_type_case(const zend_class_entry* ce, zend_bool upper_case)
Expand Down
45 changes: 0 additions & 45 deletions src/phongo_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@
#error Unsupported architecture (integers are neither 32-bit nor 64-bit)
#endif

#if PHP_VERSION_ID < 70300
#define zend_object_alloc(obj_size, ce) ecalloc(1, obj_size + zend_object_properties_size(ce))
#endif

#define ADD_ASSOC_STR(_zv, _key, _value) add_assoc_string_ex(_zv, ZEND_STRL(_key), (char*) ZSTR_VAL(_value));
#define ADD_ASSOC_STRING(_zv, _key, _value) add_assoc_string_ex(_zv, ZEND_STRL(_key), (char*) (_value));
#define ADD_ASSOC_STRINGL(_zv, _key, _value, _len) add_assoc_stringl_ex(_zv, ZEND_STRL(_key), (char*) (_value), _len);
Expand Down Expand Up @@ -176,37 +172,6 @@
#error Unsupported architecture (integers are neither 32-bit nor 64-bit)
#endif /* SIZEOF_ZEND_LONG */

#if PHP_VERSION_ID < 70300
#define ZVAL_COPY_DEREF(z, v) \
do { \
zval* _z3 = (v); \
if (Z_OPT_REFCOUNTED_P(_z3)) { \
if (UNEXPECTED(Z_OPT_ISREF_P(_z3))) { \
_z3 = Z_REFVAL_P(_z3); \
if (Z_OPT_REFCOUNTED_P(_z3)) { \
Z_ADDREF_P(_z3); \
} \
} else { \
Z_ADDREF_P(_z3); \
} \
} \
ZVAL_COPY_VALUE(z, _z3); \
} while (0)
#endif /* PHP_VERSION_ID < 70300 */

#if PHP_VERSION_ID < 70300
static inline zend_bool zend_ini_parse_bool(zend_string* str)
{
if (zend_string_equals_literal_ci(str, "true") ||
zend_string_equals_literal_ci(str, "yes") ||
zend_string_equals_literal_ci(str, "on")) {
return 1;
} else {
return atoi(ZSTR_VAL(str)) != 0;
}
}
#endif /* PHP_VERSION_ID < 70300 */

/* Compatibility macros to override error handling logic */
#define PHONGO_PARSE_PARAMETERS_START(min_num_args, max_num_args) \
do { \
Expand Down Expand Up @@ -275,16 +240,6 @@ static inline zend_bool zend_ini_parse_bool(zend_string* str)
Z_PARAM_ZVAL_EX(dest, 1, 0)
#endif

/* Z_PARAM_ARRAY_OR_OBJECT requires 3 arguments in PHP < 7.3.
* See: https://github.com/php/php-src/commit/a595b0f75bf8bc0d3da8ca5cb03f8b1a694d26b2 */
#if PHP_VERSION_ID < 70300
#define PHONGO_PARAM_ARRAY_OR_OBJECT(dest) \
Z_PARAM_ARRAY_OR_OBJECT(dest, 0, 0)
#else
#define PHONGO_PARAM_ARRAY_OR_OBJECT(dest) \
Z_PARAM_ARRAY_OR_OBJECT(dest)
#endif

/* ZEND_ABSTRACT_ME_WITH_FLAGS was introduced in PHP 8.0. */
#ifndef ZEND_ABSTRACT_ME_WITH_FLAGS
#define ZEND_ABSTRACT_ME_WITH_FLAGS(classname, name, arg_info, flags) ZEND_RAW_FENTRY(#name, NULL, arg_info, flags)
Expand Down
Loading