From bb55397babf7f0f9b553667669b8326094408481 Mon Sep 17 00:00:00 2001 From: Andrea Faulds Date: Mon, 22 Sep 2014 17:06:16 +0100 Subject: [PATCH 01/37] Make zpp fail if NaN passed for int, or out-of-range float for non-capping int --- Zend/zend_API.c | 32 ++++++++++++++++++-------------- Zend/zend_API.h | 27 +++++++++++++++++++-------- 2 files changed, 37 insertions(+), 22 deletions(-) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 41adbeba8ff..dce707d96fb 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -430,14 +430,16 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons if ((type = is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), p, &d, -1)) == 0) { return "long"; } else if (type == IS_DOUBLE) { - if (c == 'L') { - if (d > ZEND_LONG_MAX) { - *p = ZEND_LONG_MAX; - break; - } else if (d < ZEND_LONG_MIN) { - *p = ZEND_LONG_MIN; - break; + if (zend_isnan(d)) { + return "long"; + } + if (d > ZEND_LONG_MAX || d < ZEND_LONG_MIN) { + if (c == 'L') { + *p = (d > 0) ? ZEND_LONG_MAX : ZEND_LONG_MIN; + } else { + return "long"; } + break; } *p = zend_dval_to_lval(d); @@ -446,14 +448,16 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons break; case IS_DOUBLE: - if (c == 'L') { - if (Z_DVAL_P(arg) > ZEND_LONG_MAX) { - *p = ZEND_LONG_MAX; - break; - } else if (Z_DVAL_P(arg) < ZEND_LONG_MIN) { - *p = ZEND_LONG_MIN; - break; + if (zend_isnan(Z_DVAL_P(arg))) { + return "long"; + } + if (Z_DVAL_P(arg) > ZEND_LONG_MAX || Z_DVAL_P(arg) < ZEND_LONG_MIN) { + if (c == 'L') { + *p = (Z_DVAL_P(arg) > 0) ? ZEND_LONG_MAX : ZEND_LONG_MIN; + } else { + return "long"; } + break; } case IS_NULL: case IS_FALSE: diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 657d1d04de6..97a069b463c 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -1081,10 +1081,16 @@ static zend_always_inline int _z_param_long(zval *arg, zend_long *dest, zend_boo if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) { *dest = Z_LVAL_P(arg); } else if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) { - if (strict && UNEXPECTED(Z_DVAL_P(arg) > ZEND_LONG_MAX)) { - *dest = ZEND_LONG_MAX; - } else if (strict && UNEXPECTED(Z_DVAL_P(arg) < ZEND_LONG_MIN)) { - *dest = ZEND_LONG_MIN; + if (UNEXPECTED(zend_isnan(Z_DVAL_P(arg)))) { + return 0; + } + if (UNEXPECTED(Z_DVAL_P(arg) > ZEND_LONG_MAX || Z_DVAL_P(arg) < ZEND_LONG_MIN)) { + /* Ironically, the strict parameter makes zpp *non*-strict here */ + if (strict) { + *dest = (Z_DVAL_P(arg) > 0) ? ZEND_LONG_MAX : ZEND_LONG_MIN; + } else { + return 0; + } } else { *dest = zend_dval_to_lval(Z_DVAL_P(arg)); } @@ -1094,10 +1100,15 @@ static zend_always_inline int _z_param_long(zval *arg, zend_long *dest, zend_boo if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), dest, &d)) != IS_LONG)) { if (EXPECTED(type != 0)) { - if (strict && UNEXPECTED(d > ZEND_LONG_MAX)) { - *dest = ZEND_LONG_MAX; - } else if (strict && UNEXPECTED(d < ZEND_LONG_MIN)) { - *dest = ZEND_LONG_MIN; + if (UNEXPECTED(zend_isnan(Z_DVAL_P(arg)))) { + return 0; + } + if (UNEXPECTED(d > ZEND_LONG_MAX || d < ZEND_LONG_MIN)) { + if (strict) { + *dest = (d > 0) ? ZEND_LONG_MAX : ZEND_LONG_MIN; + } else { + return 0; + } } else { *dest = zend_dval_to_lval(d); } From 25eb4967630c9037ae221a8ff4fcf3db159fc984 Mon Sep 17 00:00:00 2001 From: Andrea Faulds Date: Mon, 22 Sep 2014 17:33:56 +0100 Subject: [PATCH 02/37] Fixed broken tests --- ext/standard/tests/strings/bug54322.phpt | 5 +++-- .../tests/strings/chunk_split_variation5.phpt | Bin 2289 -> 2285 bytes .../tests/strings/chunk_split_variation8.phpt | 4 ++-- .../htmlspecialchars_decode_variation2.phpt | 4 +++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ext/standard/tests/strings/bug54322.phpt b/ext/standard/tests/strings/bug54322.phpt index aead172b82d..4834bdf2365 100644 --- a/ext/standard/tests/strings/bug54322.phpt +++ b/ext/standard/tests/strings/bug54322.phpt @@ -5,5 +5,6 @@ Bug #54322: Null pointer deref in get_html_translation_table due to information var_dump( get_html_translation_table(NAN, 0, "UTF-8") > 0 ); ---EXPECT-- -bool(true) +--EXPECTF-- +Warning: get_html_translation_table() expects parameter 1 to be long, double given in %s on line %d +bool(false) diff --git a/ext/standard/tests/strings/chunk_split_variation5.phpt b/ext/standard/tests/strings/chunk_split_variation5.phpt index 580f8f0a6ff5aafee2dda5fe68c94b73fefefe9d..ca34959354b1f44d696be1ecf16f488365cd52a5 100644 GIT binary patch delta 79 zcmew;_*QU(F^984YDGb6a!Ij5L1Iy2ZfZ$tk%EyzNxni-szOeFUb>D#N`7flPO3tB iW?5>ULS~+VYOz9oo3YTA~kI&>Pj&cBORoy's height > Sam's height. 13 < 15. 1111 & 0000 = string(104) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" -- Iteration 3 -- -string(114) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +Warning: htmlspecialchars_decode() expects parameter 2 to be long, double given in %s on line %d +NULL -- Iteration 4 -- string(114) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" From a401db22725264c146ded2eb42d1db25ca2b73f4 Mon Sep 17 00:00:00 2001 From: Andrea Faulds Date: Mon, 22 Sep 2014 22:47:28 +0100 Subject: [PATCH 03/37] Fixed ext/date tests broken by zpp error on overflow --- ext/date/tests/bug36988.phpt | 5 +- ext/date/tests/bug52062.phpt | 12 ++- ext/date/tests/date_sunrise_variation2.phpt | 4 +- ext/date/tests/date_sunrise_variation9.phpt | 34 ++++--- ext/date/tests/date_sunset_variation2.phpt | 6 +- ext/date/tests/date_sunset_variation9.phpt | 32 ++++-- ext/date/tests/getdate_variation7.phpt | 63 ++---------- ext/date/tests/gmdate_variation14.phpt | 16 +-- ext/date/tests/gmstrftime_variation2.phpt | 8 +- ext/date/tests/idate_variation3.phpt | 18 ++-- ext/date/tests/localtime_variation3.phpt | 102 ++++---------------- ext/date/tests/strftime_variation23.phpt | 18 ++-- 12 files changed, 124 insertions(+), 194 deletions(-) diff --git a/ext/date/tests/bug36988.phpt b/ext/date/tests/bug36988.phpt index c37d1fb768f..f82f3a1c521 100644 --- a/ext/date/tests/bug36988.phpt +++ b/ext/date/tests/bug36988.phpt @@ -5,7 +5,6 @@ Bug #36988 (mktime freezes on long numbers) date_default_timezone_set('GMT'); $start = microtime(true); $a = mktime(1, 1, 1, 1, 1, 11111111111); -echo (microtime(true) - $start) < 1 ? "smaller than one second" : "more than a second"; ?> ---EXPECT-- -smaller than one second +--EXPECTF-- +Warning: mktime() expects parameter 6 to be long, double given in %s on line %d diff --git a/ext/date/tests/bug52062.phpt b/ext/date/tests/bug52062.phpt index 81e767b0f0c..9d35a2942f9 100644 --- a/ext/date/tests/bug52062.phpt +++ b/ext/date/tests/bug52062.phpt @@ -2,7 +2,7 @@ Bug #52062 (large timestamps with DateTime::getTimestamp and DateTime::setTimestamp) (32 bit) --SKIPIF-- --INI-- date.timezone=UTC @@ -20,10 +20,12 @@ var_dump($d->getTimestamp()); $i = new DateInterval('PT100000000000S'); var_dump($i->format('%s')); ?> ---EXPECT-- +--EXPECTF-- string(32) "5138-11-16 09:46:40 100000000000" bool(false) string(12) "100000000000" -string(30) "2008-07-11 04:56:32 1215752192" -int(1215752192) -string(10) "1215752192" + +Warning: DateTime::setTimestamp() expects parameter 1 to be long, double given in %s on line %d +string(32) "5138-11-16 09:46:40 100000000000" +bool(false) +string(10) "1215752192" \ No newline at end of file diff --git a/ext/date/tests/date_sunrise_variation2.phpt b/ext/date/tests/date_sunrise_variation2.phpt index b613b35f96f..a6ae8824e24 100644 --- a/ext/date/tests/date_sunrise_variation2.phpt +++ b/ext/date/tests/date_sunrise_variation2.phpt @@ -114,12 +114,12 @@ bool(false) --float 12.3456789000e10-- -Warning: date_sunrise(): Wrong return format given, pick one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on line %d +Warning: date_sunrise() expects parameter 2 to be long, double given in %s on line %d bool(false) --float -12.3456789000e10-- -Warning: date_sunrise(): Wrong return format given, pick one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on line %d +Warning: date_sunrise() expects parameter 2 to be long, double given in %s on line %d bool(false) --float .5-- diff --git a/ext/date/tests/date_sunrise_variation9.phpt b/ext/date/tests/date_sunrise_variation9.phpt index 49af06d5245..747ef67e66b 100644 --- a/ext/date/tests/date_sunrise_variation9.phpt +++ b/ext/date/tests/date_sunrise_variation9.phpt @@ -32,16 +32,28 @@ var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $ze ?> ===DONE=== ---EXPECTREGEX-- -\*\*\* Testing date_sunrise\(\) : usage variation \*\*\* +--EXPECTF-- +*** Testing date_sunrise() : usage variation *** --- Testing date_sunrise\(\) function by passing float 12.3456789000e10 value to time -- -string\(5\) "(07:34|07:49)" -float\((7.566[0-9]*|7.821[0-9]*)\) -int\((-1097256359|123456811756)\) +-- Testing date_sunrise() function by passing float 12.3456789000e10 value to time -- --- Testing date_sunrise\(\) function by passing float -12.3456789000e10 value to time -- -string\(5\) "(07:42|08:48|08:04)" -float\((7.713[0-9]*|8.810[0-9]*|8.074[0-9]*)\) -int\((1097304168|-2147443882|-123456761731)\) -===DONE=== +Warning: date_sunrise() expects parameter 1 to be long, double given in %s on line %d +bool(false) + +Warning: date_sunrise() expects parameter 1 to be long, double given in %s on line %d +bool(false) + +Warning: date_sunrise() expects parameter 1 to be long, double given in %s on line %d +bool(false) + +-- Testing date_sunrise() function by passing float -12.3456789000e10 value to time -- + +Warning: date_sunrise() expects parameter 1 to be long, double given in %s on line %d +bool(false) + +Warning: date_sunrise() expects parameter 1 to be long, double given in %s on line %d +bool(false) + +Warning: date_sunrise() expects parameter 1 to be long, double given in %s on line %d +bool(false) +===DONE=== \ No newline at end of file diff --git a/ext/date/tests/date_sunset_variation2.phpt b/ext/date/tests/date_sunset_variation2.phpt index 575b64a22c2..10d6d07f12d 100644 --- a/ext/date/tests/date_sunset_variation2.phpt +++ b/ext/date/tests/date_sunset_variation2.phpt @@ -114,12 +114,12 @@ bool(false) --float 12.3456789000e10-- -Warning: date_sunset(): Wrong return format given, pick one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on line %d +Warning: date_sunset() expects parameter 2 to be long, double given in %s on line %d bool(false) --float -12.3456789000e10-- -Warning: date_sunset(): Wrong return format given, pick one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on line %d +Warning: date_sunset() expects parameter 2 to be long, double given in %s on line %d bool(false) --float .5-- @@ -208,4 +208,4 @@ int(1218199253) --unset var-- int(1218199253) -===DONE=== +===DONE=== \ No newline at end of file diff --git a/ext/date/tests/date_sunset_variation9.phpt b/ext/date/tests/date_sunset_variation9.phpt index 59a4b584a5b..122e27b402e 100644 --- a/ext/date/tests/date_sunset_variation9.phpt +++ b/ext/date/tests/date_sunset_variation9.phpt @@ -32,16 +32,28 @@ var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zen ?> ===DONE=== ---EXPECTREGEX-- -\*\*\* Testing date_sunset\(\) : usage variation \*\*\* +--EXPECTF-- +*** Testing date_sunset() : usage variation *** --- Testing date_sunset\(\) function by passing float 12.3456789000e10 value to time -- -string\(5\) "(19:49|19:28)" -float\((19.830[0-9]*|19.830[0-9]*|19.480[0-9]*)\) -int\((-1097212211|123456853728)\) +-- Testing date_sunset() function by passing float 12.3456789000e10 value to time -- --- Testing date_sunset\(\) function by passing float -12.3456789000e10 value to time -- -string\(5\) "(19:03|18:12|18:48)" -float\((19.056[0-9]*|18.213[0-9]*|18.808[0-9]*)\) -int\((1097345002|-2147410031|-123456723090)\) +Warning: date_sunset() expects parameter 1 to be long, double given in %s on line %d +bool(false) + +Warning: date_sunset() expects parameter 1 to be long, double given in %s on line %d +bool(false) + +Warning: date_sunset() expects parameter 1 to be long, double given in %s on line %d +bool(false) + +-- Testing date_sunset() function by passing float -12.3456789000e10 value to time -- + +Warning: date_sunset() expects parameter 1 to be long, double given in %s on line %d +bool(false) + +Warning: date_sunset() expects parameter 1 to be long, double given in %s on line %d +bool(false) + +Warning: date_sunset() expects parameter 1 to be long, double given in %s on line %d +bool(false) ===DONE=== diff --git a/ext/date/tests/getdate_variation7.phpt b/ext/date/tests/getdate_variation7.phpt index 5af2dd53fc6..6af0c0288e4 100644 --- a/ext/date/tests/getdate_variation7.phpt +++ b/ext/date/tests/getdate_variation7.phpt @@ -20,59 +20,16 @@ $timestamp = -12.3456789000e10; var_dump( getdate($timestamp) ); ?> ===DONE=== ---EXPECTREGEX-- +--EXPECTF-- +*** Testing getdate() : usage variation *** -\*\*\* Testing getdate\(\) : usage variation \*\*\* +-- Testing getdate() function by passing float 12.3456789000e10 value to timestamp -- --- Testing getdate\(\) function by passing float 12.3456789000e10 value to timestamp -- -array\(11\) { - \["seconds"\]=> - int\((36|0)\) - \["minutes"\]=> - int\((43|0)\) - \["hours"\]=> - int\((10|6)\) - \["mday"\]=> - int\((26|11)\) - \["wday"\]=> - int\((2|6)\) - \["mon"\]=> - int\(3\) - \["year"\]=> - int\((1935|5882)\) - \["yday"\]=> - int\((84|69)\) - \["weekday"\]=> - string\((7|8)\) "(Tuesday|Saturday)" - \["month"\]=> - string\(5\) "March" - \[0\]=> - int\((-1097262584|123456789000)\) -} +Warning: getdate() expects parameter 1 to be long, double given in %s on line %d +bool(false) --- Testing getdate\(\) function by passing float -12.3456789000e10 value to timestamp -- -array\(11\) { - \["seconds"\]=> - int\((44|12|20)\) - \["minutes"\]=> - int\((39|23)\) - \["hours"\]=> - int\((0|2|5)\) - \["mday"\]=> - int\((9|14|23)\) - \["wday"\]=> - int\((6|-4)\) - \["mon"\]=> - int\((10|12)\) - \["year"\]=> - int\((2004|1901|-1943)\) - \["yday"\]=> - int\((282|347|295)\) - \["weekday"\]=> - string\((8|7)\) "(Saturday|Unknown)" - \["month"\]=> - string\((7|8)\) "(October|December)" - \[0\]=> - int\((1097262584|-2147483648|-123456789000)\) -} -===DONE=== +-- Testing getdate() function by passing float -12.3456789000e10 value to timestamp -- + +Warning: getdate() expects parameter 1 to be long, double given in %s on line %d +bool(false) +===DONE=== \ No newline at end of file diff --git a/ext/date/tests/gmdate_variation14.phpt b/ext/date/tests/gmdate_variation14.phpt index 5b62a8274d6..72694048025 100644 --- a/ext/date/tests/gmdate_variation14.phpt +++ b/ext/date/tests/gmdate_variation14.phpt @@ -23,12 +23,16 @@ var_dump( gmdate($format, $timestamp) ); ?> ===DONE=== ---EXPECTREGEX-- -\*\*\* Testing gmdate\(\) : usage variation \*\*\* +--EXPECTF-- +*** Testing gmdate() : usage variation *** --- Testing gmdate\(\) function with float 12.3456789000e10 to timestamp -- -string\((24|25)\) "(1935-03-26T04:50:16\+0000|5882-03-11T00:30:00\+0000)" +-- Testing gmdate() function with float 12.3456789000e10 to timestamp -- --- Testing gmdate\(\) function with float -12.3456789000e10 to timestamp -- -string\((24|25)\) "(2004-10-08T19:09:44\+0000|1901-12-13T20:45:52\+0000|-1943-10-22T23:30:00\+0000)" +Warning: gmdate() expects parameter 2 to be long, double given in %s on line %d +bool(false) + +-- Testing gmdate() function with float -12.3456789000e10 to timestamp -- + +Warning: gmdate() expects parameter 2 to be long, double given in %s on line %d +bool(false) ===DONE=== \ No newline at end of file diff --git a/ext/date/tests/gmstrftime_variation2.phpt b/ext/date/tests/gmstrftime_variation2.phpt index c577fe1d3d4..c591dc3b16b 100644 --- a/ext/date/tests/gmstrftime_variation2.phpt +++ b/ext/date/tests/gmstrftime_variation2.phpt @@ -112,10 +112,14 @@ string(20) "Jan 01 1970 00:00:10" string(20) "Dec 31 1969 23:59:50" --float 12.3456789000e10-- -string(20) "Mar 26 1935 04:50:16" + +Warning: gmstrftime() expects parameter 2 to be long, double given in %s on line %d +bool(false) --float -12.3456789000e10-- -string(20) "Oct 08 2004 19:09:44" + +Warning: gmstrftime() expects parameter 2 to be long, double given in %s on line %d +bool(false) --float .5-- string(20) "Jan 01 1970 00:00:00" diff --git a/ext/date/tests/idate_variation3.phpt b/ext/date/tests/idate_variation3.phpt index 1a2ee1ffd56..406f527f055 100644 --- a/ext/date/tests/idate_variation3.phpt +++ b/ext/date/tests/idate_variation3.phpt @@ -24,12 +24,16 @@ var_dump( idate($format, $timestamp) ); ?> ===DONE=== ---EXPECTREGEX-- -\*\*\* Testing idate\(\) : usage variation \*\*\* +--EXPECTF-- +*** Testing idate() : usage variation *** --- Testing idate\(\) function with float 12.3456789000e10 to timestamp -- -int\((1935|5882)\) +-- Testing idate() function with float 12.3456789000e10 to timestamp -- --- Testing idate\(\) function with float -12.3456789000e10 to timestamp -- -int\((2004|1901|-1943)\) -===DONE=== +Warning: idate() expects parameter 2 to be long, double given in %s on line %d +bool(false) + +-- Testing idate() function with float -12.3456789000e10 to timestamp -- + +Warning: idate() expects parameter 2 to be long, double given in %s on line %d +bool(false) +===DONE=== \ No newline at end of file diff --git a/ext/date/tests/localtime_variation3.phpt b/ext/date/tests/localtime_variation3.phpt index d941e3891e6..97e09a6e0cc 100644 --- a/ext/date/tests/localtime_variation3.phpt +++ b/ext/date/tests/localtime_variation3.phpt @@ -27,90 +27,22 @@ var_dump( localtime($timestamp, $is_associative) ); ?> ===DONE=== ---EXPECTREGEX-- -\*\*\* Testing localtime\(\) : usage variation \*\*\* +--EXPECTF-- +*** Testing localtime() : usage variation *** --- Testing localtime\(\) function with 'float 12.3456789000e10' to timestamp -- -array\(9\) { - \[0\]=> - int\((16|0)\) - \[1\]=> - int\((50|30)\) - \[2\]=> - int\((4|0)\) - \[3\]=> - int\((26|11)\) - \[4\]=> - int\(2\) - \[5\]=> - int\((35|3982)\) - \[6\]=> - int\((2|6)\) - \[7\]=> - int\((84|69)\) - \[8\]=> - int\(0\) -} -array\(9\) { - \["tm_sec"\]=> - int\((16|0)\) - \["tm_min"\]=> - int\((50|30)\) - \["tm_hour"\]=> - int\((4|0)\) - \["tm_mday"\]=> - int\((26|11)\) - \["tm_mon"\]=> - int\(2\) - \["tm_year"\]=> - int\((35|3982)\) - \["tm_wday"\]=> - int\((2|6)\) - \["tm_yday"\]=> - int\((84|69)\) - \["tm_isdst"\]=> - int\(0\) -} +-- Testing localtime() function with 'float 12.3456789000e10' to timestamp -- --- Testing localtime\(\) function with 'float -12.3456789000e10' to timestamp -- -array\(9\) { - \[0\]=> - int\((44|52|0)\) - \[1\]=> - int\((9|45|30)\) - \[2\]=> - int\((19|20|23)\) - \[3\]=> - int\((8|13|22)\) - \[4\]=> - int\((9|11)\) - \[5\]=> - int\((104|1|-3843)\) - \[6\]=> - int\((5|-5)\) - \[7\]=> - int\((281|346|294)\) - \[8\]=> - int\(0\) -} -array\(9\) { - \["tm_sec"\]=> - int\((44|52|0)\) - \["tm_min"\]=> - int\((9|45|30)\) - \["tm_hour"\]=> - int\((19|20|23)\) - \["tm_mday"\]=> - int\((8|13|22)\) - \["tm_mon"\]=> - int\((9|11)\) - \["tm_year"\]=> - int\((104|1|-3843)\) - \["tm_wday"\]=> - int\((5|-5)\) - \["tm_yday"\]=> - int\((281|346|294)\) - \["tm_isdst"\]=> - int\(0\) -} -===DONE=== +Warning: localtime() expects parameter 1 to be long, double given in %s on line %d +bool(false) + +Warning: localtime() expects parameter 1 to be long, double given in %s on line %d +bool(false) + +-- Testing localtime() function with 'float -12.3456789000e10' to timestamp -- + +Warning: localtime() expects parameter 1 to be long, double given in %s on line %d +bool(false) + +Warning: localtime() expects parameter 1 to be long, double given in %s on line %d +bool(false) +===DONE=== \ No newline at end of file diff --git a/ext/date/tests/strftime_variation23.phpt b/ext/date/tests/strftime_variation23.phpt index b7cf8d788ee..4874a316b5c 100644 --- a/ext/date/tests/strftime_variation23.phpt +++ b/ext/date/tests/strftime_variation23.phpt @@ -25,12 +25,16 @@ var_dump( strftime($format, $timestamp) ); ?> ===DONE=== ---EXPECTREGEX-- -\*\*\* Testing strftime\(\) : usage variation \*\*\* +--EXPECTF-- +*** Testing strftime() : usage variation *** --- Testing strftime\(\) function with float 12.3456789000e10 to timestamp -- -string\(\d*\)\s"Mar\s(26|11)\s(1935|5882)\s(04|00):(50|30):(16|00)" +-- Testing strftime() function with float 12.3456789000e10 to timestamp -- --- Testing strftime\(\) function with float -12.3456789000e10 to timestamp -- -string\(\d*\)\s"(Oct|Dec)\s(08|13|22)\s(2004|1901|-1943)\s(19|20|23):(09|45|30):(44|52|00)" -===DONE=== +Warning: strftime() expects parameter 2 to be long, double given in %s on line %d +bool(false) + +-- Testing strftime() function with float -12.3456789000e10 to timestamp -- + +Warning: strftime() expects parameter 2 to be long, double given in %s on line %d +bool(false) +===DONE=== \ No newline at end of file From 820a464f1d29d737d94addb207e03c236e0d8654 Mon Sep 17 00:00:00 2001 From: Andrea Faulds Date: Mon, 22 Sep 2014 23:01:08 +0100 Subject: [PATCH 04/37] Mark said ext/date tests as 32-bit only --- ext/date/tests/bug36988.phpt | 2 ++ ext/date/tests/date_sunrise_variation2.phpt | 2 ++ ext/date/tests/date_sunrise_variation9.phpt | 2 ++ ext/date/tests/date_sunset_variation2.phpt | 2 ++ ext/date/tests/date_sunset_variation9.phpt | 2 ++ ext/date/tests/getdate_variation7.phpt | 2 ++ ext/date/tests/gmdate_variation14.phpt | 2 ++ ext/date/tests/idate_variation3.phpt | 2 ++ ext/date/tests/localtime_variation3.phpt | 2 ++ ext/date/tests/strftime_variation23.phpt | 2 ++ 10 files changed, 20 insertions(+) diff --git a/ext/date/tests/bug36988.phpt b/ext/date/tests/bug36988.phpt index f82f3a1c521..5fcacd67372 100644 --- a/ext/date/tests/bug36988.phpt +++ b/ext/date/tests/bug36988.phpt @@ -1,5 +1,7 @@ --TEST-- Bug #36988 (mktime freezes on long numbers) +--SKIPIF-- + --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- Date: Sun, 9 Nov 2014 01:53:52 +0000 Subject: [PATCH 05/37] Fixed some 32-bit tests --- .../tests/strings/strripos_offset.phpt | 8 +-- .../tests/strings/strrpos_offset.phpt | 8 +-- .../tests/strings/strrpos_variation14.phpt | 2 +- .../tests/strings/strrpos_variation15.phpt | 2 +- .../url/parse_url_variation_002_32bit.phpt | 62 +++++++------------ 5 files changed, 33 insertions(+), 49 deletions(-) diff --git a/ext/standard/tests/strings/strripos_offset.phpt b/ext/standard/tests/strings/strripos_offset.phpt index 524699ad524..40c865b869d 100644 --- a/ext/standard/tests/strings/strripos_offset.phpt +++ b/ext/standard/tests/strings/strripos_offset.phpt @@ -16,16 +16,16 @@ var_dump(strripos(1024, "te", -PHP_INT_MAX-1)); echo "Done\n"; ?> --EXPECTF-- -Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d +Warning: strripos() expects parameter 3 to be long, double given in %s on line %d bool(false) -Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d +Warning: strripos() expects parameter 3 to be long, double given in %s on line %d bool(false) -Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d +Warning: strripos() expects parameter 3 to be long, double given in %s on line %d bool(false) -Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d +Warning: strripos() expects parameter 3 to be long, double given in %s on line %d bool(false) Warning: strripos() expects parameter 1 to be string, array given in %s on line %d diff --git a/ext/standard/tests/strings/strrpos_offset.phpt b/ext/standard/tests/strings/strrpos_offset.phpt index 18b5847063e..229e758fcb4 100644 --- a/ext/standard/tests/strings/strrpos_offset.phpt +++ b/ext/standard/tests/strings/strrpos_offset.phpt @@ -15,16 +15,16 @@ var_dump(strrpos(1024, "te", -PHP_INT_MAX-1)); echo "Done\n"; ?> --EXPECTF-- -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d +Warning: strrpos() expects parameter 3 to be long, double given in %s on line %d bool(false) -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d +Warning: strrpos() expects parameter 3 to be long, double given in %s on line %d bool(false) -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d +Warning: strrpos() expects parameter 3 to be long, double given in %s on line %d bool(false) -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d +Warning: strrpos() expects parameter 3 to be long, double given in %s on line %d bool(false) Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d diff --git a/ext/standard/tests/strings/strrpos_variation14.phpt b/ext/standard/tests/strings/strrpos_variation14.phpt index 53c123a3fd1..5afec710c6b 100644 --- a/ext/standard/tests/strings/strrpos_variation14.phpt +++ b/ext/standard/tests/strings/strrpos_variation14.phpt @@ -92,7 +92,7 @@ int(6) int(6) -- Iteration 3 -- -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d +Warning: strrpos() expects parameter 3 to be long, double given in %s on line %d bool(false) -- Iteration 4 -- int(6) diff --git a/ext/standard/tests/strings/strrpos_variation15.phpt b/ext/standard/tests/strings/strrpos_variation15.phpt index d958cdc485f..7c35e50a7fa 100644 --- a/ext/standard/tests/strings/strrpos_variation15.phpt +++ b/ext/standard/tests/strings/strrpos_variation15.phpt @@ -110,7 +110,7 @@ Warning: strrpos(): Offset is greater than the length of haystack string in %s o bool(false) -- Iteration 7 -- -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d +Warning: strrpos() expects parameter 3 to be long, double given in %s on line %d bool(false) -- Iteration 8 -- bool(false) diff --git a/ext/standard/tests/url/parse_url_variation_002_32bit.phpt b/ext/standard/tests/url/parse_url_variation_002_32bit.phpt index aefb37a1173..a0b8615b753 100644 --- a/ext/standard/tests/url/parse_url_variation_002_32bit.phpt +++ b/ext/standard/tests/url/parse_url_variation_002_32bit.phpt @@ -80,11 +80,11 @@ echo "Done"; ?> --EXPECTF-- *** Testing parse_url() : usage variations *** -Error: 8 - Undefined variable: undefined_var, %s(61) -Error: 8 - Undefined variable: unset_var, %s(64) +Error: 8 - Undefined variable: undefined_var, %s(%d) +Error: 8 - Undefined variable: unset_var, %s(%d) Arg value 10.5 -Error: 2 - parse_url(): Invalid URL component identifier 10, %s(71) +Error: 2 - parse_url(): Invalid URL component identifier 10, %s(%d) bool(false) Arg value -10.5 @@ -108,54 +108,38 @@ array(8) { } Arg value 101234567000 -array(8) { - ["scheme"]=> - string(4) "http" - ["host"]=> - string(11) "www.php.net" - ["port"]=> - int(80) - ["user"]=> - string(6) "secret" - ["pass"]=> - string(7) "hideout" - ["path"]=> - string(10) "/index.php" - ["query"]=> - string(31) "test=1&test2=char&test3=mixesCI" - ["fragment"]=> - string(16) "some_page_ref123" -} +Error: 2 - parse_url() expects parameter 2 to be long, double given, %s(%d) +NULL Arg value 1.07654321E-9 string(4) "http" Arg value 0.5 string(4) "http" -Error: 8 - Array to string conversion, %sparse_url_variation_002_32bit.php(%d) +Error: 8 - Array to string conversion, %s(%d) Arg value Array -Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71) +Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(%d) NULL -Error: 8 - Array to string conversion, %sparse_url_variation_002_32bit.php(%d) +Error: 8 - Array to string conversion, %s(%d) Arg value Array -Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71) +Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(%d) NULL -Error: 8 - Array to string conversion, %sparse_url_variation_002_32bit.php(%d) +Error: 8 - Array to string conversion, %s(%d) Arg value Array -Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71) +Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(%d) NULL -Error: 8 - Array to string conversion, %sparse_url_variation_002_32bit.php(%d) +Error: 8 - Array to string conversion, %s(%d) Arg value Array -Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71) +Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(%d) NULL -Error: 8 - Array to string conversion, %sparse_url_variation_002_32bit.php(%d) +Error: 8 - Array to string conversion, %s(%d) Arg value Array -Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71) +Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(%d) NULL Arg value @@ -165,36 +149,36 @@ Arg value string(4) "http" Arg value 1 -string(11) "www.php.net" +string(%d) "www.php.net" Arg value string(4) "http" Arg value 1 -string(11) "www.php.net" +string(%d) "www.php.net" Arg value string(4) "http" Arg value -Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71) +Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(%d) NULL Arg value -Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71) +Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(%d) NULL Arg value string -Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71) +Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(%d) NULL Arg value string -Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71) +Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(%d) NULL -Error: 4096 - Object of class stdClass could not be converted to string, %s(70) +Error: 4096 - Object of class stdClass could not be converted to string, %s(%d) Arg value -Error: 2 - parse_url() expects parameter 2 to be long, object given, %s(71) +Error: 2 - parse_url() expects parameter 2 to be long, object given, %s(%d) NULL Arg value From 26bb809c21b87dd8c7aed8973d717c5a8c062137 Mon Sep 17 00:00:00 2001 From: Andrea Faulds Date: Sun, 9 Nov 2014 19:36:07 +0000 Subject: [PATCH 06/37] Fixed more 32-bit tests --- .../tests/general_functions/intval_variation2.phpt | 8 +++++--- ext/standard/tests/math/mt_rand_variation2.phpt | 4 +++- ext/standard/tests/math/mt_srand_variation1.phpt | 2 ++ ext/standard/tests/math/rand_variation1.phpt | 4 +++- ext/standard/tests/math/rand_variation2.phpt | 4 +++- ext/standard/tests/math/srand_variation1.phpt | 2 ++ 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ext/standard/tests/general_functions/intval_variation2.phpt b/ext/standard/tests/general_functions/intval_variation2.phpt index 65bc5842540..edd540724cf 100644 --- a/ext/standard/tests/general_functions/intval_variation2.phpt +++ b/ext/standard/tests/general_functions/intval_variation2.phpt @@ -113,10 +113,12 @@ int(1) int(1) --float 12.3456789000e10-- -int(1) +Error: 2 - intval() expects parameter 2 to be long, double given, %s(%d) +NULL --float -12.3456789000e10-- -int(1) +Error: 2 - intval() expects parameter 2 to be long, double given, %s(%d) +NULL --float .5-- int(1) @@ -192,4 +194,4 @@ int(1) --unset var-- int(1) -===DONE=== \ No newline at end of file +===DONE=== diff --git a/ext/standard/tests/math/mt_rand_variation2.phpt b/ext/standard/tests/math/mt_rand_variation2.phpt index 2174a349e5b..73b24f82afe 100644 --- a/ext/standard/tests/math/mt_rand_variation2.phpt +++ b/ext/standard/tests/math/mt_rand_variation2.phpt @@ -110,7 +110,9 @@ int(%i) int(%i) -- Iteration 8 -- -int(%i) + +Warning: mt_rand() expects parameter 2 to be long, double given in %s on line %d +NULL -- Iteration 9 -- int(%i) diff --git a/ext/standard/tests/math/mt_srand_variation1.phpt b/ext/standard/tests/math/mt_srand_variation1.phpt index feb0b379720..e69de44e8d9 100644 --- a/ext/standard/tests/math/mt_srand_variation1.phpt +++ b/ext/standard/tests/math/mt_srand_variation1.phpt @@ -110,6 +110,8 @@ NULL NULL -- Iteration 8 -- + +Warning: mt_srand() expects parameter 1 to be long, double given in %s on line %d NULL -- Iteration 9 -- diff --git a/ext/standard/tests/math/rand_variation1.phpt b/ext/standard/tests/math/rand_variation1.phpt index 02e552b7845..0c547ce0814 100644 --- a/ext/standard/tests/math/rand_variation1.phpt +++ b/ext/standard/tests/math/rand_variation1.phpt @@ -110,7 +110,9 @@ int(%i) int(%i) -- Iteration 8 -- -int(%i) + +Warning: rand() expects parameter 1 to be long, double given in %s on line %d +NULL -- Iteration 9 -- int(%i) diff --git a/ext/standard/tests/math/rand_variation2.phpt b/ext/standard/tests/math/rand_variation2.phpt index c0e1fc6373f..d292c249414 100644 --- a/ext/standard/tests/math/rand_variation2.phpt +++ b/ext/standard/tests/math/rand_variation2.phpt @@ -110,7 +110,9 @@ int(%i) int(%i) -- Iteration 8 -- -int(%i) + +Warning: rand() expects parameter 2 to be long, double given in %s on line %d +NULL -- Iteration 9 -- int(%i) diff --git a/ext/standard/tests/math/srand_variation1.phpt b/ext/standard/tests/math/srand_variation1.phpt index 16da80fd6a9..da6bdb7899a 100644 --- a/ext/standard/tests/math/srand_variation1.phpt +++ b/ext/standard/tests/math/srand_variation1.phpt @@ -110,6 +110,8 @@ NULL NULL -- Iteration 8 -- + +Warning: srand() expects parameter 1 to be long, double given in %s on line %d NULL -- Iteration 9 -- From 5b52fb5f9fd7632a885b0e307d5351f04e8113b5 Mon Sep 17 00:00:00 2001 From: Andrea Faulds Date: Sun, 9 Nov 2014 20:03:13 +0000 Subject: [PATCH 07/37] Marked tests as 32-bit --- ext/standard/tests/general_functions/intval_variation2.phpt | 2 ++ ext/standard/tests/math/mt_rand_variation2.phpt | 2 ++ ext/standard/tests/math/mt_srand_variation1.phpt | 2 ++ ext/standard/tests/math/rand_variation1.phpt | 2 ++ ext/standard/tests/math/rand_variation2.phpt | 2 ++ ext/standard/tests/math/srand_variation1.phpt | 2 ++ ext/standard/tests/strings/strripos_offset.phpt | 2 ++ ext/standard/tests/strings/strrpos_offset.phpt | 2 ++ ext/standard/tests/strings/strrpos_variation14.phpt | 2 ++ ext/standard/tests/strings/strrpos_variation15.phpt | 2 ++ 10 files changed, 20 insertions(+) diff --git a/ext/standard/tests/general_functions/intval_variation2.phpt b/ext/standard/tests/general_functions/intval_variation2.phpt index edd540724cf..8fdab26caaa 100644 --- a/ext/standard/tests/general_functions/intval_variation2.phpt +++ b/ext/standard/tests/general_functions/intval_variation2.phpt @@ -1,5 +1,7 @@ --TEST-- Test intval() function : usage variation +--SKIPIF-- + Date: Sun, 9 Nov 2014 21:29:21 +0100 Subject: [PATCH 08/37] Fixes iconv tests --- .../iconv_mime_decode_headers_variation2.phpt | 20 +++---------------- .../iconv_mime_decode_headers_variation3.phpt | 20 +++---------------- .../tests/iconv_mime_decode_variation2.phpt | 4 +++- ext/iconv/tests/iconv_strpos_variation3.phpt | 2 +- 4 files changed, 10 insertions(+), 36 deletions(-) diff --git a/ext/iconv/tests/iconv_mime_decode_headers_variation2.phpt b/ext/iconv/tests/iconv_mime_decode_headers_variation2.phpt index 5ceb801bed0..9c60876f27c 100644 --- a/ext/iconv/tests/iconv_mime_decode_headers_variation2.phpt +++ b/ext/iconv/tests/iconv_mime_decode_headers_variation2.phpt @@ -234,23 +234,9 @@ array(5) { } -- Iteration 7 -- -array(5) { - ["Subject"]=> - string(13) "A Sample Test" - ["To"]=> - string(19) "example@example.com" - ["Date"]=> - string(30) "Thu, 1 Jan 1970 00:00:00 +0000" - ["Message-Id"]=> - string(21) "" - ["Received"]=> - array(2) { - [0]=> - string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for ; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)" - [1]=> - string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000" - } -} + +Warning: iconv_mime_decode_headers() expects parameter 2 to be long, double given in %s on line %d +bool(false) -- Iteration 8 -- array(5) { diff --git a/ext/iconv/tests/iconv_mime_decode_headers_variation3.phpt b/ext/iconv/tests/iconv_mime_decode_headers_variation3.phpt index c4a9cc434a3..adac8e962c3 100644 --- a/ext/iconv/tests/iconv_mime_decode_headers_variation3.phpt +++ b/ext/iconv/tests/iconv_mime_decode_headers_variation3.phpt @@ -237,23 +237,9 @@ array(5) { } -- Iteration 7 -- -array(5) { - ["Subject"]=> - string(13) "A Sample Test" - ["To"]=> - string(19) "example@example.com" - ["Date"]=> - string(30) "Thu, 1 Jan 1970 00:00:00 +0000" - ["Message-Id"]=> - string(21) "" - ["Received"]=> - array(2) { - [0]=> - string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for ; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)" - [1]=> - string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000" - } -} + +Warning: iconv_mime_decode_headers() expects parameter 2 to be long, double given in %s on line %d +bool(false) -- Iteration 8 -- array(5) { diff --git a/ext/iconv/tests/iconv_mime_decode_variation2.phpt b/ext/iconv/tests/iconv_mime_decode_variation2.phpt index 1d828227aec..e353f8cfe2d 100644 --- a/ext/iconv/tests/iconv_mime_decode_variation2.phpt +++ b/ext/iconv/tests/iconv_mime_decode_variation2.phpt @@ -126,7 +126,9 @@ string(52) "5375626a6563743a205072c3bc66756e67205072c3bc66756e67" string(52) "5375626a6563743a205072c3bc66756e67205072c3bc66756e67" -- Iteration 7 -- -string(52) "5375626a6563743a205072c3bc66756e67205072c3bc66756e67" + +Warning: iconv_mime_decode() expects parameter 2 to be long, double given in %s on line %d +string(0) "" -- Iteration 8 -- string(52) "5375626a6563743a205072c3bc66756e67205072c3bc66756e67" diff --git a/ext/iconv/tests/iconv_strpos_variation3.phpt b/ext/iconv/tests/iconv_strpos_variation3.phpt index 3c333bfa57b..221b3a733f1 100644 --- a/ext/iconv/tests/iconv_strpos_variation3.phpt +++ b/ext/iconv/tests/iconv_strpos_variation3.phpt @@ -131,7 +131,7 @@ bool(false) -- Iteration 7 -- -Warning: iconv_strpos(): Offset not contained in string. in %s on line %d +Warning: iconv_strpos() expects parameter 3 to be long, double given in %s on line %d bool(false) -- Iteration 8 -- From 62f6c3c0c4974559e1afefb4b6725e98c359a679 Mon Sep 17 00:00:00 2001 From: Florian MARGAINE Date: Sun, 9 Nov 2014 22:47:19 +0100 Subject: [PATCH 09/37] Fixes posix tests --- ext/posix/tests/posix_getgrgid_variation.phpt | 2 ++ ext/posix/tests/posix_getpgid_variation.phpt | 2 ++ ext/posix/tests/posix_getpwuid_variation.phpt | 2 ++ ext/posix/tests/posix_kill_variation1.phpt | 2 ++ ext/posix/tests/posix_kill_variation2.phpt | 2 ++ ext/posix/tests/posix_seteuid_variation4.phpt | 6 +++++- ext/posix/tests/posix_setgid_variation4.phpt | 4 ++++ ext/posix/tests/posix_setuid_variation4.phpt | 6 +++++- ext/posix/tests/posix_strerror_variation1.phpt | 4 +++- 9 files changed, 27 insertions(+), 3 deletions(-) diff --git a/ext/posix/tests/posix_getgrgid_variation.phpt b/ext/posix/tests/posix_getgrgid_variation.phpt index 5cce391d7b2..0e3f7707a12 100644 --- a/ext/posix/tests/posix_getgrgid_variation.phpt +++ b/ext/posix/tests/posix_getgrgid_variation.phpt @@ -95,6 +95,8 @@ Arg value -10.5 valid output Arg value 101234567000 + +Warning: posix_getgrgid() expects parameter 1 to be long, double given in %s on line %d valid output Arg value 1.07654321E-9 diff --git a/ext/posix/tests/posix_getpgid_variation.phpt b/ext/posix/tests/posix_getpgid_variation.phpt index b9c92b539ab..5a0a9c13ae8 100644 --- a/ext/posix/tests/posix_getpgid_variation.phpt +++ b/ext/posix/tests/posix_getpgid_variation.phpt @@ -95,6 +95,8 @@ Arg value -10.5 valid output Arg value 101234567000 + +Warning: posix_getpgid() expects parameter 1 to be long, double given in %s on line %d valid output Arg value 1.07654321E-9 diff --git a/ext/posix/tests/posix_getpwuid_variation.phpt b/ext/posix/tests/posix_getpwuid_variation.phpt index 8b66f7f3d5c..05a7a5d4c69 100644 --- a/ext/posix/tests/posix_getpwuid_variation.phpt +++ b/ext/posix/tests/posix_getpwuid_variation.phpt @@ -95,6 +95,8 @@ Arg value -10.5 valid output Arg value 101234567000 + +Warning: posix_getpwuid() expects parameter 1 to be long, double given in %s on line %d valid output Arg value 1.07654321E-9 diff --git a/ext/posix/tests/posix_kill_variation1.phpt b/ext/posix/tests/posix_kill_variation1.phpt index 230977a9d0a..c5b4d3fe4aa 100644 --- a/ext/posix/tests/posix_kill_variation1.phpt +++ b/ext/posix/tests/posix_kill_variation1.phpt @@ -89,6 +89,8 @@ Arg value -10.5 bool(false) Arg value 101234567000 + +Warning: posix_kill() expects parameter 1 to be long, double given in %s on line %d bool(false) Arg value 1.07654321E-9 diff --git a/ext/posix/tests/posix_kill_variation2.phpt b/ext/posix/tests/posix_kill_variation2.phpt index c03ead9a4bb..020eb9f8975 100644 --- a/ext/posix/tests/posix_kill_variation2.phpt +++ b/ext/posix/tests/posix_kill_variation2.phpt @@ -89,6 +89,8 @@ Arg value -10.5 bool(false) Arg value 101234567000 + +Warning: posix_kill() expects parameter 2 to be long, double given in %s on line %d bool(false) Arg value 1.07654321E-9 diff --git a/ext/posix/tests/posix_seteuid_variation4.phpt b/ext/posix/tests/posix_seteuid_variation4.phpt index a6473284d4f..99bca7eea2b 100644 --- a/ext/posix/tests/posix_seteuid_variation4.phpt +++ b/ext/posix/tests/posix_seteuid_variation4.phpt @@ -36,6 +36,10 @@ foreach ( $variation_array as $var ) { *** Test substituting argument 1 with float values *** bool(false) bool(false) -bool(false) + +Warning: posix_seteuid() expects parameter 1 to be long, double given in %s on line %d +bool(false) + +Warning: posix_seteuid() expects parameter 1 to be long, double given in %s on line %d bool(false) bool(false) diff --git a/ext/posix/tests/posix_setgid_variation4.phpt b/ext/posix/tests/posix_setgid_variation4.phpt index faae4d4d446..6d5f6c3941f 100644 --- a/ext/posix/tests/posix_setgid_variation4.phpt +++ b/ext/posix/tests/posix_setgid_variation4.phpt @@ -35,7 +35,11 @@ foreach ( $variation_array as $var ) { *** Test substituting argument 1 with float values *** bool(false) bool(false) + +Warning: posix_setgid() expects parameter 1 to be long, double given in %s on line %d bool(false) + +Warning: posix_setgid() expects parameter 1 to be long, double given in %s on line %d bool(false) bool(false) ===DONE=== diff --git a/ext/posix/tests/posix_setuid_variation4.phpt b/ext/posix/tests/posix_setuid_variation4.phpt index 288ac0d8f11..e6c343ede1c 100644 --- a/ext/posix/tests/posix_setuid_variation4.phpt +++ b/ext/posix/tests/posix_setuid_variation4.phpt @@ -36,6 +36,10 @@ foreach ( $variation_array as $var ) { *** Test substituting argument 1 with float values *** bool(false) bool(false) -bool(false) + +Warning: posix_setuid() expects parameter 1 to be long, double given in %s on line %d +bool(false) + +Warning: posix_setuid() expects parameter 1 to be long, double given in %s on line %d bool(false) bool(false) diff --git a/ext/posix/tests/posix_strerror_variation1.phpt b/ext/posix/tests/posix_strerror_variation1.phpt index 4d2b5267163..7b62aafd4b5 100644 --- a/ext/posix/tests/posix_strerror_variation1.phpt +++ b/ext/posix/tests/posix_strerror_variation1.phpt @@ -88,7 +88,9 @@ Arg value -10.5 string Arg value 101234567000 -string + +Warning: posix_strerror() expects parameter 1 to be long, double given in %s on line %d +boolean Arg value 1.07654321E-9 string From df1b722b677d2b7fbd8e1906f88e22ccc2e3f23c Mon Sep 17 00:00:00 2001 From: Florian MARGAINE Date: Sun, 9 Nov 2014 22:58:45 +0100 Subject: [PATCH 10/37] Fixes simplexml test --- ext/simplexml/tests/SimpleXMLElement_xpath.phpt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ext/simplexml/tests/SimpleXMLElement_xpath.phpt b/ext/simplexml/tests/SimpleXMLElement_xpath.phpt index 4a613c2e510..334b6c81dba 100644 --- a/ext/simplexml/tests/SimpleXMLElement_xpath.phpt +++ b/ext/simplexml/tests/SimpleXMLElement_xpath.phpt @@ -2,7 +2,11 @@ Testing xpath() with invalid XML --FILE-- xpath("BBBB")); ---EXPECT-- -bool(false) +--EXPECTF-- +Notice: Undefined variable: x in %s on line %d + +Warning: simplexml_load_string() expects parameter 3 to be long, double given in %s on line %d + +Catchable fatal error: Call to a member function xpath() on null in %s on line %d \ No newline at end of file From f574ad140e754f800fd69cebe77de2d8d2d5985a Mon Sep 17 00:00:00 2001 From: Andrea Faulds Date: Fri, 28 Nov 2014 23:30:15 +0000 Subject: [PATCH 11/37] skip tests on 32-bit --- ext/iconv/tests/iconv_mime_decode_headers_variation2.phpt | 3 ++- ext/iconv/tests/iconv_mime_decode_headers_variation3.phpt | 3 ++- ext/iconv/tests/iconv_mime_decode_variation2.phpt | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ext/iconv/tests/iconv_mime_decode_headers_variation2.phpt b/ext/iconv/tests/iconv_mime_decode_headers_variation2.phpt index 9c60876f27c..4c771dbb233 100644 --- a/ext/iconv/tests/iconv_mime_decode_headers_variation2.phpt +++ b/ext/iconv/tests/iconv_mime_decode_headers_variation2.phpt @@ -2,6 +2,7 @@ Test iconv_mime_encode() function : usage variations - Pass different data types to mode arg --SKIPIF-- @@ -462,4 +463,4 @@ array(5) { Warning: iconv_mime_decode_headers() expects parameter 2 to be long, resource given in %s on line %d bool(false) -Done \ No newline at end of file +Done diff --git a/ext/iconv/tests/iconv_mime_decode_headers_variation3.phpt b/ext/iconv/tests/iconv_mime_decode_headers_variation3.phpt index adac8e962c3..0f604c4f2fb 100644 --- a/ext/iconv/tests/iconv_mime_decode_headers_variation3.phpt +++ b/ext/iconv/tests/iconv_mime_decode_headers_variation3.phpt @@ -2,6 +2,7 @@ Test iconv_mime_encode() function : usage variations - Pass different data types to charset arg --SKIPIF-- @@ -465,4 +466,4 @@ array(5) { Warning: iconv_mime_decode_headers() expects parameter 2 to be long, resource given in %s on line %d bool(false) -Done \ No newline at end of file +Done diff --git a/ext/iconv/tests/iconv_mime_decode_variation2.phpt b/ext/iconv/tests/iconv_mime_decode_variation2.phpt index e353f8cfe2d..a779ecc4360 100644 --- a/ext/iconv/tests/iconv_mime_decode_variation2.phpt +++ b/ext/iconv/tests/iconv_mime_decode_variation2.phpt @@ -2,6 +2,7 @@ Test iconv_mime_decode() function : usage variations - Pass different data types to mode arg --SKIPIF-- From 088580557da1a41bbfc6aee004d78a002c8a6632 Mon Sep 17 00:00:00 2001 From: Andrea Faulds Date: Fri, 28 Nov 2014 23:39:08 +0000 Subject: [PATCH 12/37] skip posix 32-bit --- ext/posix/tests/posix_getgrgid_variation.phpt | 3 ++- ext/posix/tests/posix_getpgid_variation.phpt | 1 + ext/posix/tests/posix_getpwuid_variation.phpt | 3 ++- ext/posix/tests/posix_kill_variation1.phpt | 3 ++- ext/posix/tests/posix_kill_variation2.phpt | 1 + ext/posix/tests/posix_seteuid_variation4.phpt | 1 + ext/posix/tests/posix_setgid_variation4.phpt | 1 + ext/posix/tests/posix_setuid_variation4.phpt | 1 + ext/posix/tests/posix_strerror_variation1.phpt | 3 ++- 9 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ext/posix/tests/posix_getgrgid_variation.phpt b/ext/posix/tests/posix_getgrgid_variation.phpt index 0e3f7707a12..4923f408c17 100644 --- a/ext/posix/tests/posix_getgrgid_variation.phpt +++ b/ext/posix/tests/posix_getgrgid_variation.phpt @@ -1,7 +1,8 @@ --TEST-- Test posix_getgrgid() function : usage variations - parameter types --SKIPIF-- - --FILE-- diff --git a/ext/posix/tests/posix_getpgid_variation.phpt b/ext/posix/tests/posix_getpgid_variation.phpt index 5a0a9c13ae8..f96bca29a3d 100644 --- a/ext/posix/tests/posix_getpgid_variation.phpt +++ b/ext/posix/tests/posix_getpgid_variation.phpt @@ -2,6 +2,7 @@ Test posix_getpgid() function : variation --SKIPIF-- --FILE-- diff --git a/ext/posix/tests/posix_kill_variation1.phpt b/ext/posix/tests/posix_kill_variation1.phpt index c5b4d3fe4aa..353c90d7cfe 100644 --- a/ext/posix/tests/posix_kill_variation1.phpt +++ b/ext/posix/tests/posix_kill_variation1.phpt @@ -1,7 +1,8 @@ --TEST-- Test posix_kill() function : usage variations - first parameter type --SKIPIF-- - --FILE-- diff --git a/ext/posix/tests/posix_kill_variation2.phpt b/ext/posix/tests/posix_kill_variation2.phpt index 020eb9f8975..6b104ccb22f 100644 --- a/ext/posix/tests/posix_kill_variation2.phpt +++ b/ext/posix/tests/posix_kill_variation2.phpt @@ -2,6 +2,7 @@ Test posix_kill() function : usage variations - second parameter type --SKIPIF-- --FILE-- diff --git a/ext/posix/tests/posix_seteuid_variation4.phpt b/ext/posix/tests/posix_seteuid_variation4.phpt index 99bca7eea2b..de814ce644b 100644 --- a/ext/posix/tests/posix_seteuid_variation4.phpt +++ b/ext/posix/tests/posix_seteuid_variation4.phpt @@ -2,6 +2,7 @@ Test function posix_seteuid() by substituting argument 1 with float values. --SKIPIF-- diff --git a/ext/posix/tests/posix_setgid_variation4.phpt b/ext/posix/tests/posix_setgid_variation4.phpt index 6d5f6c3941f..1f020124536 100644 --- a/ext/posix/tests/posix_setgid_variation4.phpt +++ b/ext/posix/tests/posix_setgid_variation4.phpt @@ -2,6 +2,7 @@ Test function posix_setgid() by substituting argument 1 with float values. --SKIPIF-- diff --git a/ext/posix/tests/posix_setuid_variation4.phpt b/ext/posix/tests/posix_setuid_variation4.phpt index e6c343ede1c..dbdc6ab7bf4 100644 --- a/ext/posix/tests/posix_setuid_variation4.phpt +++ b/ext/posix/tests/posix_setuid_variation4.phpt @@ -2,6 +2,7 @@ Test function posix_setuid() by substituting argument 1 with float values. --SKIPIF-- diff --git a/ext/posix/tests/posix_strerror_variation1.phpt b/ext/posix/tests/posix_strerror_variation1.phpt index 7b62aafd4b5..9e2099a71e6 100644 --- a/ext/posix/tests/posix_strerror_variation1.phpt +++ b/ext/posix/tests/posix_strerror_variation1.phpt @@ -1,7 +1,8 @@ --TEST-- Test posix_strerror() function : usage variations --SKIPIF-- - --FILE-- From 55e1c032e52bea355e35cad7a44f78da9f100985 Mon Sep 17 00:00:00 2001 From: Andrea Faulds Date: Fri, 28 Nov 2014 23:45:28 +0000 Subject: [PATCH 13/37] skip simplexml --- ext/simplexml/tests/SimpleXMLElement_xpath.phpt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/simplexml/tests/SimpleXMLElement_xpath.phpt b/ext/simplexml/tests/SimpleXMLElement_xpath.phpt index 334b6c81dba..afdf95b3399 100644 --- a/ext/simplexml/tests/SimpleXMLElement_xpath.phpt +++ b/ext/simplexml/tests/SimpleXMLElement_xpath.phpt @@ -1,5 +1,7 @@ --TEST-- Testing xpath() with invalid XML +--SKIPIF-- + Date: Sat, 29 Nov 2014 01:05:19 +0000 Subject: [PATCH 14/37] Skip buncha tests on 32-bit --- .../tests/array/array_change_key_case_variation2.phpt | 4 +++- ext/standard/tests/array/array_chunk_variation2.phpt | 2 ++ ext/standard/tests/array/array_pad_variation2.phpt | 2 ++ ext/standard/tests/array/array_rand_variation2.phpt | 2 ++ ext/standard/tests/array/count_variation2.phpt | 4 +++- ext/standard/tests/array/rsort_variation2.phpt | 4 +++- ext/standard/tests/dir/scandir_variation2.phpt | 2 ++ ext/standard/tests/file/chmod_variation4.phpt | 2 ++ ext/standard/tests/file/file_get_contents_variation5.phpt | 2 ++ ext/standard/tests/file/file_variation3.phpt | 2 ++ ext/standard/tests/file/fseek_variation2.phpt | 2 ++ ext/standard/tests/file/mkdir_variation2.phpt | 2 ++ ext/standard/tests/file/pathinfo_variation2.phpt | 2 ++ ext/standard/tests/file/touch_variation3.phpt | 1 + ext/standard/tests/file/touch_variation4.phpt | 1 + ext/standard/tests/file/umask_variation3.phpt | 1 + .../tests/general_functions/getrusage_variation1.phpt | 1 + .../tests/image/image_type_to_mime_type_variation1.phpt | 4 +++- ext/standard/tests/strings/chunk_split_variation2.phpt | 2 ++ ext/standard/tests/strings/count_chars_variation2.phpt | 2 ++ ext/standard/tests/strings/explode.phpt | 2 ++ ext/standard/tests/strings/str_pad_variation4.phpt | 2 ++ ext/standard/tests/strings/strcspn_variation4.phpt | 4 +++- ext/standard/tests/strings/stripos_variation14.phpt | 2 ++ ext/standard/tests/strings/stripos_variation15.phpt | 2 ++ ext/standard/tests/strings/strncasecmp_variation5.phpt | 2 ++ ext/standard/tests/strings/strncmp_variation5.phpt | 2 ++ ext/tokenizer/tests/001.phpt | 3 ++- ext/xml/tests/xml_error_string_variation1.phpt | 2 +- ext/xml/tests/xml_parser_get_option_variation2.phpt | 2 +- ext/xml/tests/xml_parser_set_option_variation2.phpt | 1 + tests/output/ob_implicit_flush_variation_001.phpt | 4 +++- 32 files changed, 63 insertions(+), 9 deletions(-) diff --git a/ext/standard/tests/array/array_change_key_case_variation2.phpt b/ext/standard/tests/array/array_change_key_case_variation2.phpt index 929ccb1c6a5..d1a479f7364 100644 --- a/ext/standard/tests/array/array_change_key_case_variation2.phpt +++ b/ext/standard/tests/array/array_change_key_case_variation2.phpt @@ -1,5 +1,7 @@ --TEST-- Test array_change_key_case() function : usage variations - Pass different data types as $case arg +--SKIPIF-- + int(3) } -Done \ No newline at end of file +Done diff --git a/ext/standard/tests/array/array_chunk_variation2.phpt b/ext/standard/tests/array/array_chunk_variation2.phpt index 8cfe994404b..93d92182963 100644 --- a/ext/standard/tests/array/array_chunk_variation2.phpt +++ b/ext/standard/tests/array/array_chunk_variation2.phpt @@ -1,5 +1,7 @@ --TEST-- Test array_chunk() function : usage variations - unexpected values for 'size' argument +--SKIPIF-- + int(1) } -Done \ No newline at end of file +Done diff --git a/ext/standard/tests/dir/scandir_variation2.phpt b/ext/standard/tests/dir/scandir_variation2.phpt index e6033f256cf..0d8199b39a2 100644 --- a/ext/standard/tests/dir/scandir_variation2.phpt +++ b/ext/standard/tests/dir/scandir_variation2.phpt @@ -1,5 +1,7 @@ --TEST-- Test scandir() function : usage variations - diff data types as $sorting_order arg +--SKIPIF-- + +--SKIPIF-- + +--SKIPIF-- + +--SKIPIF-- + +--SKIPIF-- + --SKIPIF-- --SKIPIF-- --SKIPIF-- diff --git a/ext/standard/tests/image/image_type_to_mime_type_variation1.phpt b/ext/standard/tests/image/image_type_to_mime_type_variation1.phpt index 0023b7125df..5b941f75563 100644 --- a/ext/standard/tests/image/image_type_to_mime_type_variation1.phpt +++ b/ext/standard/tests/image/image_type_to_mime_type_variation1.phpt @@ -1,5 +1,7 @@ --TEST-- Test image_type_to_mime_type() function : usage variations - Pass different data types as imagetype +--SKIPIF-- + + --FILE-- Date: Sat, 29 Nov 2014 01:26:34 +0000 Subject: [PATCH 15/37] Fix more 32-bit tests --- ext/standard/tests/array/array_fill_variation1.phpt | 9 +++------ .../tests/array/array_slice_variation2.phpt | 13 +++---------- .../tests/strings/str_split_variation2.phpt | 4 ++-- .../tests/strings/str_split_variation6.phpt | 4 ++-- .../tests/strings/str_split_variation7.phpt | 4 ++-- 5 files changed, 12 insertions(+), 22 deletions(-) diff --git a/ext/standard/tests/array/array_fill_variation1.phpt b/ext/standard/tests/array/array_fill_variation1.phpt index e2d0b6f58cf..f36da7d0e6a 100644 --- a/ext/standard/tests/array/array_fill_variation1.phpt +++ b/ext/standard/tests/array/array_fill_variation1.phpt @@ -124,12 +124,9 @@ array(2) { int(100) } -- Iteration 3 -- -array(2) { - [-1097262584]=> - int(100) - [0]=> - int(100) -} + +Warning: array_fill() expects parameter 1 to be long, double given in /Users/ajf/Projects/2014/PHP/php-src/ext/standard/tests/array/array_fill_variation1.php on line 92 +NULL -- Iteration 4 -- array(2) { [0]=> diff --git a/ext/standard/tests/array/array_slice_variation2.phpt b/ext/standard/tests/array/array_slice_variation2.phpt index 217788fec7b..8ec240818c4 100644 --- a/ext/standard/tests/array/array_slice_variation2.phpt +++ b/ext/standard/tests/array/array_slice_variation2.phpt @@ -152,16 +152,9 @@ array(4) { } -- Iteration 7 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} + +Warning: array_slice() expects parameter 2 to be long, double given in %s on line %d +NULL -- Iteration 8 -- array(4) { diff --git a/ext/standard/tests/strings/str_split_variation2.phpt b/ext/standard/tests/strings/str_split_variation2.phpt index ba1297b4052..423d9d894c0 100644 --- a/ext/standard/tests/strings/str_split_variation2.phpt +++ b/ext/standard/tests/strings/str_split_variation2.phpt @@ -111,8 +111,8 @@ Warning: str_split(): The length of each segment must be greater than zero in %s bool(false) --Iteration 3 -- -Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d -bool(false) +Warning: str_split() expects parameter 2 to be long, double given in %s on line %d +NULL --Iteration 4 -- Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d diff --git a/ext/standard/tests/strings/str_split_variation6.phpt b/ext/standard/tests/strings/str_split_variation6.phpt index 6d751bbccfb..049d1fe4015 100644 --- a/ext/standard/tests/strings/str_split_variation6.phpt +++ b/ext/standard/tests/strings/str_split_variation6.phpt @@ -157,8 +157,8 @@ array(1) { } -- Iteration 7 -- -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) +Warning: str_split() expects parameter 2 to be long, double given in %s line %d +NULL -- Iteration 8 -- Warning: str_split(): The length of each segment must be greater than zero in %s on line %d diff --git a/ext/standard/tests/strings/str_split_variation7.phpt b/ext/standard/tests/strings/str_split_variation7.phpt index 455c5b89720..ee0e88c51af 100644 --- a/ext/standard/tests/strings/str_split_variation7.phpt +++ b/ext/standard/tests/strings/str_split_variation7.phpt @@ -135,8 +135,8 @@ array(1) { } -- Iteration 7 -- -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) +Warning: str_split() expects parameter 2 to be long, double given in %s on line %d +NULL -- Iteration 8 -- Warning: str_split(): The length of each segment must be greater than zero in %s on line %d From d19ce51854a94d9da3f5ff24ea965928ed520688 Mon Sep 17 00:00:00 2001 From: Andrea Faulds Date: Sat, 29 Nov 2014 01:52:23 +0000 Subject: [PATCH 16/37] Fixed copy-and-paste error --- Zend/zend_API.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 6a8faf8c890..701c1811ec7 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -1083,7 +1083,7 @@ static zend_always_inline int _z_param_long(zval *arg, zend_long *dest, zend_boo if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), dest, &d)) != IS_LONG)) { if (EXPECTED(type != 0)) { - if (UNEXPECTED(zend_isnan(Z_DVAL_P(arg)))) { + if (UNEXPECTED(zend_isnan(d))) { return 0; } if (UNEXPECTED(d > ZEND_LONG_MAX || d < ZEND_LONG_MIN)) { From f90b877f4188dd24e0863456d175fc694a42f1c8 Mon Sep 17 00:00:00 2001 From: Andrea Faulds Date: Sat, 29 Nov 2014 02:13:20 +0000 Subject: [PATCH 17/37] Refactor ZEND_LONG_MAX/MIN checks into ZEND_DOUBLE_FITS_LONG() --- Zend/zend_API.c | 4 ++-- Zend/zend_API.h | 4 ++-- Zend/zend_operators.h | 12 +++++++++--- .../tests/strings/chunk_split_variation2.phpt | 4 ++-- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 04d7f8a23f2..57288c67090 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -407,7 +407,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons if (zend_isnan(d)) { return "long"; } - if (d > ZEND_LONG_MAX || d < ZEND_LONG_MIN) { + if (!ZEND_DOUBLE_FITS_LONG(d)) { if (c == 'L') { *p = (d > 0) ? ZEND_LONG_MAX : ZEND_LONG_MIN; } else { @@ -425,7 +425,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons if (zend_isnan(Z_DVAL_P(arg))) { return "long"; } - if (Z_DVAL_P(arg) > ZEND_LONG_MAX || Z_DVAL_P(arg) < ZEND_LONG_MIN) { + if (!ZEND_DOUBLE_FITS_LONG(Z_DVAL_P(arg))) { if (c == 'L') { *p = (Z_DVAL_P(arg) > 0) ? ZEND_LONG_MAX : ZEND_LONG_MIN; } else { diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 701c1811ec7..1886f13842c 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -1067,7 +1067,7 @@ static zend_always_inline int _z_param_long(zval *arg, zend_long *dest, zend_boo if (UNEXPECTED(zend_isnan(Z_DVAL_P(arg)))) { return 0; } - if (UNEXPECTED(Z_DVAL_P(arg) > ZEND_LONG_MAX || Z_DVAL_P(arg) < ZEND_LONG_MIN)) { + if (UNEXPECTED(!ZEND_DOUBLE_FITS_LONG(Z_DVAL_P(arg)))) { /* Ironically, the strict parameter makes zpp *non*-strict here */ if (strict) { *dest = (Z_DVAL_P(arg) > 0) ? ZEND_LONG_MAX : ZEND_LONG_MIN; @@ -1086,7 +1086,7 @@ static zend_always_inline int _z_param_long(zval *arg, zend_long *dest, zend_boo if (UNEXPECTED(zend_isnan(d))) { return 0; } - if (UNEXPECTED(d > ZEND_LONG_MAX || d < ZEND_LONG_MIN)) { + if (UNEXPECTED(!ZEND_DOUBLE_FITS_LONG(d))) { if (strict) { *dest = (d > 0) ? ZEND_LONG_MAX : ZEND_LONG_MIN; } else { diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index f95e856e684..9d290a1b066 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -89,6 +89,13 @@ ZEND_API zend_uchar _is_numeric_string_ex(const char *str, size_t length, zend_l END_EXTERN_C() +#if SIZEOF_ZEND_LONG == 4 +# define ZEND_DOUBLE_FITS_LONG(d) (!((d) > ZEND_LONG_MAX || (d) < ZEND_LONG_MIN)) +#else + /* >= as (double)ZEND_LONG_MAX is outside signed range */ +# define ZEND_DOUBLE_FITS_LONG(d) (!((d) >= ZEND_LONG_MAX || (d) < ZEND_LONG_MIN)) +#endif + #if ZEND_DVAL_TO_LVAL_CAST_OK static zend_always_inline zend_long zend_dval_to_lval(double d) { @@ -103,7 +110,7 @@ static zend_always_inline zend_long zend_dval_to_lval(double d) { if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) { return 0; - } else if (d > ZEND_LONG_MAX || d < ZEND_LONG_MIN) { + } else if (!ZEND_DOUBLE_FITS_LONG(d)) { double two_pow_32 = pow(2., 32.), dmod; @@ -122,8 +129,7 @@ static zend_always_inline zend_long zend_dval_to_lval(double d) { if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) { return 0; - /* >= as (double)ZEND_LONG_MAX is outside signed range */ - } else if (d >= ZEND_LONG_MAX || d < ZEND_LONG_MIN) { + } else if (!ZEND_DOUBLE_FITS_LONG(d)) { double two_pow_64 = pow(2., 64.), dmod; diff --git a/ext/standard/tests/strings/chunk_split_variation2.phpt b/ext/standard/tests/strings/chunk_split_variation2.phpt index 2e4eaae35a2..1503d520f45 100644 --- a/ext/standard/tests/strings/chunk_split_variation2.phpt +++ b/ext/standard/tests/strings/chunk_split_variation2.phpt @@ -100,8 +100,8 @@ Warning: chunk_split(): Chunk length should be greater than zero in %schunk_spli bool(false) -- Iteration 3 -- -Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d -bool(false) +Warning: chunk_split() expects parameter 2 to be long, double given in %s on line %d +NULL -- Iteration 4 -- Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d From 175844ca298a7f66c491a4e9d728d5bad7a7dd74 Mon Sep 17 00:00:00 2001 From: Andrea Faulds Date: Sat, 29 Nov 2014 02:58:41 +0000 Subject: [PATCH 18/37] Fixed gd test --- ext/gd/tests/imagecreatetruecolor_error2.phpt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/gd/tests/imagecreatetruecolor_error2.phpt b/ext/gd/tests/imagecreatetruecolor_error2.phpt index e4de7e382db..c5a5e692835 100644 --- a/ext/gd/tests/imagecreatetruecolor_error2.phpt +++ b/ext/gd/tests/imagecreatetruecolor_error2.phpt @@ -19,6 +19,6 @@ Warning: imagecreatetruecolor(): Invalid image dimensions in %s on line %d Warning: imagecreatetruecolor(): Invalid image dimensions in %s on line %d -Warning: imagecreatetruecolor(): Invalid image dimensions in %s on line %d +Warning: imagecreatetruecolor() expects parameter 1 to be long, double given in %s on line %d -Warning: imagecreatetruecolor(): Invalid image dimensions in %s on line %d \ No newline at end of file +Warning: imagecreatetruecolor() expects parameter 2 to be long, double given in %s on line %d From d5afeef24742be2c2f6b7a8b0932301eca0f9968 Mon Sep 17 00:00:00 2001 From: Andrea Faulds Date: Sat, 29 Nov 2014 03:41:55 +0000 Subject: [PATCH 19/37] Fix MySQLi tests --- ext/mysqli/tests/mysqli_field_seek.phpt | 4 ++-- ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt | 7 ++++--- ext/mysqli/tests/mysqli_stmt_send_long_data.phpt | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ext/mysqli/tests/mysqli_field_seek.phpt b/ext/mysqli/tests/mysqli_field_seek.phpt index 449d2f90d41..44f25bcfedb 100644 --- a/ext/mysqli/tests/mysqli_field_seek.phpt +++ b/ext/mysqli/tests/mysqli_field_seek.phpt @@ -218,8 +218,8 @@ Warning: mysqli_field_seek(): Invalid field offset in %s on line %d bool(false) bool(false) -Warning: mysqli_field_seek(): Invalid field offset in %s on line %d -bool(false) +Warning: mysqli_field_seek() expects parameter 2 to be long, double given in %s on line %d +NULL bool(true) object(stdClass)#%d (13) { [%u|b%"name"]=> diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt index ffb655d5fae..88add0aba52 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt @@ -67,8 +67,8 @@ if (!function_exists('mysqli_stmt_get_result')) if (false !== ($tmp = $res->data_seek($res->num_rows + 1))) printf("[012] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp); - if (false !== ($tmp = $res->data_seek(PHP_INT_MAX + 1))) - printf("[013] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp); + if (NULL !== ($tmp = $res->data_seek(PHP_INT_MAX + 1))) + printf("[013] Expecting NULL got %s/%s\n", gettype($tmp), $tmp); for ($i = 0; $i < 100; $i++) { /* intentionally out of range! */ @@ -118,6 +118,7 @@ if (!function_exists('mysqli_stmt_get_result')) require_once("clean_table.inc"); ?> --EXPECTF-- +Warning: mysqli_result::data_seek() expects parameter 1 to be long, double given in %s on line %d Warning: mysqli_data_seek(): Couldn't fetch mysqli_result in %s on line %d @@ -126,4 +127,4 @@ Warning: mysqli_result::fetch_array(): Couldn't fetch mysqli_result in %s on lin Warning: mysqli_data_seek(): Couldn't fetch mysqli_result in %s on line %d Warning: mysqli_result::fetch_array(): Couldn't fetch mysqli_result in %s on line %d -done! \ No newline at end of file +done! diff --git a/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt b/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt index 7e2f8603a87..1fc27455115 100644 --- a/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt +++ b/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt @@ -80,8 +80,8 @@ require_once('skipifconnectfailure.inc'); printf("[012] Expecting boolean/false, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (false !== ($tmp = @mysqli_stmt_send_long_data($stmt, PHP_INT_MAX + 1, $blob))) - printf("[013] Expecting boolean/false, got %s/%s. [%d] %s\n", + if (NULL !== ($tmp = @mysqli_stmt_send_long_data($stmt, PHP_INT_MAX + 1, $blob))) + printf("[013] Expecting NULL, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); if (false !== ($tmp = mysqli_stmt_send_long_data($stmt, 999, $blob))) @@ -132,4 +132,4 @@ require_once('skipifconnectfailure.inc'); ?> --EXPECTF-- Warning: mysqli_stmt_send_long_data(): Invalid parameter number in %s on line %d -done! \ No newline at end of file +done! From fbe9b2c088b7fe75cda6668448841ae1e1fcf59b Mon Sep 17 00:00:00 2001 From: Julien Pauli Date: Fri, 12 Dec 2014 14:18:27 +0100 Subject: [PATCH 20/37] Updated NEWS --- NEWS | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 2d948194f8a..7f3f98d181e 100644 --- a/NEWS +++ b/NEWS @@ -11,17 +11,12 @@ PHP NEWS . Fixed bug #68297 (Application Popup provides too few information). (Anatol) . Fixed bug #65769 (localeconv() broken in TS builds). (Anatol) . Fixed bug #65230 (setting locale randomly broken). (Anatol) - . Fixed bug #68545 (NULL pointer dereference in unserialize.c). (Anatol) . Fixed bug #68583 (Crash in timeout thread). (Anatol) - cURL: . Fixed bug #67643 (curl_multi_getcontent returns '' when CURLOPT_RETURNTRANSFER isn't set). (Jille Timmermans) -- Date: - . Fixed day_of_week function as it could sometimes return negative values - internally. (Derick) - - Mbstring: . Fixed bug #68504 (--with-libmbfl configure option not present on Windows). (Ashesh Vashi) @@ -46,7 +41,7 @@ PHP NEWS - SQLite: . Fixed bug #68120 (Update bundled libsqlite to 3.8.7.2). (Anatol) -11 Dec 2014, PHP 5.5.20 +18 Dec 2014, PHP 5.5.20 - Core: . Fixed bug #68091 (Some Zend headers lack appropriate extern "C" blocks). @@ -54,6 +49,11 @@ PHP NEWS . Fixed bug #68185 ("Inconsistent insteadof definition."- incorrectly triggered). (Julien) . Fixed bug #68370 ("unset($this)" can make the program crash). (Laruence) + . Fixed bug #68545 (NULL pointer dereference in unserialize.c). (Anatol) + +- Date: + . Fixed day_of_week function as it could sometimes return negative values + internally. (Derick) - FPM: . Fixed bug #68381 (fpm_unix_init_main ignores log_level). From d1a2c1522188481d9b54120e3f17dd9243c11d90 Mon Sep 17 00:00:00 2001 From: Julien Pauli Date: Fri, 12 Dec 2014 14:20:41 +0100 Subject: [PATCH 21/37] Updated NEWS --- NEWS | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 81a2f2b2217..08705fdc4fb 100644 --- a/NEWS +++ b/NEWS @@ -12,7 +12,6 @@ PHP NEWS . Fixed bug #68297 (Application Popup provides too few information). (Anatol) . Fixed bug #65769 (localeconv() broken in TS builds). (Anatol) . Fixed bug #65230 (setting locale randomly broken). (Anatol) - . Fixed bug #68545 (NULL pointer dereference in unserialize.c). (Anatol) . Fixed bug #68583 (Crash in timeout thread). (Anatol) - cURL: @@ -22,8 +21,6 @@ PHP NEWS - Date: . Implemented FR #68268 (DatePeriod: Getter for start date, end date and interval). (Marc Bennewitz) - . Fixed day_of_week function as it could sometimes return negative values - internally. (Derick) - Fileinfo: . Fixed bug #68398 (msooxml matches too many archives). (Anatol) @@ -57,7 +54,7 @@ PHP NEWS - SQLite: . Fixed bug #68120 (Update bundled libsqlite to 3.8.7.2). (Anatol) -11 Dec 2014, PHP 5.6.4 +18 Dec 2014, PHP 5.6.4 - Core: . Fixed bug #68091 (Some Zend headers lack appropriate extern "C" blocks). @@ -71,9 +68,14 @@ PHP NEWS . Fixed bug #68370 ("unset($this)" can make the program crash). (Laruence) . Fixed bug #68422 (Incorrect argument reflection info for array_multisort()). (Alexander Lisachenko) + . Fixed bug #68545 (NULL pointer dereference in unserialize.c). (Anatol) . Fixed bug #68446 (Array constant not accepted for array parameter default). (Bob, Dmitry) +- Date: + . Fixed day_of_week function as it could sometimes return negative values + internally. (Derick) + - FPM: . Fixed bug #68381 (fpm_unix_init_main ignores log_level). (David Zuelke, Remi) From ee226b961c2871dd2f454fa707fc23e4af5cf263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Mon, 8 Dec 2014 15:24:44 +0100 Subject: [PATCH 22/37] Fixed Bug #65576 (Constructor from trait conflicts with inherited constructor) --- Zend/tests/traits/bug65576a.phpt | 31 ++++++++++++++++++++++++++++++ Zend/tests/traits/bug65576b.phpt | 33 ++++++++++++++++++++++++++++++++ Zend/zend_compile.c | 4 ++-- 3 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 Zend/tests/traits/bug65576a.phpt create mode 100644 Zend/tests/traits/bug65576b.phpt diff --git a/Zend/tests/traits/bug65576a.phpt b/Zend/tests/traits/bug65576a.phpt new file mode 100644 index 00000000000..49b2ba0c964 --- /dev/null +++ b/Zend/tests/traits/bug65576a.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #65576 (Constructor from trait conflicts with inherited constructor) +--FILE-- +clone = fe; fe->common.fn_flags |= ZEND_ACC_CLONE; } else if (!strncmp(mname, ZEND_CONSTRUCTOR_FUNC_NAME, mname_len)) { - if (ce->constructor) { + if (ce->constructor && (!ce->parent || ce->constructor != ce->parent->constructor)) { zend_error(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ce->name); } ce->constructor = fe; fe->common.fn_flags |= ZEND_ACC_CTOR; @@ -3867,7 +3867,7 @@ static void zend_add_magic_methods(zend_class_entry* ce, const char* mname, uint zend_str_tolower_copy(lowercase_name, ce->name, ce->name_length); lowercase_name = (char*)zend_new_interned_string(lowercase_name, ce->name_length + 1, 1 TSRMLS_CC); if (!memcmp(mname, lowercase_name, mname_len)) { - if (ce->constructor) { + if (ce->constructor && (!ce->parent || ce->constructor != ce->parent->constructor)) { zend_error(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ce->name); } ce->constructor = fe; From d6eb3b49c878ce01f1d9d73eebc4d9fec4330573 Mon Sep 17 00:00:00 2001 From: Julien Pauli Date: Fri, 12 Dec 2014 15:06:04 +0100 Subject: [PATCH 23/37] Updated NEWS --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 7f3f98d181e..a0dcf344d8d 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,8 @@ PHP NEWS . Upgraded crypt_blowfish to version 1.3. (Leigh) . Fixed bug #60704 (unlink() bug with some files path). . Fixed bug #65419 (Inside trait, self::class != __CLASS__). (Julien) + . Fixed bug #65576 (Constructor from trait conflicts with inherited + constructor). (dunglas at gmail dot com) . Fixed bug #55541 (errors spawn MessageBox, which blocks test automation). (Anatol) . Fixed bug #68297 (Application Popup provides too few information). (Anatol) From 4cda98264ec4ab80e9ca54c10cf2f332d6e09290 Mon Sep 17 00:00:00 2001 From: Julien Pauli Date: Fri, 12 Dec 2014 16:12:52 +0100 Subject: [PATCH 24/37] Updated NEWS --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 08705fdc4fb..f4f06bbb34d 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,8 @@ PHP NEWS . Fixed bug #65769 (localeconv() broken in TS builds). (Anatol) . Fixed bug #65230 (setting locale randomly broken). (Anatol) . Fixed bug #68583 (Crash in timeout thread). (Anatol) + . Fixed bug #65576 (Constructor from trait conflicts with inherited + constructor). (dunglas at gmail dot com) - cURL: . Fixed bug #67643 (curl_multi_getcontent returns '' when From 8e42063c0cf51a94a28c7d02a1813899f4624573 Mon Sep 17 00:00:00 2001 From: Julien Pauli Date: Fri, 12 Dec 2014 16:14:52 +0100 Subject: [PATCH 25/37] Updated NEWS --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 07bbd045fd2..8e02a29ff23 100644 --- a/NEWS +++ b/NEWS @@ -22,6 +22,8 @@ PHP NEWS classes (https://wiki.php.net/rfc/secure_unserialize). (Stas) . Fixed bug #68185 ("Inconsistent insteadof definition."- incorrectly triggered). (Julien) . Fixed bug #65419 (Inside trait, self::class != __CLASS__). (Julien) + . Fixed bug #65576 (Constructor from trait conflicts with inherited + constructor). (dunglas at gmail dot com) - Date: . Fixed day_of_week function as it could sometimes return negative values From 86f18755362b594c519ccde37c3b3f98158b591e Mon Sep 17 00:00:00 2001 From: mcq8 Date: Thu, 4 Dec 2014 17:36:44 +0100 Subject: [PATCH 26/37] Fix bug #68532: convert.base64-encode omits padding bytes --- ext/standard/tests/file/bug68532.phpt | 25 +++++++++++++++++++ .../tests/file/stream_rfc2397_007.phpt | 2 ++ main/streams/memory.c | 20 +++++++++------ 3 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 ext/standard/tests/file/bug68532.phpt diff --git a/ext/standard/tests/file/bug68532.phpt b/ext/standard/tests/file/bug68532.phpt new file mode 100644 index 00000000000..7d1a0cea9ad --- /dev/null +++ b/ext/standard/tests/file/bug68532.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #68532: convert.base64-encode omits padding bytes +--FILE-- + +--CLEAN-- + +--EXPECT-- +memoryStream = dGVzdA== +fileStream = dGVzdA== diff --git a/ext/standard/tests/file/stream_rfc2397_007.phpt b/ext/standard/tests/file/stream_rfc2397_007.phpt index 8a6f3155dd7..b62f19cd374 100644 --- a/ext/standard/tests/file/stream_rfc2397_007.phpt +++ b/ext/standard/tests/file/stream_rfc2397_007.phpt @@ -27,6 +27,7 @@ foreach($streams as $stream) var_dump(feof($fp)); echo "===GETC===\n"; var_dump(fgetc($fp)); + var_dump(fgetc($fp)); var_dump(ftell($fp)); var_dump(feof($fp)); echo "===REWIND===\n"; @@ -94,6 +95,7 @@ int(5) bool(false) ===GETC=== string(1) "5" +bool(false) int(6) bool(true) ===REWIND=== diff --git a/main/streams/memory.c b/main/streams/memory.c index e6d0baaa86d..f73c12f7d71 100644 --- a/main/streams/memory.c +++ b/main/streams/memory.c @@ -87,15 +87,19 @@ static size_t php_stream_memory_read(php_stream *stream, char *buf, size_t count php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract; assert(ms != NULL); - if (ms->fpos + count >= ms->fsize) { - count = ms->fsize - ms->fpos; + if (ms->fpos == ms->fsize) { stream->eof = 1; - } - if (count) { - assert(ms->data!= NULL); - assert(buf!= NULL); - memcpy(buf, ms->data+ms->fpos, count); - ms->fpos += count; + count = 0; + } else { + if (ms->fpos + count >= ms->fsize) { + count = ms->fsize - ms->fpos; + } + if (count) { + assert(ms->data!= NULL); + assert(buf!= NULL); + memcpy(buf, ms->data+ms->fpos, count); + ms->fpos += count; + } } return count; } From d43d0663af9d7f11985fa6994f785b2dd5cb0faa Mon Sep 17 00:00:00 2001 From: Julien Pauli Date: Fri, 12 Dec 2014 16:50:32 +0100 Subject: [PATCH 27/37] Updated NEWS --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index a0dcf344d8d..33a3684b40b 100644 --- a/NEWS +++ b/NEWS @@ -43,6 +43,10 @@ PHP NEWS - SQLite: . Fixed bug #68120 (Update bundled libsqlite to 3.8.7.2). (Anatol) +- Streams: + . Fixed bug #68532 (convert.base64-encode omits padding bytes). + (blaesius at krumedia dot de) + 18 Dec 2014, PHP 5.5.20 - Core: From 238529fc3e8fb04fabfb122de312efba3d7822e4 Mon Sep 17 00:00:00 2001 From: Julien Pauli Date: Fri, 12 Dec 2014 16:51:37 +0100 Subject: [PATCH 28/37] Updated NEWS --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index f4f06bbb34d..0ef30e9140e 100644 --- a/NEWS +++ b/NEWS @@ -56,6 +56,10 @@ PHP NEWS - SQLite: . Fixed bug #68120 (Update bundled libsqlite to 3.8.7.2). (Anatol) +- Streams: + . Fixed bug #68532 (convert.base64-encode omits padding bytes). + (blaesius at krumedia dot de) + 18 Dec 2014, PHP 5.6.4 - Core: From 5ad01e1d33fc669608f09cc55e0db373b89a7546 Mon Sep 17 00:00:00 2001 From: Julien Pauli Date: Fri, 12 Dec 2014 17:02:20 +0100 Subject: [PATCH 29/37] Updated NEWS --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 8e02a29ff23..2ab4d99a60e 100644 --- a/NEWS +++ b/NEWS @@ -84,6 +84,10 @@ PHP NEWS . Added intdiv() function. (Andrea) . Improved precision of log() function for base 2 and 10. (Marc Bennewitz) +- Streams: + . Fixed bug #68532 (convert.base64-encode omits padding bytes). + (blaesius at krumedia dot de) + - XSL: . Fixed bug #64776 (The XSLT extension is not thread safe). (Mike) From 094d409b3d34c51f49e0121e5ccfe8b2a717aaf6 Mon Sep 17 00:00:00 2001 From: Guilherme Blanco Date: Sat, 22 Nov 2014 04:57:55 +0000 Subject: [PATCH 30/37] Removed ZEND_ACC_FINAL_CLASS which is unnecessary. This also fixed some currently defined classes as final which were just not being considered as such before. --- Zend/zend_closures.c | 2 +- Zend/zend_compile.h | 1 - Zend/zend_generators.c | 2 +- Zend/zend_inheritance.c | 2 +- Zend/zend_language_parser.y | 2 +- ext/mysqli/mysqli.c | 4 ++-- ext/pdo/pdo_stmt.c | 2 +- ext/phar/phar_object.c | 4 ++-- ext/reflection/php_reflection.c | 10 +++++----- .../tests/ReflectionClass_getModifiers_basic.phpt | 2 +- .../tests/ReflectionClass_modifiers_001.phpt | 2 +- ext/reflection/tests/ReflectionClass_toString_001.phpt | 2 +- ext/tidy/tidy.c | 2 +- 13 files changed, 18 insertions(+), 19 deletions(-) diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index bf0ba0ace40..b9d097c424d 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -445,7 +445,7 @@ void zend_register_closure_ce(TSRMLS_D) /* {{{ */ INIT_CLASS_ENTRY(ce, "Closure", closure_functions); zend_ce_closure = zend_register_internal_class(&ce TSRMLS_CC); - zend_ce_closure->ce_flags |= ZEND_ACC_FINAL_CLASS; + zend_ce_closure->ce_flags |= ZEND_ACC_FINAL; zend_ce_closure->create_object = zend_closure_new; zend_ce_closure->serialize = zend_class_serialize_deny; zend_ce_closure->unserialize = zend_class_unserialize_deny; diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index c44b37b9958..3b1e046cc0a 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -182,7 +182,6 @@ typedef struct _zend_try_catch_element { /* ZEND_ACC_EXPLICIT_ABSTRACT_CLASS denotes that a class was explicitly defined as abstract by using the keyword. */ #define ZEND_ACC_IMPLICIT_ABSTRACT_CLASS 0x10 #define ZEND_ACC_EXPLICIT_ABSTRACT_CLASS 0x20 -#define ZEND_ACC_FINAL_CLASS 0x40 #define ZEND_ACC_INTERFACE 0x80 #define ZEND_ACC_TRAIT 0x120 diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 2d1810ef78d..c3827c5c511 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -671,7 +671,7 @@ void zend_register_generator_ce(TSRMLS_D) /* {{{ */ INIT_CLASS_ENTRY(ce, "Generator", generator_functions); zend_ce_generator = zend_register_internal_class(&ce TSRMLS_CC); - zend_ce_generator->ce_flags |= ZEND_ACC_FINAL_CLASS; + zend_ce_generator->ce_flags |= ZEND_ACC_FINAL; zend_ce_generator->create_object = zend_generator_create; zend_ce_generator->serialize = zend_class_serialize_deny; zend_ce_generator->unserialize = zend_class_unserialize_deny; diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index cf2a3cb4add..9b81978e6e2 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -727,7 +727,7 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent && !(parent_ce->ce_flags & ZEND_ACC_INTERFACE)) { zend_error_noreturn(E_COMPILE_ERROR, "Interface %s may not inherit from class (%s)", ce->name->val, parent_ce->name->val); } - if (parent_ce->ce_flags & ZEND_ACC_FINAL_CLASS) { + if (parent_ce->ce_flags & ZEND_ACC_FINAL) { zend_error_noreturn(E_COMPILE_ERROR, "Class %s may not inherit from final class (%s)", ce->name->val, parent_ce->name->val); } diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index 94734defe22..4d666480552 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -435,7 +435,7 @@ class_declaration_statement: class_type: T_CLASS { $$ = 0; } | T_ABSTRACT T_CLASS { $$ = ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; } - | T_FINAL T_CLASS { $$ = ZEND_ACC_FINAL_CLASS; } + | T_FINAL T_CLASS { $$ = ZEND_ACC_FINAL; } | T_TRAIT { $$ = ZEND_ACC_TRAIT; } ; diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index 878c8fb9467..6d7210fe592 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -625,7 +625,7 @@ PHP_MINIT_FUNCTION(mysqli) zend_declare_property_null(ce, "embedded", sizeof("embedded") - 1, ZEND_ACC_PUBLIC TSRMLS_CC); zend_declare_property_null(ce, "reconnect", sizeof("reconnect") - 1, ZEND_ACC_PUBLIC TSRMLS_CC); zend_declare_property_null(ce, "report_mode", sizeof("report_mode") - 1, ZEND_ACC_PUBLIC TSRMLS_CC); - ce->ce_flags |= ZEND_ACC_FINAL_CLASS; + ce->ce_flags |= ZEND_ACC_FINAL; zend_hash_add_ptr(&classes, ce->name, &mysqli_driver_properties); REGISTER_MYSQLI_CLASS_ENTRY("mysqli", mysqli_link_class_entry, mysqli_link_methods); @@ -655,7 +655,7 @@ PHP_MINIT_FUNCTION(mysqli) REGISTER_MYSQLI_CLASS_ENTRY("mysqli_warning", mysqli_warning_class_entry, mysqli_warning_methods); ce = mysqli_warning_class_entry; - ce->ce_flags |= ZEND_ACC_FINAL_CLASS | ZEND_ACC_PROTECTED; + ce->ce_flags |= ZEND_ACC_FINAL; zend_hash_init(&mysqli_warning_properties, 0, NULL, free_prop_handler, 1); MYSQLI_ADD_PROPERTIES(&mysqli_warning_properties, mysqli_warning_property_entries); zend_declare_property_null(ce, "message", sizeof("message") - 1, ZEND_ACC_PUBLIC TSRMLS_CC); diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 27cc157ed72..1491c80cfdd 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -2292,7 +2292,7 @@ void pdo_stmt_init(TSRMLS_D) INIT_CLASS_ENTRY(ce, "PDORow", pdo_row_functions); pdo_row_ce = zend_register_internal_class(&ce TSRMLS_CC); - pdo_row_ce->ce_flags |= ZEND_ACC_FINAL_CLASS; /* when removing this a lot of handlers need to be redone */ + pdo_row_ce->ce_flags |= ZEND_ACC_FINAL; /* when removing this a lot of handlers need to be redone */ pdo_row_ce->create_object = pdo_row_new; pdo_row_ce->serialize = pdo_row_serialize; } diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index f82b8256314..d23c7cd6c6f 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -5308,11 +5308,11 @@ void phar_object_init(TSRMLS_D) /* {{{ */ #else INIT_CLASS_ENTRY(ce, "Phar", php_archive_methods); phar_ce_archive = zend_register_internal_class(&ce TSRMLS_CC); - phar_ce_archive->ce_flags |= ZEND_ACC_FINAL_CLASS; + phar_ce_archive->ce_flags |= ZEND_ACC_FINAL; INIT_CLASS_ENTRY(ce, "PharData", php_archive_methods); phar_ce_data = zend_register_internal_class(&ce TSRMLS_CC); - phar_ce_data->ce_flags |= ZEND_ACC_FINAL_CLASS; + phar_ce_data->ce_flags |= ZEND_ACC_FINAL; #endif REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "BZ2", PHAR_ENT_COMPRESSED_BZ2) diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 18906d6004e..026680cd6d5 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -395,7 +395,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in if (ce->ce_flags & (ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) { string_printf(str, "abstract "); } - if (ce->ce_flags & ZEND_ACC_FINAL_CLASS) { + if (ce->ce_flags & ZEND_ACC_FINAL) { string_printf(str, "final "); } string_printf(str, "class "); @@ -1557,7 +1557,7 @@ ZEND_METHOD(reflection, getModifierNames) if (modifiers & (ZEND_ACC_ABSTRACT | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) { add_next_index_stringl(return_value, "abstract", sizeof("abstract")-1); } - if (modifiers & (ZEND_ACC_FINAL | ZEND_ACC_FINAL_CLASS)) { + if (modifiers & ZEND_ACC_FINAL) { add_next_index_stringl(return_value, "final", sizeof("final")-1); } if (modifiers & ZEND_ACC_IMPLICIT_PUBLIC) { @@ -4162,7 +4162,7 @@ ZEND_METHOD(reflection_class, isTrait) Returns whether this class is final */ ZEND_METHOD(reflection_class, isFinal) { - _class_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_FINAL_CLASS); + _class_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_FINAL); } /* }}} */ @@ -4290,7 +4290,7 @@ ZEND_METHOD(reflection_class, newInstanceWithoutConstructor) METHOD_NOTSTATIC(reflection_class_ptr); GET_REFLECTION_OBJECT_PTR(ce); - if (ce->create_object != NULL && ce->ce_flags & ZEND_ACC_FINAL_CLASS) { + if (ce->create_object != NULL && ce->ce_flags & ZEND_ACC_FINAL) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %s is an internal class marked as final that cannot be instantiated without invoking its constructor", ce->name->val); } @@ -6187,7 +6187,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */ REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_IMPLICIT_ABSTRACT", ZEND_ACC_IMPLICIT_ABSTRACT_CLASS); REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_EXPLICIT_ABSTRACT", ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); - REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_FINAL", ZEND_ACC_FINAL_CLASS); + REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_FINAL", ZEND_ACC_FINAL); INIT_CLASS_ENTRY(_reflection_entry, "ReflectionObject", reflection_object_functions); _reflection_entry.create_object = reflection_objects_new; diff --git a/ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt b/ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt index 65f23c935f9..8d2bd47d12d 100644 --- a/ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt +++ b/ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt @@ -30,7 +30,7 @@ dump_modifiers('g'); --EXPECT-- int(0) int(32) -int(64) +int(4) int(128) int(524288) int(524416) diff --git a/ext/reflection/tests/ReflectionClass_modifiers_001.phpt b/ext/reflection/tests/ReflectionClass_modifiers_001.phpt index 941bfe5f2b9..1e0a97dfe08 100644 --- a/ext/reflection/tests/ReflectionClass_modifiers_001.phpt +++ b/ext/reflection/tests/ReflectionClass_modifiers_001.phpt @@ -37,7 +37,7 @@ int(0) bool(true) bool(false) bool(false) -int(64) +int(4) bool(false) bool(true) bool(false) diff --git a/ext/reflection/tests/ReflectionClass_toString_001.phpt b/ext/reflection/tests/ReflectionClass_toString_001.phpt index 8dd571c3a9c..c47aba8b8d6 100644 --- a/ext/reflection/tests/ReflectionClass_toString_001.phpt +++ b/ext/reflection/tests/ReflectionClass_toString_001.phpt @@ -14,7 +14,7 @@ Class [ class ReflectionClass implements Reflector ] { - Constants [3] { Constant [ integer IS_IMPLICIT_ABSTRACT ] { 16 } Constant [ integer IS_EXPLICIT_ABSTRACT ] { 32 } - Constant [ integer IS_FINAL ] { 64 } + Constant [ integer IS_FINAL ] { 4 } } - Static properties [0] { diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index 8ca27d7b9a4..23531e9ae3e 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -1037,7 +1037,7 @@ static PHP_MINIT_FUNCTION(tidy) REGISTER_INI_ENTRIES(); REGISTER_TIDY_CLASS(tidy, doc, NULL, 0); - REGISTER_TIDY_CLASS(tidyNode, node, NULL, ZEND_ACC_FINAL_CLASS); + REGISTER_TIDY_CLASS(tidyNode, node, NULL, ZEND_ACC_FINAL); tidy_object_handlers_doc.cast_object = tidy_doc_cast_handler; tidy_object_handlers_node.cast_object = tidy_node_cast_handler; From 0adfa03397edcde8cba3bae2032b1f2ef26ea760 Mon Sep 17 00:00:00 2001 From: Julien Pauli Date: Fri, 5 Dec 2014 04:15:23 +0000 Subject: [PATCH 31/37] Merged PR #911. --- NEWS | 2 ++ UPGRADING.INTERNALS | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/NEWS b/NEWS index 2ab4d99a60e..44c247624e0 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,8 @@ PHP NEWS . Fixed bug #65419 (Inside trait, self::class != __CLASS__). (Julien) . Fixed bug #65576 (Constructor from trait conflicts with inherited constructor). (dunglas at gmail dot com) + . Removed ZEND_ACC_FINAL_CLASS, promoting ZEND_ACC_FINAL as final class + modifier. (Guilherme Blanco) - Date: . Fixed day_of_week function as it could sometimes return negative values diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index 0c4dc8a3425..3b80f295e23 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -13,6 +13,7 @@ PHP 7.0 INTERNALS UPGRADE NOTES l. get_class_name object handler info m. Other portable macros info n. ZEND_ENGINE_2 removal + o. Updated final class modifier 2. Build system changes a. Unix build system changes @@ -123,6 +124,9 @@ PHP 7.0 INTERNALS UPGRADE NOTES ZEND_NORETURN is defined as __declspec(noreturn) on VS n. The ZEND_ENGINE_2 macro has been removed. A ZEND_ENGINE_3 macro has been added. + + o. Removed ZEND_ACC_FINAL_CLASS in favour of ZEND_ACC_FINAL, turning final class + modifier now a different class entry flag. Update your extensions. ======================== 2. Build system changes From 9beb3763dbafb5421f4a263510bab73f8d7b80c2 Mon Sep 17 00:00:00 2001 From: Jille Timmermans Date: Wed, 11 Jun 2014 17:34:34 +0200 Subject: [PATCH 32/37] pcntl_signal_dispatch: Speed up by preventing system calls when unnecessary --- ext/pcntl/pcntl.c | 7 +++++++ ext/pcntl/php_pcntl.h | 1 + 2 files changed, 8 insertions(+) diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c index 3c9eb676291..1ee8ba799f0 100644 --- a/ext/pcntl/pcntl.c +++ b/ext/pcntl/pcntl.c @@ -1225,6 +1225,7 @@ static void pcntl_signal_handler(int signo) PCNTL_G(head) = psig; } PCNTL_G(tail) = psig; + PCNTL_G(pending_signals) = 1; } void pcntl_signal_dispatch() @@ -1234,6 +1235,10 @@ void pcntl_signal_dispatch() sigset_t mask; sigset_t old_mask; TSRMLS_FETCH(); + + if(!PCNTL_G(pending_signals)) { + return; + } /* Mask all signals */ sigfillset(&mask); @@ -1273,6 +1278,8 @@ void pcntl_signal_dispatch() queue = next; } + PCNTL_G(pending_signals) = 0; + /* Re-enable queue */ PCNTL_G(processing_signal_queue) = 0; diff --git a/ext/pcntl/php_pcntl.h b/ext/pcntl/php_pcntl.h index caafc10d191..44e91166ae6 100644 --- a/ext/pcntl/php_pcntl.h +++ b/ext/pcntl/php_pcntl.h @@ -69,6 +69,7 @@ ZEND_BEGIN_MODULE_GLOBALS(pcntl) int processing_signal_queue; struct php_pcntl_pending_signal *head, *tail, *spares; int last_error; + volatile char pending_signals; ZEND_END_MODULE_GLOBALS(pcntl) #ifdef ZTS From 68cfeed70fad9c5d524bd95da2e08dc9a85f79a6 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 12 Dec 2014 21:57:12 +0300 Subject: [PATCH 33/37] Removed unnecessary checks --- Zend/zend_execute.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index aff92a3952b..b6e53ed3a8e 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1666,12 +1666,12 @@ static zend_always_inline void i_init_func_execute_data(zend_execute_data *execu } while (var != end); } - if (op_array->this_var != -1 && Z_OBJ(EX(This))) { + if (op_array->this_var != -1 && EXPECTED(Z_OBJ(EX(This)))) { ZVAL_OBJ(EX_VAR(op_array->this_var), Z_OBJ(EX(This))); GC_REFCOUNT(Z_OBJ(EX(This)))++; } - if (!op_array->run_time_cache && op_array->last_cache_slot) { + if (UNEXPECTED(!op_array->run_time_cache)) { op_array->run_time_cache = zend_arena_calloc(&CG(arena), op_array->last_cache_slot, sizeof(void*)); } EX_LOAD_RUN_TIME_CACHE(op_array); @@ -1691,12 +1691,12 @@ static zend_always_inline void i_init_code_execute_data(zend_execute_data *execu zend_attach_symbol_table(execute_data); - if (op_array->this_var != -1 && Z_OBJ(EX(This))) { + if (op_array->this_var != -1 && EXPECTED(Z_OBJ(EX(This)))) { ZVAL_OBJ(EX_VAR(op_array->this_var), Z_OBJ(EX(This))); GC_REFCOUNT(Z_OBJ(EX(This)))++; } - if (!op_array->run_time_cache && op_array->last_cache_slot) { + if (!op_array->run_time_cache) { op_array->run_time_cache = ecalloc(op_array->last_cache_slot, sizeof(void*)); } EX_LOAD_RUN_TIME_CACHE(op_array); @@ -1762,12 +1762,12 @@ static zend_always_inline void i_init_execute_data(zend_execute_data *execute_da } } - if (op_array->this_var != -1 && Z_OBJ(EX(This))) { + if (op_array->this_var != -1 && EXPECTED(Z_OBJ(EX(This)))) { ZVAL_OBJ(EX_VAR(op_array->this_var), Z_OBJ(EX(This))); GC_REFCOUNT(Z_OBJ(EX(This)))++; } - if (!op_array->run_time_cache && op_array->last_cache_slot) { + if (!op_array->run_time_cache) { if (op_array->function_name) { op_array->run_time_cache = zend_arena_calloc(&CG(arena), op_array->last_cache_slot, sizeof(void*)); } else { From 3893c1fc3d221f3954115de638db4be0e03e886c Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 12 Dec 2014 21:57:34 +0300 Subject: [PATCH 34/37] Fixed compilation warnings --- Zend/zend_API.c | 4 ++-- Zend/zend_API.h | 2 +- Zend/zend_closures.c | 2 +- Zend/zend_compile.c | 8 ++++---- Zend/zend_exceptions.c | 6 +++--- Zend/zend_execute.c | 12 ++++++------ Zend/zend_execute_API.c | 4 ++-- Zend/zend_indent.c | 2 +- Zend/zend_inheritance.c | 4 ++-- Zend/zend_interfaces.c | 8 ++++---- Zend/zend_iterators.c | 7 ++++++- Zend/zend_virtual_cwd.c | 2 +- Zend/zend_vm_def.h | 4 ++-- Zend/zend_vm_execute.h | 4 ++-- 14 files changed, 37 insertions(+), 32 deletions(-) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 369852ffbef..2e13f3a20ef 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -1127,7 +1127,7 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties TSRMLS_DC) } /* }}} */ -static int zval_update_class_constant(zval *pp, int is_static, int offset TSRMLS_DC) /* {{{ */ +static int zval_update_class_constant(zval *pp, int is_static, uint32_t offset TSRMLS_DC) /* {{{ */ { ZVAL_DEREF(pp); if (Z_CONSTANT_P(pp)) { @@ -2195,7 +2195,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio internal_function->arg_info = (zend_internal_arg_info*)ptr->arg_info+1; internal_function->num_args = ptr->num_args; /* Currently you cannot denote that the function can accept less arguments than num_args */ - if (info->required_num_args == -1) { + if (info->required_num_args == (zend_uintptr_t)-1) { internal_function->required_num_args = ptr->num_args; } else { internal_function->required_num_args = info->required_num_args; diff --git a/Zend/zend_API.h b/Zend/zend_API.h index bee797b7da6..052214140fe 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -525,7 +525,7 @@ ZEND_API zend_array *zend_rebuild_symbol_table(TSRMLS_D); ZEND_API void zend_attach_symbol_table(zend_execute_data *execute_data); ZEND_API void zend_detach_symbol_table(zend_execute_data *execute_data); ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force TSRMLS_DC); -ZEND_API int zend_set_local_var_str(const char *name, int len, zval *value, int force TSRMLS_DC); +ZEND_API int zend_set_local_var_str(const char *name, size_t len, zval *value, int force TSRMLS_DC); ZEND_API zend_string *zend_find_alias_name(zend_class_entry *ce, zend_string *name); ZEND_API zend_string *zend_resolve_method_name(zend_class_entry *ce, zend_function *f); diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index b9d097c424d..94ee585ddc2 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -436,7 +436,7 @@ static const zend_function_entry closure_functions[] = { ZEND_ME(Closure, bind, arginfo_closure_bind, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) ZEND_MALIAS(Closure, bindTo, bind, arginfo_closure_bindto, ZEND_ACC_PUBLIC) ZEND_ME(Closure, call, arginfo_closure_call, ZEND_ACC_PUBLIC) - {NULL, NULL, NULL} + ZEND_FE_END }; void zend_register_closure_ce(TSRMLS_D) /* {{{ */ diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index ec449fd1da4..dae6c22026b 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1033,7 +1033,7 @@ void zend_do_early_binding(TSRMLS_D) /* {{{ */ if (CG(compiler_options) & ZEND_COMPILE_DELAYED_BINDING) { uint32_t *opline_num = &CG(active_op_array)->early_binding; - while (*opline_num != -1) { + while (*opline_num != (uint32_t)-1) { opline_num = &CG(active_op_array)->opcodes[*opline_num].result.opline_num; } *opline_num = opline - CG(active_op_array)->opcodes; @@ -1074,13 +1074,13 @@ void zend_do_early_binding(TSRMLS_D) /* {{{ */ ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array TSRMLS_DC) /* {{{ */ { - if (op_array->early_binding != -1) { + if (op_array->early_binding != (uint32_t)-1) { zend_bool orig_in_compilation = CG(in_compilation); uint32_t opline_num = op_array->early_binding; zend_class_entry *ce; CG(in_compilation) = 1; - while (opline_num != -1) { + while (opline_num != (uint32_t)-1) { if ((ce = zend_lookup_class(Z_STR_P(RT_CONSTANT(op_array, op_array->opcodes[opline_num-1].op2)) TSRMLS_CC)) != NULL) { do_bind_inherited_class(op_array, &op_array->opcodes[opline_num], EG(class_table), ce, 0 TSRMLS_CC); } @@ -1973,7 +1973,7 @@ static zend_op *zend_compile_simple_var_no_cv(znode *result, zend_ast *ast, uint /* there is a chance someone is accessing $this */ if (ast->kind != ZEND_AST_ZVAL - && CG(active_op_array)->scope && CG(active_op_array)->this_var == -1 + && CG(active_op_array)->scope && CG(active_op_array)->this_var == (uint32_t)-1 ) { zend_string *key = zend_string_init("this", sizeof("this") - 1, 0); CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), key TSRMLS_CC); diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 4159a46d3c3..0d5fc53da8e 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -664,7 +664,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_exception___construct, 0, 0, 0) ZEND_ARG_INFO(0, previous) ZEND_END_ARG_INFO() -const static zend_function_entry default_exception_functions[] = { +static const zend_function_entry default_exception_functions[] = { ZEND_ME(exception, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) ZEND_ME(exception, __construct, arginfo_exception___construct, ZEND_ACC_PUBLIC) ZEND_ME(exception, getMessage, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) @@ -675,7 +675,7 @@ const static zend_function_entry default_exception_functions[] = { ZEND_ME(exception, getPrevious, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(exception, getTraceAsString, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(exception, __toString, NULL, 0) - {NULL, NULL, NULL} + ZEND_FE_END }; ZEND_BEGIN_ARG_INFO_EX(arginfo_error_exception___construct, 0, 0, 0) @@ -690,7 +690,7 @@ ZEND_END_ARG_INFO() static const zend_function_entry error_exception_functions[] = { ZEND_ME(error_exception, __construct, arginfo_error_exception___construct, ZEND_ACC_PUBLIC) ZEND_ME(error_exception, getSeverity, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) - {NULL, NULL, NULL} + ZEND_FE_END }; /* }}} */ diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index b6e53ed3a8e..0a156f84a41 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1168,7 +1168,7 @@ str_index: return retval; } -static zend_never_inline zend_long zend_check_string_offset(zval *container, zval *dim, int type TSRMLS_DC) +static zend_never_inline zend_long zend_check_string_offset(zval *dim, int type TSRMLS_DC) { zend_long offset; @@ -1211,7 +1211,7 @@ try_again: static zend_always_inline zend_long zend_fetch_string_offset(zval *container, zval *dim, int type TSRMLS_DC) { - zend_long offset = zend_check_string_offset(container, dim, type TSRMLS_CC); + zend_long offset = zend_check_string_offset(dim, type TSRMLS_CC); if (Z_REFCOUNTED_P(container)) { if (Z_REFCOUNT_P(container) > 1) { @@ -1250,7 +1250,7 @@ convert_to_array: goto fetch_from_array; } - zend_check_string_offset(container, dim, type TSRMLS_CC); + zend_check_string_offset(dim, type TSRMLS_CC); ZVAL_INDIRECT(result, NULL); /* wrong string offset */ } else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) { @@ -1666,7 +1666,7 @@ static zend_always_inline void i_init_func_execute_data(zend_execute_data *execu } while (var != end); } - if (op_array->this_var != -1 && EXPECTED(Z_OBJ(EX(This)))) { + if (op_array->this_var != (uint32_t)-1 && EXPECTED(Z_OBJ(EX(This)))) { ZVAL_OBJ(EX_VAR(op_array->this_var), Z_OBJ(EX(This))); GC_REFCOUNT(Z_OBJ(EX(This)))++; } @@ -1691,7 +1691,7 @@ static zend_always_inline void i_init_code_execute_data(zend_execute_data *execu zend_attach_symbol_table(execute_data); - if (op_array->this_var != -1 && EXPECTED(Z_OBJ(EX(This)))) { + if (op_array->this_var != (uint32_t)-1 && EXPECTED(Z_OBJ(EX(This)))) { ZVAL_OBJ(EX_VAR(op_array->this_var), Z_OBJ(EX(This))); GC_REFCOUNT(Z_OBJ(EX(This)))++; } @@ -1762,7 +1762,7 @@ static zend_always_inline void i_init_execute_data(zend_execute_data *execute_da } } - if (op_array->this_var != -1 && EXPECTED(Z_OBJ(EX(This)))) { + if (op_array->this_var != (uint32_t)-1 && EXPECTED(Z_OBJ(EX(This)))) { ZVAL_OBJ(EX_VAR(op_array->this_var), Z_OBJ(EX(This))); GC_REFCOUNT(Z_OBJ(EX(This)))++; } diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 760747affa7..480206bfb59 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -218,7 +218,7 @@ void shutdown_destructors(TSRMLS_D) /* {{{ */ EG(symbol_table).ht.pDestructor = zend_unclean_zval_ptr_dtor; } zend_try { - int symbols; + uint32_t symbols; do { symbols = zend_hash_num_elements(&EG(symbol_table).ht); zend_hash_reverse_apply(&EG(symbol_table).ht, (apply_func_t) zval_call_destructor TSRMLS_CC); @@ -1542,7 +1542,7 @@ ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force TSRMLS } /* }}} */ -ZEND_API int zend_set_local_var_str(const char *name, int len, zval *value, int force TSRMLS_DC) /* {{{ */ +ZEND_API int zend_set_local_var_str(const char *name, size_t len, zval *value, int force TSRMLS_DC) /* {{{ */ { zend_execute_data *execute_data = EG(current_execute_data); diff --git a/Zend/zend_indent.c b/Zend/zend_indent.c index b5884c72c0b..22cc4d2b9ed 100644 --- a/Zend/zend_indent.c +++ b/Zend/zend_indent.c @@ -34,7 +34,7 @@ static void handle_whitespace(unsigned int *emit_whitespace) { unsigned char c; - int i; + unsigned int i; for (c=0; c<128; c++) { if (emit_whitespace[c]>0) { diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 9b81978e6e2..8963d2b93b3 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -591,7 +591,7 @@ static zend_bool do_inherit_method_check(HashTable *child_function_table, zend_f } /* }}} */ -static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_property_info *parent_info, zend_string *key, zend_class_entry *ce TSRMLS_DC) /* {{{ */ +static zend_bool do_inherit_property_access_check(zend_property_info *parent_info, zend_string *key, zend_class_entry *ce TSRMLS_DC) /* {{{ */ { zend_property_info *child_info; zend_class_entry *parent_ce = ce->parent; @@ -831,7 +831,7 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent } ZEND_HASH_FOREACH_END(); ZEND_HASH_FOREACH_STR_KEY_PTR(&parent_ce->properties_info, key, property_info) { - if (do_inherit_property_access_check(&ce->properties_info, property_info, key, ce TSRMLS_CC)) { + if (do_inherit_property_access_check(property_info, key, ce TSRMLS_CC)) { if (ce->type & ZEND_INTERNAL_CLASS) { property_info = zend_duplicate_property_info_internal(property_info); } else { diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index f0762892014..16ae8ea3c5c 100644 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -499,7 +499,7 @@ static int zend_implement_serializable(zend_class_entry *interface, zend_class_e /* {{{ function tables */ const zend_function_entry zend_funcs_aggregate[] = { ZEND_ABSTRACT_ME(iterator, getIterator, NULL) - {NULL, NULL, NULL} + ZEND_FE_END }; const zend_function_entry zend_funcs_iterator[] = { @@ -508,7 +508,7 @@ const zend_function_entry zend_funcs_iterator[] = { ZEND_ABSTRACT_ME(iterator, key, NULL) ZEND_ABSTRACT_ME(iterator, valid, NULL) ZEND_ABSTRACT_ME(iterator, rewind, NULL) - {NULL, NULL, NULL} + ZEND_FE_END }; const zend_function_entry *zend_funcs_traversable = NULL; @@ -531,7 +531,7 @@ const zend_function_entry zend_funcs_arrayaccess[] = { ZEND_ABSTRACT_ME(arrayaccess, offsetGet, arginfo_arrayaccess_offset_get) ZEND_ABSTRACT_ME(arrayaccess, offsetSet, arginfo_arrayaccess_offset_value) ZEND_ABSTRACT_ME(arrayaccess, offsetUnset, arginfo_arrayaccess_offset) - {NULL, NULL, NULL} + ZEND_FE_END }; ZEND_BEGIN_ARG_INFO(arginfo_serializable_serialize, 0) @@ -541,7 +541,7 @@ ZEND_END_ARG_INFO() const zend_function_entry zend_funcs_serializable[] = { ZEND_ABSTRACT_ME(serializable, serialize, NULL) ZEND_FENTRY(unserialize, NULL, arginfo_serializable_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT|ZEND_ACC_CTOR) - {NULL, NULL, NULL} + ZEND_FE_END }; /* }}} */ diff --git a/Zend/zend_iterators.c b/Zend/zend_iterators.c index 8edd5dbdc44..8d81eae3b01 100644 --- a/Zend/zend_iterators.c +++ b/Zend/zend_iterators.c @@ -50,7 +50,12 @@ static zend_object_handlers iterator_object_handlers = { NULL, /* get class name */ NULL, /* compare */ NULL, /* cast */ - NULL /* count */ + NULL, /* count */ + NULL, /* get_debug_info */ + NULL, /* get_closure */ + NULL, /* get_gc */ + NULL, /* do_operation */ + NULL /* compare */ }; ZEND_API void zend_register_iterator_wrapper(TSRMLS_D) diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c index 509b33e369d..33bfddc3f91 100644 --- a/Zend/zend_virtual_cwd.c +++ b/Zend/zend_virtual_cwd.c @@ -620,7 +620,7 @@ static inline zend_ulong realpath_cache_key(const char *path, int path_len) /* { CWD_API void realpath_cache_clean(TSRMLS_D) /* {{{ */ { - int i; + uint32_t i; for (i = 0; i < sizeof(CWDG(realpath_cache))/sizeof(CWDG(realpath_cache)[0]); i++) { realpath_cache_bucket *p = CWDG(realpath_cache)[i]; diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 223ecf9a0db..0bf218d5816 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5513,8 +5513,8 @@ ZEND_VM_HANDLER(105, ZEND_TICKS, ANY, ANY) USE_OPLINE SAVE_OPLINE(); - if (++EG(ticks_count)>=opline->extended_value) { - EG(ticks_count)=0; + if ((uint32_t)++EG(ticks_count) >= opline->extended_value) { + EG(ticks_count) = 0; if (zend_ticks_function) { zend_ticks_function(opline->extended_value TSRMLS_CC); } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 408b59d6928..038953ccd43 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1144,8 +1144,8 @@ static int ZEND_FASTCALL ZEND_TICKS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) USE_OPLINE SAVE_OPLINE(); - if (++EG(ticks_count)>=opline->extended_value) { - EG(ticks_count)=0; + if ((uint32_t)++EG(ticks_count) >= opline->extended_value) { + EG(ticks_count) = 0; if (zend_ticks_function) { zend_ticks_function(opline->extended_value TSRMLS_CC); } From 07b5896a1389c3e865cbd2fb353806b2cefe4f5c Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 13 Dec 2014 09:03:44 +0100 Subject: [PATCH 35/37] Fix bug #68601 buffer read overflow in gd_gif_in.c --- ext/gd/libgd/gd_gif_in.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ext/gd/libgd/gd_gif_in.c b/ext/gd/libgd/gd_gif_in.c index ee88a2fc8e1..491e9422db0 100644 --- a/ext/gd/libgd/gd_gif_in.c +++ b/ext/gd/libgd/gd_gif_in.c @@ -72,8 +72,10 @@ static struct { #define STACK_SIZE ((1<<(MAX_LWZ_BITS))*2) +#define CSD_BUF_SIZE 280 + typedef struct { - unsigned char buf[280]; + unsigned char buf[CSD_BUF_SIZE]; int curbit, lastbit, done, last_byte; } CODE_STATIC_DATA; @@ -400,7 +402,12 @@ GetCode_(gdIOCtx *fd, CODE_STATIC_DATA *scd, int code_size, int flag, int *ZeroD ret = 0; for (i = scd->curbit, j = 0; j < code_size; ++i, ++j) - ret |= ((scd->buf[ i / 8 ] & (1 << (i % 8))) != 0) << j; + if (i < CSD_BUF_SIZE * 8) { + ret |= ((scd->buf[i / 8] & (1 << (i % 8))) != 0) << j; + } else { + ret = -1; + break; + } scd->curbit += code_size; return ret; From ba62b9bbf87635e5d12546c426324e095cb1a0bb Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 13 Dec 2014 09:04:57 +0100 Subject: [PATCH 36/37] NEWS --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 33a3684b40b..80ed14f2811 100644 --- a/NEWS +++ b/NEWS @@ -19,6 +19,9 @@ PHP NEWS . Fixed bug #67643 (curl_multi_getcontent returns '' when CURLOPT_RETURNTRANSFER isn't set). (Jille Timmermans) +- GD: + . Fixed bug #68601 (buffer read overflow in gd_gif_in.c). (Jan Bee, Remi) + - Mbstring: . Fixed bug #68504 (--with-libmbfl configure option not present on Windows). (Ashesh Vashi) From 2e5de0c323310bfcbd6e1dba76ec1edeb5e7b6dd Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 13 Dec 2014 09:05:48 +0100 Subject: [PATCH 37/37] NEWS --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 0ef30e9140e..64ab8e2af44 100644 --- a/NEWS +++ b/NEWS @@ -30,6 +30,9 @@ PHP NEWS - FPM: . Fix request #68526 (Implement POSIX Access Control List for UDS). (Remi) +- GD: + . Fixed bug #68601 (buffer read overflow in gd_gif_in.c). (Jan Bee, Remi) + - mbstring: . Fixed bug #68504 (--with-libmbfl configure option not present on Windows). (Ashesh Vashi)