diff --git a/package.xml b/package.xml
index 7e62416..edfc6b3 100644
--- a/package.xml
+++ b/package.xml
@@ -41,8 +41,8 @@ more than adequate.
PHP-3.01
-- drop PHP 5 support
-- add type hinting with PHP 8+
+- drop support for PHP 5 and 7
+- add type hinting
@@ -68,7 +68,6 @@ more than adequate.
-
@@ -85,7 +84,7 @@ more than adequate.
- 7.0.0
+ 8.0.0
1.10.0
diff --git a/src/dio.c b/src/dio.c
index 6a476aa..fd82311 100644
--- a/src/dio.c
+++ b/src/dio.c
@@ -47,11 +47,8 @@
# endif /* CNEW_RTSCTS */
#endif /* !CRTSCTS */
-#if PHP_VERSION_ID < 80000
-#include "dio_legacy_arginfo.h"
-#else
#include "dio_arginfo.h"
-#endif
+
/*
+----------------------------------------------------------------------+
| DEPRECATED FUNCTIONALITY |
diff --git a/src/dio.stub.php b/src/dio.stub.php
index 90a24cc..f870c39 100644
--- a/src/dio.stub.php
+++ b/src/dio.stub.php
@@ -2,7 +2,7 @@
/**
* @generate-class-entries
- * @generate-legacy-arginfo
+ * @generate-legacy-arginfo 80000
*/
/**
diff --git a/src/dio_arginfo.h b/src/dio_arginfo.h
index 8484ae7..a585986 100644
--- a/src/dio_arginfo.h
+++ b/src/dio_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 74f93c791a08145405f1f08b0d8ee26876e92798 */
+ * Stub hash: c960cbb93c3f8966636813ca2346e35030451bf4 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_dio_open, 0, 0, 2)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
diff --git a/src/dio_legacy_arginfo.h b/src/dio_legacy_arginfo.h
deleted file mode 100644
index 5e6f4cc..0000000
--- a/src/dio_legacy_arginfo.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 74f93c791a08145405f1f08b0d8ee26876e92798 */
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dio_open, 0, 0, 2)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-#if !defined(PHP_WIN32)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dio_fdopen, 0, 0, 1)
- ZEND_ARG_INFO(0, fd)
-ZEND_END_ARG_INFO()
-#endif
-
-#if !defined(PHP_WIN32)
-#define arginfo_dio_dup arginfo_dio_fdopen
-#endif
-
-#if !defined(PHP_WIN32)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dio_truncate, 0, 0, 2)
- ZEND_ARG_INFO(0, fd)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dio_stat, 0, 0, 1)
- ZEND_ARG_INFO(0, fd)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dio_seek, 0, 0, 2)
- ZEND_ARG_INFO(0, fd)
- ZEND_ARG_INFO(0, pos)
- ZEND_ARG_INFO(0, whence)
-ZEND_END_ARG_INFO()
-
-#if !defined(PHP_WIN32)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dio_fcntl, 0, 0, 2)
- ZEND_ARG_INFO(0, fd)
- ZEND_ARG_INFO(0, cmd)
- ZEND_ARG_INFO(0, arg)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dio_read, 0, 0, 1)
- ZEND_ARG_INFO(0, fd)
- ZEND_ARG_INFO(0, n)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dio_write, 0, 0, 2)
- ZEND_ARG_INFO(0, fd)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, len)
-ZEND_END_ARG_INFO()
-
-#define arginfo_dio_close arginfo_dio_stat
-
-#if !defined(PHP_WIN32)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dio_tcsetattr, 0, 0, 2)
- ZEND_ARG_INFO(0, fd)
- ZEND_ARG_INFO(0, args)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dio_raw, 0, 0, 2)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-#define arginfo_dio_serial arginfo_dio_raw
-
-
-ZEND_FUNCTION(dio_open);
-#if !defined(PHP_WIN32)
-ZEND_FUNCTION(dio_fdopen);
-#endif
-#if !defined(PHP_WIN32)
-ZEND_FUNCTION(dio_dup);
-#endif
-#if !defined(PHP_WIN32)
-ZEND_FUNCTION(dio_truncate);
-#endif
-ZEND_FUNCTION(dio_stat);
-ZEND_FUNCTION(dio_seek);
-#if !defined(PHP_WIN32)
-ZEND_FUNCTION(dio_fcntl);
-#endif
-ZEND_FUNCTION(dio_read);
-ZEND_FUNCTION(dio_write);
-ZEND_FUNCTION(dio_close);
-#if !defined(PHP_WIN32)
-ZEND_FUNCTION(dio_tcsetattr);
-#endif
-ZEND_FUNCTION(dio_raw);
-ZEND_FUNCTION(dio_serial);
-
-
-static const zend_function_entry ext_functions[] = {
- ZEND_FE(dio_open, arginfo_dio_open)
-#if !defined(PHP_WIN32)
- ZEND_FE(dio_fdopen, arginfo_dio_fdopen)
-#endif
-#if !defined(PHP_WIN32)
- ZEND_FE(dio_dup, arginfo_dio_dup)
-#endif
-#if !defined(PHP_WIN32)
- ZEND_FE(dio_truncate, arginfo_dio_truncate)
-#endif
- ZEND_FE(dio_stat, arginfo_dio_stat)
- ZEND_FE(dio_seek, arginfo_dio_seek)
-#if !defined(PHP_WIN32)
- ZEND_FE(dio_fcntl, arginfo_dio_fcntl)
-#endif
- ZEND_FE(dio_read, arginfo_dio_read)
- ZEND_FE(dio_write, arginfo_dio_write)
- ZEND_FE(dio_close, arginfo_dio_close)
-#if !defined(PHP_WIN32)
- ZEND_FE(dio_tcsetattr, arginfo_dio_tcsetattr)
-#endif
- ZEND_FE(dio_raw, arginfo_dio_raw)
- ZEND_FE(dio_serial, arginfo_dio_serial)
- ZEND_FE_END
-};
diff --git a/src/dio_posix.c b/src/dio_posix.c
index 8c9b2e1..2416ddc 100644
--- a/src/dio_posix.c
+++ b/src/dio_posix.c
@@ -246,13 +246,8 @@ php_dio_stream_data * dio_create_stream_data(void) {
/* {{{ dio_common_write
* Writes count chars from the buffer to the stream described by the stream data.
*/
-#if PHP_VERSION_ID < 70400
-size_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t count) {
- size_t ret;
-#else
ssize_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t count) {
ssize_t ret;
-#endif
/* Blocking writes can be interrupted by signals etc. If
* interrupted try again. Not sure about non-blocking
@@ -264,11 +259,7 @@ ssize_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t coun
}
} while (errno == EINTR);
-#if PHP_VERSION_ID < 70400
- return 0;
-#else
return ret;
-#endif
}
/* }}} */
@@ -311,11 +302,7 @@ static int dio_timeval_subtract(struct timeval *late, struct timeval *early, str
/* {{{ dio_common_read
* Reads count chars to the buffer to the stream described by the stream data.
*/
-#if PHP_VERSION_ID < 70400
-size_t dio_common_read(php_dio_stream_data *data, const char *buf, size_t count) {
-#else
ssize_t dio_common_read(php_dio_stream_data *data, const char *buf, size_t count) {
-#endif
int fd = ((php_dio_posix_stream_data*)data)->fd;
size_t ret, total = 0;
char *ptr = (char*)buf;
@@ -335,11 +322,7 @@ ssize_t dio_common_read(php_dio_stream_data *data, const char *buf, size_t count
data->end_of_file = 1;
}
} while ((errno == EINTR) && !data->end_of_file);
-#if PHP_VERSION_ID < 70400
- return 0;
-#else
return ret;
-#endif
}
#ifdef DIO_NONBLOCK
else {
@@ -366,11 +349,7 @@ ssize_t dio_common_read(php_dio_stream_data *data, const char *buf, size_t count
ret = select(fd + 1, &rfds, NULL, NULL, &timeouttmp);
/* An error. */
if ((ret < 0) && (errno != EINTR) && (errno != EAGAIN)) {
-#if PHP_VERSION_ID < 70400
- return 0;
-#else
return ret;
-#endif
}
/* We have data to read. */
@@ -378,11 +357,7 @@ ssize_t dio_common_read(php_dio_stream_data *data, const char *buf, size_t count
ret = read(fd, ptr, count);
/* Another error */
if ((ret < 0) && (errno != EINTR) && (errno != EAGAIN)) {
-#if PHP_VERSION_ID < 70400
- return 0;
-#else
return ret;
-#endif
}
if (ret > 0) {
diff --git a/src/dio_stream_wrappers.c b/src/dio_stream_wrappers.c
index 58de0d9..f87fdf8 100644
--- a/src/dio_stream_wrappers.c
+++ b/src/dio_stream_wrappers.c
@@ -34,11 +34,7 @@
/* {{{ dio_stream_write
* Write to the stream
*/
-#if PHP_VERSION_ID < 70400
-static size_t dio_stream_write(php_stream *stream, const char *buf, size_t count)
-#else
static ssize_t dio_stream_write(php_stream *stream, const char *buf, size_t count)
-#endif
{
return dio_common_write((php_dio_stream_data*)stream->abstract, buf, count);
}
@@ -47,15 +43,9 @@ static ssize_t dio_stream_write(php_stream *stream, const char *buf, size_t coun
/* {{{ dio_stream_read
* Read from the stream
*/
-#if PHP_VERSION_ID < 70400
-static size_t dio_stream_read(php_stream *stream, char *buf, size_t count)
-{
- size_t bytes;
-#else
static ssize_t dio_stream_read(php_stream *stream, char *buf, size_t count)
{
ssize_t bytes;
-#endif
php_dio_stream_data* data = (php_dio_stream_data*)stream->abstract;
bytes = dio_common_read(data, buf, count);
stream->eof = data->end_of_file;
diff --git a/src/dio_win32.c b/src/dio_win32.c
index 74afc50..e9e74be 100644
--- a/src/dio_win32.c
+++ b/src/dio_win32.c
@@ -219,11 +219,7 @@ php_dio_stream_data * dio_create_stream_data(void) {
/* {{{ dio_common_write
* Writes count chars from the buffer to the stream described by the stream data.
*/
-#if PHP_VERSION_ID < 70400
-size_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t count) {
-#else
ssize_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t count) {
-#endif
php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data;
DWORD total = 0;
@@ -231,11 +227,7 @@ ssize_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t coun
return (size_t)total;
}
-#if PHP_VERSION_ID < 70400
- return 0;
-#else
return -1;
-#endif
}
/* }}} */
@@ -319,11 +311,7 @@ static size_t dio_buffer_read(php_dio_win32_stream_data *wdata, const char *buf,
/* {{{ dio_com_read
* Read chars from the data port.
*/
-#if PHP_VERSION_ID < 70400
-static size_t dio_com_read(php_dio_stream_data *data, const char *buf, size_t count) {
-#else
static ssize_t dio_com_read(php_dio_stream_data *data, const char *buf, size_t count) {
-#endif
php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data;
DWORD err, total = 0;
@@ -344,22 +332,14 @@ static ssize_t dio_com_read(php_dio_stream_data *data, const char *buf, size_t c
}
}
-#if PHP_VERSION_ID < 70400
- return 0;
-#else
return (data->end_of_file ? 0 : -1);
-#endif
}
/* {{{ dio_canonical_read
* Reads chars from the input stream until the internal buffer is full or a new
* line is reached.
*/
-#if PHP_VERSION_ID < 70400
-static size_t dio_canonical_read(php_dio_win32_stream_data *wdata, const char *buf, size_t count) {
-#else
static ssize_t dio_canonical_read(php_dio_win32_stream_data *wdata, const char *buf, size_t count) {
-#endif
php_dio_win32_canon_data *canon_data = wdata->canon_data;
size_t total = 0;
char ch;
@@ -403,11 +383,7 @@ static ssize_t dio_canonical_read(php_dio_win32_stream_data *wdata, const char *
/* {{{ dio_common_read
* Reads count chars to the buffer to the stream described by the stream data.
*/
-#if PHP_VERSION_ID < 70400
-size_t dio_common_read(php_dio_stream_data *data, const char *buf, size_t count) {
-#else
ssize_t dio_common_read(php_dio_stream_data *data, const char *buf, size_t count) {
-#endif
/* You ask for no bytes you'll get none :-) */
if (!count) {
diff --git a/src/php_dio_common.h b/src/php_dio_common.h
index 5d811c2..d489a7b 100644
--- a/src/php_dio_common.h
+++ b/src/php_dio_common.h
@@ -45,15 +45,9 @@ void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_s
void dio_stream_context_get_serial_options(php_stream_context *context, php_dio_stream_data *data);
-#if PHP_VERSION_ID < 70400
-size_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t count);
-
-size_t dio_common_read(php_dio_stream_data *data, const char *buf, size_t count);
-#else
ssize_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t count);
ssize_t dio_common_read(php_dio_stream_data *data, const char *buf, size_t count);
-#endif
int dio_common_close(php_dio_stream_data *data);
diff --git a/src/php_dio_stream_wrappers.h b/src/php_dio_stream_wrappers.h
index 746dd23..ee5fcbb 100644
--- a/src/php_dio_stream_wrappers.h
+++ b/src/php_dio_stream_wrappers.h
@@ -22,12 +22,7 @@
#define DIO_SERIAL_STREAM_NAME "dio.serial"
#define DIO_SERIAL_STREAM_PROTOCOL "dio.serial://"
-/* To support PHP 5.4 and later */
-#if PHP_VERSION_ID < 50399
-#define DIO_SAFE_MODE_CHECK(f, m) (PG(safe_mode) && !php_checkuid(f, m, CHECKUID_CHECK_MODE_PARAM))
-#else
#define DIO_SAFE_MODE_CHECK(f, m) (0)
-#endif
extern php_stream_wrapper php_dio_raw_stream_wrapper;