mirror of
https://github.com/php/php-src.git
synced 2024-11-28 12:26:37 +08:00
Merge branch '2Guploads'
* 2Guploads: add NEWS entry; add simple test more precise condition make this work in vc11 too Use int64_t and atoll() after discussion with johannes ws Patch for https://bugs.php.net/bug.php?id=44522 to allow uploading files above 2G. unify stdint type usage
This commit is contained in:
commit
611122c22e
@ -120,7 +120,7 @@ clean:
|
||||
distclean: clean
|
||||
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h main/internal_functions_cli.c main/internal_functions.c stamp-h sapi/apache/libphp$(PHP_MAJOR_VERSION).module sapi/apache_hooks/libphp$(PHP_MAJOR_VERSION).module buildmk.stamp Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak Zend/zend_config.h TSRM/tsrm_config.h
|
||||
rm -f php5.spec main/build-defs.h scripts/phpize
|
||||
rm -f ext/date/lib/timelib_config.h ext/mbstring/oniguruma/config.h ext/mbstring/libmbfl/config.h ext/mysqlnd/php_mysqlnd_config.h ext/oci8/oci8_dtrace_gen.h ext/oci8/oci8_dtrace_gen.h.bak
|
||||
rm -f ext/date/lib/timelib_config.h ext/mbstring/oniguruma/config.h ext/mbstring/libmbfl/config.h ext/oci8/oci8_dtrace_gen.h ext/oci8/oci8_dtrace_gen.h.bak
|
||||
rm -f scripts/man1/phpize.1 scripts/php-config scripts/man1/php-config.1 sapi/cli/php.1 sapi/cgi/php-cgi.1 ext/phar/phar.1 ext/phar/phar.phar.1
|
||||
rm -f sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.service sapi/fpm/php-fpm.8 sapi/fpm/status.html
|
||||
rm -f ext/iconv/php_have_bsd_iconv.h ext/iconv/php_have_glibc_iconv.h ext/iconv/php_have_ibm_iconv.h ext/iconv/php_have_iconv.h ext/iconv/php_have_libiconv.h ext/iconv/php_iconv_aliased_libiconv.h ext/iconv/php_iconv_supports_errno.h ext/iconv/php_php_iconv_h_path.h ext/iconv/php_php_iconv_impl.h
|
||||
|
19
acinclude.m4
19
acinclude.m4
@ -2978,3 +2978,22 @@ $ac_bdir[$]ac_provsrc.o: \$(PHP_DTRACE_OBJS)
|
||||
|
||||
EOF
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl PHP_CHECK_STDINT_TYPES
|
||||
dnl
|
||||
AC_DEFUN([PHP_CHECK_STDINT_TYPES], [
|
||||
AC_CHECK_SIZEOF([short], 2)
|
||||
AC_CHECK_SIZEOF([int], 4)
|
||||
AC_CHECK_SIZEOF([long], 4)
|
||||
AC_CHECK_SIZEOF([long long], 8)
|
||||
AC_CHECK_TYPES([int8, int16, int32, int64, int8_t, int16_t, int32_t, int64_t, uint8, uint16, uint32, uint64, uint8_t, uint16_t, uint32_t, uint64_t, u_int8_t, u_int16_t, u_int32_t, u_int64_t], [], [], [
|
||||
#if HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
#if HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
])
|
||||
AC_DEFINE([PHP_HAVE_STDINT_TYPES], [1], [Checked for stdint types])
|
||||
])
|
||||
|
@ -572,6 +572,9 @@ PHP_CHECK_SIZEOF(intmax_t, 0)
|
||||
PHP_CHECK_SIZEOF(ssize_t, 8)
|
||||
PHP_CHECK_SIZEOF(ptrdiff_t, 8)
|
||||
|
||||
dnl Check stdint types (must be after header check)
|
||||
PHP_CHECK_STDINT_TYPES
|
||||
|
||||
dnl Check for members of the stat structure
|
||||
AC_STRUCT_ST_BLKSIZE
|
||||
dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exists
|
||||
|
@ -22,4 +22,5 @@ cat > $ext_builddir/lib/timelib_config.h <<EOF
|
||||
#else
|
||||
# include <php_config.h>
|
||||
#endif
|
||||
#include <php_stdint.h>
|
||||
EOF
|
||||
|
@ -33,11 +33,6 @@
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
/* TODO: Remove these hacks/defs once we have the int definitions in main/
|
||||
rathen than in each 2nd extension and win32/ */
|
||||
# include "win32/php_stdint.h"
|
||||
#else
|
||||
# ifndef HAVE_INT32_T
|
||||
# if SIZEOF_INT == 4
|
||||
typedef int int32_t;
|
||||
@ -53,7 +48,6 @@ typedef unsigned int uint32_t;
|
||||
typedef unsigned long int uint32_t;
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@ -68,8 +62,8 @@ typedef unsigned long int uint32_t;
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
typedef uint64_t timelib_ull;
|
||||
typedef int64_t timelib_sll;
|
||||
typedef __uint64 timelib_ull;
|
||||
typedef __int64 timelib_sll;
|
||||
# define TIMELIB_LL_CONST(n) n ## i64
|
||||
#else
|
||||
typedef unsigned long long timelib_ull;
|
||||
|
@ -40,16 +40,6 @@
|
||||
#include "php.h"
|
||||
#include "ext/standard/file.h"
|
||||
|
||||
#ifdef HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
#ifdef PHP_WIN32
|
||||
# include "win32/php_stdint.h"
|
||||
#endif
|
||||
|
||||
#if HAVE_EXIF
|
||||
|
||||
/* When EXIF_DEBUG is defined the module generates a lot of debug messages
|
||||
|
@ -31,7 +31,7 @@ if test "$PHP_HASH" != "no"; then
|
||||
EXT_HASH_HEADERS="php_hash.h php_hash_md.h php_hash_sha.h php_hash_ripemd.h \
|
||||
php_hash_haval.h php_hash_tiger.h php_hash_gost.h php_hash_snefru.h \
|
||||
php_hash_whirlpool.h php_hash_adler32.h php_hash_crc32.h \
|
||||
php_hash_fnv.h php_hash_joaat.h php_hash_types.h"
|
||||
php_hash_fnv.h php_hash_joaat.h"
|
||||
|
||||
PHP_NEW_EXTENSION(hash, $EXT_HASH_SOURCES, $ext_shared)
|
||||
ifdef([PHP_INSTALL_HEADERS], [
|
||||
|
@ -19,7 +19,6 @@ if (PHP_HASH != "no") {
|
||||
|
||||
PHP_INSTALL_HEADERS("ext/hash/", "php_hash.h php_hash_md.h php_hash_sha.h php_hash_ripemd.h " +
|
||||
"php_hash_haval.h php_hash_tiger.h php_hash_gost.h php_hash_snefru.h " +
|
||||
"php_hash_whirlpool.h php_hash_adler32.h php_hash_crc32.h " +
|
||||
"php_hash_types.h");
|
||||
"php_hash_whirlpool.h php_hash_adler32.h php_hash_crc32.h");
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,6 @@ Supported Algorithms:
|
||||
<file role="src" name="config.w32"/>
|
||||
<file role="src" name="hash.c"/>
|
||||
<file role="src" name="php_hash.h"/>
|
||||
<file role="src" name="php_hash_types.h"/>
|
||||
<file role="src" name="hash_md.c"/>
|
||||
<file role="src" name="php_hash_md.h"/>
|
||||
<file role="src" name="hash_sha.c"/>
|
||||
|
@ -22,7 +22,6 @@
|
||||
#define PHP_HASH_H
|
||||
|
||||
#include "php.h"
|
||||
#include "php_hash_types.h"
|
||||
|
||||
#define PHP_HASH_EXTNAME "hash"
|
||||
#define PHP_HASH_EXTVER "1.0"
|
||||
@ -30,6 +29,12 @@
|
||||
|
||||
#define PHP_HASH_HMAC 0x0001
|
||||
|
||||
#define L64 INT64_C
|
||||
#define php_hash_int32 int32_t
|
||||
#define php_hash_uint32 uint32_t
|
||||
#define php_hash_int64 int64_t
|
||||
#define php_hash_uint64 uint64_t
|
||||
|
||||
typedef void (*php_hash_init_func_t)(void *context);
|
||||
typedef void (*php_hash_update_func_t)(void *context, const unsigned char *buf, unsigned int count);
|
||||
typedef void (*php_hash_final_func_t)(unsigned char *digest, void *context);
|
||||
|
@ -1,71 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2013 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Michael Wallner <mike@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef PHP_HASH_TYPES_H
|
||||
#define PHP_HASH_TYPES_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#else
|
||||
#ifndef PHP_WIN32
|
||||
#include "php_config.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef PHP_WIN32
|
||||
#if SIZEOF_LONG == 8
|
||||
#define L64(x) x
|
||||
typedef unsigned long php_hash_uint64;
|
||||
#if SIZEOF_INT == 4
|
||||
typedef unsigned int php_hash_uint32;
|
||||
#elif SIZEOF_SHORT == 4
|
||||
typedef unsigned short php_hash_uint32;
|
||||
#else
|
||||
#error "Need a 32bit integer type"
|
||||
#endif
|
||||
#elif SIZEOF_LONG_LONG == 8
|
||||
#define L64(x) x##LL
|
||||
typedef unsigned long long php_hash_uint64;
|
||||
#if SIZEOF_INT == 4
|
||||
typedef unsigned int php_hash_uint32;
|
||||
#elif SIZEOF_LONG == 4
|
||||
typedef unsigned long php_hash_uint32;
|
||||
#else
|
||||
#error "Need a 32bit integer type"
|
||||
#endif
|
||||
#else
|
||||
#error "Need a 64bit integer type"
|
||||
#endif
|
||||
#else
|
||||
#define L64(x) x##i64
|
||||
typedef unsigned __int64 php_hash_uint64;
|
||||
typedef unsigned __int32 php_hash_uint32;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 fdm=marker
|
||||
* vim<600: sw=4 ts=4
|
||||
*/
|
@ -48,16 +48,4 @@ fi
|
||||
|
||||
if test "$PHP_MYSQLND" != "no" || test "$PHP_MYSQLND_ENABLED" = "yes" || test "$PHP_MYSQLI" != "no"; then
|
||||
PHP_ADD_BUILD_DIR([ext/mysqlnd], 1)
|
||||
|
||||
dnl This creates a file so it has to be after above macros
|
||||
PHP_CHECK_TYPES([int8 uint8 int16 uint16 int32 uint32 uchar ulong int8_t uint8_t int16_t uint16_t int32_t uint32_t int64_t uint64_t], [
|
||||
ext/mysqlnd/php_mysqlnd_config.h
|
||||
],[
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
])
|
||||
fi
|
||||
|
@ -36,8 +36,6 @@ This file is public domain and comes with NO WARRANTY of any kind */
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
# include "ext/mysqlnd/config-win.h"
|
||||
#else
|
||||
# include <ext/mysqlnd/php_mysqlnd_config.h>
|
||||
#endif /* _WIN32... */
|
||||
|
||||
#if __STDC_VERSION__ < 199901L && !defined(atoll)
|
||||
@ -45,14 +43,7 @@ This file is public domain and comes with NO WARRANTY of any kind */
|
||||
#define atoll atol
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#include "php_stdint.h"
|
||||
|
||||
#if SIZEOF_LONG_LONG > 4 && !defined(_LONG_LONG)
|
||||
#define _LONG_LONG 1 /* For AIX string library */
|
||||
@ -70,102 +61,6 @@ This file is public domain and comes with NO WARRANTY of any kind */
|
||||
#define HAVE_LONG_LONG 1
|
||||
#endif
|
||||
|
||||
|
||||
/* Typdefs for easyier portability */
|
||||
#ifndef HAVE_INT8_T
|
||||
#ifndef HAVE_INT8
|
||||
typedef signed char int8_t; /* Signed integer >= 8 bits */
|
||||
#else
|
||||
typedef int8 int8_t; /* Signed integer >= 8 bits */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_UINT8_T
|
||||
#ifndef HAVE_UINT8
|
||||
typedef unsigned char uint8_t; /* Unsigned integer >= 8 bits */
|
||||
#else
|
||||
typedef uint8 uint8_t; /* Signed integer >= 8 bits */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_INT16_T
|
||||
#ifndef HAVE_INT16
|
||||
typedef signed short int16_t; /* Signed integer >= 16 bits */
|
||||
#else
|
||||
typedef int16 int16_t; /* Signed integer >= 16 bits */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_UINT16_T
|
||||
#ifndef HAVE_UINT16
|
||||
typedef unsigned short uint16_t; /* Signed integer >= 16 bits */
|
||||
#else
|
||||
typedef uint16 uint16_t; /* Signed integer >= 16 bits */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef HAVE_INT32_T
|
||||
#ifdef HAVE_INT32
|
||||
typedef int32 int32_t;
|
||||
#elif SIZEOF_INT == 4
|
||||
typedef signed int int32_t;
|
||||
#elif SIZEOF_LONG == 4
|
||||
typedef signed long int32_t;
|
||||
#else
|
||||
error "Neither int nor long is of 4 bytes width"
|
||||
#endif
|
||||
#endif /* HAVE_INT32_T */
|
||||
|
||||
#ifndef HAVE_UINT32_T
|
||||
#ifdef HAVE_UINT32
|
||||
typedef uint32 uint32_t;
|
||||
#elif SIZEOF_INT == 4
|
||||
typedef unsigned int uint32_t;
|
||||
#elif SIZEOF_LONG == 4
|
||||
typedef unsigned long uint32_t;
|
||||
#else
|
||||
#error "Neither int nor long is of 4 bytes width"
|
||||
#endif
|
||||
#endif /* HAVE_UINT32_T */
|
||||
|
||||
#ifndef HAVE_INT64_T
|
||||
#ifdef HAVE_INT64
|
||||
typedef int64 int64_t;
|
||||
#elif SIZEOF_INT == 8
|
||||
typedef signed int int64_t;
|
||||
#elif SIZEOF_LONG == 8
|
||||
typedef signed long int64_t;
|
||||
#elif SIZEOF_LONG_LONG == 8
|
||||
#ifdef PHP_WIN32
|
||||
typedef __int64 int64_t;
|
||||
#else
|
||||
typedef signed long long int64_t;
|
||||
#endif
|
||||
#else
|
||||
#error "Neither int nor long nor long long is of 8 bytes width"
|
||||
#endif
|
||||
#endif /* HAVE_INT64_T */
|
||||
|
||||
#ifndef HAVE_UINT64_T
|
||||
#ifdef HAVE_UINT64
|
||||
typedef uint64 uint64_t;
|
||||
#elif SIZEOF_INT == 8
|
||||
typedef unsigned int uint64_t;
|
||||
#elif SIZEOF_LONG == 8
|
||||
typedef unsigned long uint64_t;
|
||||
#elif SIZEOF_LONG_LONG == 8
|
||||
#ifdef PHP_WIN32
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
typedef unsigned long long uint64_t;
|
||||
#endif
|
||||
#else
|
||||
#error "Neither int nor long nor long long is of 8 bytes width"
|
||||
#endif
|
||||
#endif /* HAVE_INT64_T */
|
||||
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#define MYSQLND_LLU_SPEC "%I64u"
|
||||
#define MYSQLND_LL_SPEC "%I64d"
|
||||
|
@ -12,7 +12,7 @@
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Stig Sæther Bakken <ssb@php.net> |
|
||||
| Authors: Stig S<EFBFBD>ther Bakken <ssb@php.net> |
|
||||
| Thies C. Arntzen <thies@thieso.net> |
|
||||
| Maxim Maletsky <maxim@maxim.cx> |
|
||||
| |
|
||||
@ -37,13 +37,6 @@
|
||||
#include "php_ini.h"
|
||||
#include "ext/standard/php_smart_str.h"
|
||||
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#ifdef PHP_WIN32
|
||||
#include "win32/php_stdint.h"
|
||||
#endif
|
||||
|
||||
#if HAVE_OCI8
|
||||
|
||||
#if PHP_MAJOR_VERSION > 5
|
||||
|
@ -63,9 +63,6 @@
|
||||
#include "ext/spl/spl_iterators.h"
|
||||
#endif
|
||||
#include "php_phar.h"
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#ifdef PHAR_HASH_OK
|
||||
#include "ext/hash/php_hash.h"
|
||||
#include "ext/hash/php_hash_sha.h"
|
||||
|
@ -20,11 +20,6 @@
|
||||
#define PHP_SPL_H
|
||||
|
||||
#include "php.h"
|
||||
#if defined(PHP_WIN32)
|
||||
# include "win32/php_stdint.h"
|
||||
#elif defined(HAVE_STDINT_H)
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
#include <stdarg.h>
|
||||
|
||||
#if 0
|
||||
|
@ -4,26 +4,13 @@
|
||||
#define _CRYPT_FREESEC_H
|
||||
|
||||
#if PHP_WIN32
|
||||
# include "win32/php_stdint.h"
|
||||
# ifndef inline
|
||||
# define inline __inline
|
||||
# endif
|
||||
#else
|
||||
# include "php_config.h"
|
||||
# if HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
# elif HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
# endif
|
||||
# ifndef HAVE_UINT32_T
|
||||
# if SIZEOF_INT == 4
|
||||
typedef unsigned int uint32_t;
|
||||
# elif SIZEOF_LONG == 4
|
||||
typedef unsigned long int uint32_t;
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "php_stdint.h"
|
||||
|
||||
#define MD5_HASH_MAX_LEN 120
|
||||
|
||||
struct php_crypt_extended_data {
|
||||
|
@ -9,15 +9,9 @@
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
# include "win32/php_stdint.h"
|
||||
# define __alignof__ __alignof
|
||||
# define alloca _alloca
|
||||
#else
|
||||
# if HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
# elif HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
# endif
|
||||
# ifndef HAVE_ALIGNOF
|
||||
# include <stddef.h>
|
||||
# define __alignof__(type) offsetof (struct { char c; type member;}, member)
|
||||
|
@ -8,15 +8,9 @@
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#ifdef PHP_WIN32
|
||||
# include "win32/php_stdint.h"
|
||||
# define __alignof__ __alignof
|
||||
# define alloca _alloca
|
||||
#else
|
||||
# if HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
# elif HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
# endif
|
||||
# ifndef HAVE_ALIGNOF
|
||||
# include <stddef.h>
|
||||
# define __alignof__(type) offsetof (struct { char c; type member;}, member)
|
||||
|
@ -13,7 +13,7 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Rasmus Lerdorf <rasmus@php.net> |
|
||||
| Stig Sæther Bakken <ssb@php.net> |
|
||||
| Stig S<EFBFBD>ther Bakken <ssb@php.net> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
@ -23,11 +23,6 @@
|
||||
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef PHP_WIN32
|
||||
# include "win32/php_stdint.h"
|
||||
#else
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
#include "php.h"
|
||||
#include "php_rand.h"
|
||||
#include "php_string.h"
|
||||
|
@ -13,11 +13,7 @@
|
||||
#define LIBZIP_VERSION_MINOR 10
|
||||
#define LIBZIP_VERSION_MICRO 0
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#include <win32/php_stdint.h>
|
||||
#else
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#include <php_stdint.h>
|
||||
|
||||
typedef int8_t zip_int8_t;
|
||||
#define ZIP_INT8_MIN INT8_MIN
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "zend_operators.h"
|
||||
#ifdef PHP_WIN32
|
||||
#include "win95nt.h"
|
||||
#include "win32/php_stdint.h"
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
|
||||
@ -82,7 +83,7 @@ typedef struct {
|
||||
char *post_data, *raw_post_data;
|
||||
char *cookie_data;
|
||||
long content_length;
|
||||
uint post_data_length, raw_post_data_length;
|
||||
int64_t post_data_length, raw_post_data_length;
|
||||
|
||||
char *path_translated;
|
||||
char *request_uri;
|
||||
@ -119,7 +120,7 @@ typedef struct _sapi_globals_struct {
|
||||
void *server_context;
|
||||
sapi_request_info request_info;
|
||||
sapi_headers_struct sapi_headers;
|
||||
int read_post_bytes;
|
||||
int64_t read_post_bytes;
|
||||
unsigned char headers_sent;
|
||||
struct stat global_stat;
|
||||
char *default_mimetype;
|
||||
|
@ -180,6 +180,8 @@ typedef unsigned int socklen_t;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "php_stdint.h"
|
||||
|
||||
#include "zend_hash.h"
|
||||
#include "zend_alloc.h"
|
||||
#include "zend_stack.h"
|
||||
|
198
main/php_stdint.h
Normal file
198
main/php_stdint.h
Normal file
@ -0,0 +1,198 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2013 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Michael Wallner <mike@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef PHP_STDINT_H
|
||||
#define PHP_STDINT_H
|
||||
|
||||
#if PHP_WIN32
|
||||
# include "win32/php_stdint.h"
|
||||
# define HAVE_INT8_T 1
|
||||
# define HAVE_UINT8_T 1
|
||||
# define HAVE_INT16_T 1
|
||||
# define HAVE_UINT16_T 1
|
||||
# define HAVE_INT32_T 1
|
||||
# define HAVE_UINT32_T 1
|
||||
# define HAVE_INT64_T 1
|
||||
# define HAVE_UINT64_T 1
|
||||
#else
|
||||
|
||||
#include "php_config.h"
|
||||
|
||||
#if HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_INT8_T
|
||||
# ifdef HAVE_INT8
|
||||
typedef int8 int8_t;
|
||||
# else
|
||||
typedef signed char int8_t;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef INT8_C
|
||||
# define INT8_C(c) c
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_UINT8_T
|
||||
# ifdef HAVE_UINT8
|
||||
typedef uint8 uint8_t
|
||||
# elif HAVE_U_INT8_T
|
||||
typedef u_int8_t uint8_t;
|
||||
# else
|
||||
typedef unsigned char uint8_t;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef UINT8_C
|
||||
# define UINT8_C(c) c
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_INT16_T
|
||||
# ifdef HAVE_INT16
|
||||
typedef int16 int16_t;
|
||||
# elif SIZEOF_SHORT >= 2
|
||||
typedef signed short int16_t;
|
||||
# else
|
||||
# error "No suitable 16bit integer type found"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef INT16_C
|
||||
# define INT16_C(c) c
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_UINT16_T
|
||||
# ifdef HAVE_UINT16
|
||||
typedef uint16 uint16_t
|
||||
# elif HAVE_U_INT16_T
|
||||
typedef u_int16_t uint16_t;
|
||||
# elif SIZEOF_SHORT >= 2
|
||||
typedef unsigned short uint16_t;
|
||||
# else
|
||||
# error "No suitable 16bit integer type found"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef UINT16_C
|
||||
# define UINT16_C(c) c
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_INT32_T
|
||||
# ifdef HAVE_INT32
|
||||
typedef int32 int32_t;
|
||||
# elif SIZEOF_INT >= 4
|
||||
typedef int int32_t;
|
||||
# elif SIZEOF_LONG >= 4
|
||||
typedef long int32_t;
|
||||
# else
|
||||
# error "No suitable 32bit integer type found"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef INT32_C
|
||||
# define INT32_C(c) c
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_UINT32_T
|
||||
# ifdef HAVE_UINT32
|
||||
typedef uint32 uint32_t
|
||||
# elif HAVE_U_INT32_T
|
||||
typedef u_int32_t uint32_t;
|
||||
# elif SIZEOF_INT >= 4
|
||||
typedef unsigned int uint32_t;
|
||||
# elif SIZEOF_LONG >= 4
|
||||
typedef unsigned long uint32_t;
|
||||
# else
|
||||
# error "No suitable 32bit integer type found"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef UINT32_C
|
||||
# define UINT32_C(c) c ## U
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_INT64_T
|
||||
# ifdef HAVE_INT64
|
||||
typedef int64 int64_t;
|
||||
# elif SIZEOF_INT >= 8
|
||||
typedef int int64_t;
|
||||
# elif SIZEOF_LONG >= 8
|
||||
typedef long int64_t;
|
||||
# elif SIZEOF_LONG_LONG >= 8
|
||||
typedef long long int64_t;
|
||||
# else
|
||||
# error "No suitable 64bit integer type found"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef INT64_C
|
||||
# if SIZEOF_INT >= 8
|
||||
# define INT64_C(c) c
|
||||
# elif SIZEOF_LONG >= 8
|
||||
# define INT64_C(c) c ## L
|
||||
# elif SIZEOF_LONG_LONG >= 8
|
||||
# define INT64_C(c) c ## LL
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_UINT64_T
|
||||
# ifdef HAVE_UINT64
|
||||
typedef uint64 uint64_t
|
||||
# elif HAVE_U_INT64_T
|
||||
typedef u_int64_t uint64_t;
|
||||
# elif SIZEOF_INT >= 8
|
||||
typedef unsigned int uint64_t;
|
||||
# elif SIZEOF_LONG >= 8
|
||||
typedef unsigned long uint64_t;
|
||||
# elif SIZEOF_LONG_LONG >= 8
|
||||
typedef unsigned long long uint64_t;
|
||||
# else
|
||||
# error "No suitable 64bit integer type found"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef UINT64_C
|
||||
# if SIZEOF_INT >= 8
|
||||
# define UINT64_C(c) c ## U
|
||||
# elif SIZEOF_LONG >= 8
|
||||
# define UINT64_C(c) c ## UL
|
||||
# elif SIZEOF_LONG_LONG >= 8
|
||||
# define UINT64_C(c) c ## ULL
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* !PHP_WIN32 */
|
||||
#endif /* PHP_STDINT_H */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 fdm=marker
|
||||
* vim<600: sw=4 ts=4
|
||||
*/
|
@ -34,6 +34,10 @@
|
||||
#include "rfc1867.h"
|
||||
#include "ext/standard/php_string.h"
|
||||
|
||||
#if defined(PHP_WIN32) && !defined(HAVE_ATOLL)
|
||||
# define atoll(s) _atoi64(s)
|
||||
#endif
|
||||
|
||||
#define DEBUG_FILE_UPLOAD ZEND_DEBUG
|
||||
|
||||
static int dummy_encoding_translation(TSRMLS_D)
|
||||
@ -676,8 +680,9 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
|
||||
{
|
||||
char *boundary, *s = NULL, *boundary_end = NULL, *start_arr = NULL, *array_index = NULL;
|
||||
char *temp_filename = NULL, *lbuf = NULL, *abuf = NULL;
|
||||
int boundary_len = 0, total_bytes = 0, cancel_upload = 0, is_arr_upload = 0, array_len = 0;
|
||||
int max_file_size = 0, skip_upload = 0, anonindex = 0, is_anonymous;
|
||||
int boundary_len = 0, cancel_upload = 0, is_arr_upload = 0, array_len = 0;
|
||||
int64_t total_bytes = 0, max_file_size = 0;
|
||||
int skip_upload = 0, anonindex = 0, is_anonymous;
|
||||
zval *http_post_files = NULL;
|
||||
HashTable *uploaded_files = NULL;
|
||||
multipart_buffer *mbuff;
|
||||
@ -898,7 +903,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
|
||||
}
|
||||
|
||||
if (!strcasecmp(param, "MAX_FILE_SIZE")) {
|
||||
max_file_size = atol(value);
|
||||
max_file_size = atoll(value);
|
||||
}
|
||||
|
||||
efree(param);
|
||||
|
@ -508,7 +508,7 @@ static int sapi_cgi_read_post(char *buffer, uint count_bytes TSRMLS_DC)
|
||||
uint read_bytes = 0;
|
||||
int tmp_read_bytes;
|
||||
|
||||
count_bytes = MIN(count_bytes, (uint) SG(request_info).content_length - SG(read_post_bytes));
|
||||
count_bytes = MIN(count_bytes, SG(request_info).content_length - SG(read_post_bytes));
|
||||
while (read_bytes < count_bytes) {
|
||||
tmp_read_bytes = read(STDIN_FILENO, buffer + read_bytes, count_bytes - read_bytes);
|
||||
if (tmp_read_bytes <= 0) {
|
||||
|
@ -29,15 +29,13 @@ extern "C" {
|
||||
#include <sys/types.h>
|
||||
#if defined(_WIN32) && !defined(__MINGW32__)
|
||||
# include <windows.h>
|
||||
# include "win32/php_stdint.h"
|
||||
# include "config.w32.h"
|
||||
#else
|
||||
# include "php_config.h"
|
||||
# ifdef HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "php_stdint.h"
|
||||
|
||||
/* Compile with -DPHP_HTTP_PARSER_STRICT=0 to make less checks, but run
|
||||
* faster
|
||||
*/
|
||||
|
@ -3,7 +3,7 @@ define ("PHP_CLI_SERVER_HOSTNAME", "localhost");
|
||||
define ("PHP_CLI_SERVER_PORT", 8964);
|
||||
define ("PHP_CLI_SERVER_ADDRESS", PHP_CLI_SERVER_HOSTNAME.":".PHP_CLI_SERVER_PORT);
|
||||
|
||||
function php_cli_server_start($code = 'echo "Hello world";', $no_router = FALSE) {
|
||||
function php_cli_server_start($code = 'echo "Hello world";', $no_router = FALSE, $cmd_args = null) {
|
||||
$php_executable = getenv('TEST_PHP_EXECUTABLE');
|
||||
$doc_root = __DIR__;
|
||||
$router = "index.php";
|
||||
@ -19,14 +19,14 @@ function php_cli_server_start($code = 'echo "Hello world";', $no_router = FALSE)
|
||||
);
|
||||
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
$cmd = "{$php_executable} -t {$doc_root} -n -S " . PHP_CLI_SERVER_ADDRESS;
|
||||
$cmd = "{$php_executable} -t {$doc_root} -n {$cmd_args} -S " . PHP_CLI_SERVER_ADDRESS;
|
||||
if (!$no_router) {
|
||||
$cmd .= " {$router}";
|
||||
}
|
||||
|
||||
$handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array("bypass_shell" => true, "suppress_errors" => true));
|
||||
} else {
|
||||
$cmd = "exec {$php_executable} -t {$doc_root} -n -S " . PHP_CLI_SERVER_ADDRESS;
|
||||
$cmd = "exec {$php_executable} -t {$doc_root} -n {$cmd_args} -S " . PHP_CLI_SERVER_ADDRESS;
|
||||
if (!$no_router) {
|
||||
$cmd .= " {$router}";
|
||||
}
|
||||
|
99
sapi/cli/tests/upload_2G.phpt
Normal file
99
sapi/cli/tests/upload_2G.phpt
Normal file
@ -0,0 +1,99 @@
|
||||
--TEST--
|
||||
file upload greater than 2G
|
||||
--SKIPIF--
|
||||
<?php
|
||||
include "skipif.inc";
|
||||
|
||||
if (PHP_INT_SIZE < 8) {
|
||||
die("skip need PHP_INT_SIZE>=8");
|
||||
}
|
||||
|
||||
if ($f = fopen("/proc/meminfo","r")) {
|
||||
while (!feof($f)) {
|
||||
if (!strncmp($line = fgets($f), "MemFree", 7)) {
|
||||
if (substr($line,8)/1024/1024 > 3) {
|
||||
$enough_free_ram = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($enough_free_ram)) {
|
||||
die("need +3G free RAM");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
echo "Test\n";
|
||||
|
||||
include "php_cli_server.inc";
|
||||
|
||||
php_cli_server_start("var_dump(\$_FILES);", false,
|
||||
"-d post_max_size=3G -d upload_max_filesize=3G");
|
||||
|
||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
||||
$port = intval($port)?:80;
|
||||
$length = 2150000000;
|
||||
$output = "";
|
||||
|
||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
||||
if (!$fp) {
|
||||
die("connect failed");
|
||||
}
|
||||
|
||||
$prev = "----123
|
||||
Content-Type: text/plain
|
||||
Content-Disposition: form-data; name=\"file1\"; filename=\"file1.txt\"\n\n";
|
||||
$post = "\n----123--\n";
|
||||
$total = $length + strlen($prev) + strlen($post);
|
||||
|
||||
fwrite($fp, <<<EOF
|
||||
POST /index.php HTTP/1.1
|
||||
Host: {$host}
|
||||
Content-Type: multipart/form-data; boundary=--123
|
||||
Content-Length: {$total}
|
||||
|
||||
{$prev}
|
||||
EOF
|
||||
) or die("write prev failed");
|
||||
|
||||
$data = str_repeat("0123456789", 10000);
|
||||
for ($i = 0; $i < $length; $i += 10000 * 10) {
|
||||
fwrite($fp, $data) or die("write failed @ ($i)");
|
||||
}
|
||||
|
||||
fwrite($fp, $post) or die("write post failed");
|
||||
|
||||
while (!feof($fp)) {
|
||||
$output .= fgets($fp);
|
||||
}
|
||||
echo $output;
|
||||
fclose($fp);
|
||||
?>
|
||||
Done
|
||||
--EXPECTF--
|
||||
Test
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
Host: %s
|
||||
Connection: close
|
||||
X-Powered-By: PHP/%s
|
||||
Content-type: text/html
|
||||
|
||||
array(1) {
|
||||
["file1"]=>
|
||||
array(5) {
|
||||
["name"]=>
|
||||
string(9) "file1.txt"
|
||||
["type"]=>
|
||||
string(10) "text/plain"
|
||||
["tmp_name"]=>
|
||||
string(14) "/tmp/php%s"
|
||||
["error"]=>
|
||||
int(0)
|
||||
["size"]=>
|
||||
int(2150000000)
|
||||
}
|
||||
}
|
||||
Done
|
Loading…
Reference in New Issue
Block a user