Fix read/write error message on PHP7
@@ -916,7 +916,11 @@ static ssize_t swow_stdiop_fs_write(php_stream *stream, const char *buf, size_t
return bytes_written;
}
if (!(stream->flags & PHP_STREAM_FLAG_SUPPRESS_ERRORS)) {
+#if PHP_VERSION_ID >= 80000
php_error_docref(NULL, E_NOTICE, "Write of %zu bytes failed with errno=%d %s", count, errno, strerror(errno));
+#else
+ php_error_docref(NULL, E_NOTICE, "write of %zu bytes failed with errno=%d %s", count, errno, strerror(errno));
+#endif
}
}
return bytes_written;
@@ -960,7 +964,11 @@ static ssize_t swow_stdiop_fs_read(php_stream *stream, char *buf, size_t count)
/* TODO: Should this be treated as a proper error or not? */
} else {
if (!(stream->flags & PHP_STREAM_FLAG_SUPPRESS_ERRORS)) {
+#if PHP_VERSION_ID >= 80000
php_error_docref(NULL, E_NOTICE, "Read of %zu bytes failed with errno=%d %s", count, errno, strerror(errno));
+#else
+ php_error_docref(NULL, E_NOTICE, "read of %zu bytes failed with errno=%d %s", count, errno, strerror(errno));
+#endif
}
/* TODO: Remove this special-case? */
