<?php
$doubles = array(
- 9223372036854775808,
- 9223372036854775809,
- 9223372036854775818,
- 9223372036854775908,
- 9223372036854776808,
+ PHP_INT_MAX,
+ PHP_INT_MAX + 1,
+ PHP_INT_MAX + 1000,
+ PHP_INT_MAX * 2 + 4,
+ -PHP_INT_MAX -1,
+ -PHP_INT_MAX -2,
+ -PHP_INT_MAX -1000,
);
foreach ($doubles as $d) {
echo "Done\n";
?>
--EXPECTF--
-int(-9223372036854775808)
-int(-9223372036854775808)
+int(9223372036854775807)
+int(9223372036854775807)
+int(9223372036854775807)
+int(9223372036854775807)
int(-9223372036854775808)
int(-9223372036854775808)
int(-9223372036854775808)
#define MAX_UNSIGNED_INT ((double) LONG_MAX * 2) + 1
#ifdef _WIN64
# define DVAL_TO_LVAL(d, l) \
- if ((d) > LONG_MAX) { \
- if ((d) > MAX_UNSIGNED_INT) { \
- (l) = LONG_MAX; \
- } else { \
- (l) = (long)(unsigned long)(__int64) (d); \
- } \
- } else { \
- if((d) < LONG_MIN) { \
- (l) = LONG_MIN; \
- } else { \
- (l) = (long) (d); \
- } \
- }
+ if ((d) > LONG_MAX) { \
+ (l) = (long)(unsigned long)(__int64) (d); \
+ } else { \
+ (l) = (long) (d); \
+ }
+#elif !defined(_WIN64) && __WORDSIZE == 64
+# define DVAL_TO_LVAL(d, l) \
+ if ((d) >= LONG_MAX) { \
+ (l) = LONG_MAX; \
+ } else if ((d) <= LONG_MIN) { \
+ (l) = LONG_MIN; \
+ } else {\
+ (l) = (long) (d); \
+ }
#else
# define DVAL_TO_LVAL(d, l) \
- if ((d) > LONG_MAX) { \
- if ((d) > MAX_UNSIGNED_INT) { \
- (l) = LONG_MAX; \
- } else { \
- (l) = (unsigned long) (d); \
- } \
- } else { \
- if((d) < LONG_MIN) { \
- (l) = LONG_MIN; \
- } else { \
- (l) = (long) (d); \
- } \
- }
+ if ((d) > LONG_MAX) { \
+ if ((d) > MAX_UNSIGNED_INT) { \
+ (l) = LONG_MAX; \
+ } else { \
+ (l) = (unsigned long) (d); \
+ } \
+ } else { \
+ if((d) < LONG_MIN) { \
+ (l) = LONG_MIN; \
+ } else { \
+ (l) = (long) (d); \
+ } \
+ }
#endif
+
#define zendi_convert_to_long(op, holder, result) \
if (op == result) { \
convert_to_long(op); \
char *result;
char *end = "\r\n";
int endlen = 2;
- int chunklen = 76;
+ long chunklen = 76;
int result_len;
int argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 3 || zend_get_parameters_ex(argc, &p_str, &p_chunklen, &p_ending) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|ZZ", &p_str, &p_chunklen, &p_ending) == FAILURE) {
+ return;
}
convert_to_string_ex(p_str);
--EXPECTF--
*** Testing chunk_split() : error conditions ***
-- Testing chunk_split() function with Zero arguments --
-Warning: Wrong parameter count for chunk_split() in %s on line %d
+Warning: chunk_split() expects at least 1 parameter, 0 given in %s on line %d
NULL
-- Testing chunk_split() function with more than expected no. of arguments --
-Warning: Wrong parameter count for chunk_split() in %s on line %d
+Warning: chunk_split() expects at most 3 parameters, 4 given in %s on line %d
NULL
Done
-123, //negative integer
0234, //octal number
0x1A, //hexadecimal number
- 2147483647, //max positive integer number
- 2147483648, //max positive integer+1
- -2147483648, //min negative integer
+ PHP_INT_MAX, //max positive integer number
+ PHP_INT_MAX * 3, // Will overflow 32 bits on 32 bt system and 64 bits on 64 bit system
+ -PHP_INT_MAX -1, //min negative integer
);
It has _speci@l ch@r$ 2222 !!!Now \k as escape char to test
chunk_split():::"
-- Iteration 7 --
-
-Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
-bool(false)
+string(129) "This's heredoc string with and
+ white space char.
+It has _speci@l ch@r$ 2222 !!!Now \k as escape char to test
+chunk_split():::"
-- Iteration 8 --
Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
// float data
10.5,
-10.5,
- 10.5e10,
+ 10.5e20,
10.6E-10,
.5,