[prev in list] [next in list] [prev in thread] [next in thread]
List: pecl-cvs
Subject: [PECL-CVS] [pecl-php-uploadprogress] 2.x: Clean-up php5 support
From: Andy Postnikov <noreply () php ! net>
Date: 2021-09-29 1:57:08
Message-ID: Q5LWcKl4LPvjYYWCUc3dLpn0NQEYWSPQPJA5pPDYlo () main ! php ! net
[Download RAW message or body]
Author: Andy Postnikov (andypost)
Pusher: ramsey
Date: 2021-09-29T04:03:00+03:00
Commit: https://github.com/php/pecl-php-uploadprogress/commit/709cd37d3b48a28dad50da348108c721e36da7d9
Raw diff: https://github.com/php/pecl-php-uploadprogress/commit/709cd37d3b48a28dad50da348108c721e36da7d9.diff
Clean-up php5 support
- ZEND_ENGINE_3 because it used for checks
- API after 20100412
Changed paths:
M uploadprogress.c
Diff:
diff --git a/uploadprogress.c b/uploadprogress.c
index 3187185..11051d7 100644
--- a/uploadprogress.c
+++ b/uploadprogress.c
@@ -185,11 +185,7 @@ static int uploadprogress_php_rfc1867_file(unsigned int event, \
void *event_data
if (get_contents) {
php_stream *stream;
-#if defined(ZEND_ENGINE_3)
int options = 0;
-#else
- int options = ENFORCE_SAFE_MODE;
-#endif
stream = php_stream_open_wrapper(progress->data_filename, "ab", \
options, NULL);
@@ -262,14 +258,6 @@ static int uploadprogress_php_rfc1867_file(unsigned int event, \
void *event_data progress->est_sec);
fclose(F);
-
-/* VCWD_RENAME on WIN32 and PHP < 5.3 has a bug, if target does exist */
-#ifdef PHP_WIN32
-#if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 3
- VCWD_UNLINK(progress->identifier);
-#endif
-#endif
-
VCWD_RENAME(progress->identifier_tmp, progress->identifier);
}
}
@@ -349,11 +337,7 @@ PHP_MINFO_FUNCTION(uploadprogress)
PHP_FUNCTION(uploadprogress_get_info)
{
char *id;
-#if defined(ZEND_ENGINE_3)
size_t id_lg;
-#else
- int id_lg;
-#endif
#if PHP_API_VERSION >= 20200930
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &id, &id_lg) == FAILURE) {
@@ -374,11 +358,7 @@ PHP_FUNCTION(uploadprogress_get_info)
PHP_FUNCTION(uploadprogress_get_contents)
{
char *id, *fieldname;
-#if defined(ZEND_ENGINE_3)
size_t id_len, fieldname_len;
-#else
- int id_len, fieldname_len;
-#endif
long maxlen = PHP_STREAM_COPY_ALL;
zend_bool get_contents = INI_BOOL("uploadprogress.get_contents");
@@ -512,11 +492,7 @@ static void uploadprogress_file_php_get_info(char *id, zval \
*return_value) }
}
-#if defined(ZEND_ENGINE_3)
add_assoc_string(return_value, k, v);
-#else
- add_assoc_string(return_value, k, v, 1);
-#endif
}
fclose(F);
@@ -535,20 +511,11 @@ static void uploadprogress_file_php_get_info(char *id, zval \
*return_value)
*/
static void uploadprogress_file_php_get_contents(char *id, char *fieldname, long \
maxlen, zval *return_value) {
-#if defined(ZEND_ENGINE_3)
char *filename, *template, *data_identifier;
zend_string *contents;
int options = 0;
size_t len;
-#else
- char *filename, *template, *contents, *data_identifier;
- int options = ENFORCE_SAFE_MODE;
- int len;
-#endif
php_stream *stream;
-#if PHP_API_VERSION < 20100412
- int newlen;
-#endif
#if PHP_API_VERSION < 20200930
TSRMLS_FETCH();
#endif
@@ -586,7 +553,6 @@ static void uploadprogress_file_php_get_contents(char *id, char \
*fieldname, long }
/* Uses mmap if possible. */
-#if defined(ZEND_ENGINE_3)
contents = php_stream_copy_to_mem(stream, maxlen, 0);
if (contents) {
@@ -594,21 +560,7 @@ static void uploadprogress_file_php_get_contents(char *id, char \
*fieldname, long }
if (contents && len > 0) {
-#else
- if ((len = php_stream_copy_to_mem(stream, &contents, maxlen, 0)) > 0) {
-#endif
-
-#if PHP_API_VERSION < 20100412
- if (PG(magic_quotes_runtime)) {
- contents = php_addslashes(contents, len, &newlen, 1 TSRMLS_CC);
- len = newlen;
- }
-#endif
-#if defined(ZEND_ENGINE_3)
RETVAL_STR(contents);
-#else
- RETVAL_STRINGL(contents, len, 0);
-#endif
} else {
RETVAL_EMPTY_STRING();
}
--
PECL CVS Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic