Skip to content

Commit 4a963df

Browse files
committed
no longer support PHP-7.1
1 parent eaad5cc commit 4a963df

File tree

4 files changed

+15
-38
lines changed

4 files changed

+15
-38
lines changed

ext-src/php_swoole.h

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,7 @@
3939
#include "config.h"
4040
#endif
4141

42-
// zend iterator interface
43-
#if PHP_VERSION_ID < 70200
44-
#ifdef HAVE_PCRE
45-
#include "ext/spl/spl_iterators.h"
46-
#define zend_ce_countable spl_ce_Countable
47-
#define SW_HAVE_COUNTABLE 1
48-
#endif
49-
#else
5042
#define SW_HAVE_COUNTABLE 1
51-
#endif
5243

5344
#include "swoole_api.h"
5445
#include "swoole_async.h"
@@ -105,8 +96,8 @@ extern zend_module_entry swoole_module_entry;
10596
#define SWOOLE_SOCKETS_SUPPORT
10697
#endif
10798

108-
#if PHP_VERSION_ID < 70100
109-
#error "require PHP version 7.1 or later"
99+
#if PHP_VERSION_ID < 70200
100+
#error "require PHP version 7.2 or later"
110101
#endif
111102

112103
//--------------------------------------------------------
@@ -313,20 +304,10 @@ extern ZEND_DECLARE_MODULE_GLOBALS(swoole);
313304
#endif
314305

315306
/* PHP 7 compatibility patches */
316-
317-
// Fixed C++ warning (https://github.com/php/php-src/commit/ec31924cd68df4f5591664d487baaba0d01b1daf)
318-
#if PHP_VERSION_ID < 70200
319-
#define sw_zend_bailout() _sw_zend_bailout(__FILE__, __LINE__)
320-
static sw_inline void _sw_zend_bailout(const char *filename, uint32_t lineno)
321-
{
322-
_zend_bailout((char *)filename, lineno);
323-
}
324-
#else
325307
#define sw_zend_bailout() zend_bailout()
326-
#endif
327308

328-
// Fixed in php-7.1.15RC1, php-7.2.3RC1 (https://github.com/php/php-src/commit/e88e83d3e5c33fcd76f08b23e1a2e4e8dc98ce41)
329-
#if PHP_MAJOR_VERSION == 7 && ((PHP_MINOR_VERSION == 1 && PHP_RELEASE_VERSION < 15) || (PHP_MINOR_VERSION == 2 && PHP_RELEASE_VERSION < 3))
309+
// Fixed in php-7.2.3RC1 (https://github.com/php/php-src/commit/e88e83d3e5c33fcd76f08b23e1a2e4e8dc98ce41)
310+
#if PHP_MAJOR_VERSION == 7 && ((PHP_MINOR_VERSION == 2 && PHP_RELEASE_VERSION < 3))
330311
// See https://github.com/php/php-src/commit/0495bf5650995cd8f18d6a9909eb4c5dcefde669
331312
// Then https://github.com/php/php-src/commit/2dcfd8d16f5fa69582015cbd882aff833075a34c
332313
// See https://github.com/php/php-src/commit/52db03b3e52bfc886896925d050af79bc4dc1ba3

ext-src/php_swoole_library.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Generated by build-library.php, Please DO NOT modify!
33
*/
44

5-
/* $Id: 7952a7b69374058b888e279d996b8b8a4e286b44 */
5+
/* $Id: 138bd3ee518144ea6dccceb624d540627537a972 */
66

77
static const char* swoole_library_source_constants =
88
"\n"
@@ -16,7 +16,10 @@ static const char* swoole_library_source_constants =
1616
"\n"
1717
"declare(strict_types=1);\n"
1818
"\n"
19-
"define('SWOOLE_LIBRARY', true);\n";
19+
"define('SWOOLE_LIBRARY', true);\n"
20+
"\n"
21+
"!defined('CURLOPT_HEADEROPT') && define('CURLOPT_HEADEROPT', 229);\n"
22+
"!defined('CURLOPT_PROXYHEADER') && define('CURLOPT_PROXYHEADER', 10228);\n";
2023

2124
static const char* swoole_library_source_std_exec =
2225
"\n"
@@ -3477,11 +3480,7 @@ static const char* swoole_library_source_core_curl_handler =
34773480
"\n"
34783481
" public function __toString()\n"
34793482
" {\n"
3480-
" if (PHP_VERSION_ID < 70200) {\n"
3481-
" $id = spl_object_hash($this);\n"
3482-
" } else {\n"
3483-
" $id = spl_object_id($this);\n"
3484-
" }\n"
3483+
" $id = spl_object_id($this);\n"
34853484
" return \"Object({$id}) of type (curl)\";\n"
34863485
" }\n"
34873486
"\n"
@@ -6694,6 +6693,7 @@ static const char* swoole_library_source_core_server_helper =
66946693
" 'task_max_request_grace' => true,\n"
66956694
" 'max_connection' => true,\n"
66966695
" 'max_conn' => true,\n"
6696+
" 'start_session_id' => true,\n"
66976697
" 'heartbeat_check_interval' => true,\n"
66986698
" 'heartbeat_idle_time' => true,\n"
66996699
" 'max_request' => true,\n"
@@ -6982,6 +6982,10 @@ static const char* swoole_library_source_functions =
69826982
"\n"
69836983
"declare(strict_types=1);\n"
69846984
"\n"
6985+
"if (PHP_VERSION_ID < 70200) {\n"
6986+
" throw new RuntimeException(\"require PHP version 7.2 or later\");\n"
6987+
"}\n"
6988+
"\n"
69856989
"if (SWOOLE_USE_SHORTNAME) {\n"
69866990
" function _string(string $string = ''): Swoole\\StringObject\n"
69876991
" {\n"

ext-src/swoole_coroutine.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -647,11 +647,7 @@ void PHPCoroutine::main_func(void *arg) {
647647
ZVAL_UNDEF(retval);
648648
// TODO: enhancement it, separate execute data is necessary, but we lose the backtrace
649649
EG(current_execute_data) = nullptr;
650-
#if PHP_VERSION_ID >= 70200
651650
zend_init_func_execute_data(call, &func->op_array, retval);
652-
#else
653-
zend_init_execute_data(call, &func->op_array, retval);
654-
#endif
655651
zend_execute_ex(EG(current_execute_data));
656652
} else /* ZEND_INTERNAL_FUNCTION */
657653
{

ext-src/swoole_runtime.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,6 @@ static const zend_function_entry swoole_runtime_methods[] =
148148

149149
static php_stream_wrapper ori_php_plain_files_wrapper;
150150

151-
#if PHP_VERSION_ID < 70200
152-
typedef void (*zif_handler)(INTERNAL_FUNCTION_PARAMETERS);
153-
#endif
154-
155151
#define SW_HOOK_FUNC(f) hook_func(ZEND_STRL(#f), PHP_FN(swoole_##f))
156152
#define SW_UNHOOK_FUNC(f) unhook_func(ZEND_STRL(#f))
157153

0 commit comments

Comments
 (0)