diff options
author | Máté Kocsis <kocsismate@woohoolabs.com> | 2020-08-05 18:45:07 +0200 |
---|---|---|
committer | Máté Kocsis <kocsismate@woohoolabs.com> | 2020-08-07 12:35:30 +0200 |
commit | af80d8a14e5540a151e2b40f165ebe122467484b (patch) | |
tree | c852017699321228cb32ae5764f817ee64be1a2a /ext/standard/tests | |
parent | 3bb183036976fc8bfdf039b41efe1e4312894937 (diff) | |
download | php-git-af80d8a14e5540a151e2b40f165ebe122467484b.tar.gz |
Add more argument types to stubs
Closes GH-5943
Diffstat (limited to 'ext/standard/tests')
-rw-r--r-- | ext/standard/tests/assert/assert_basic6.phpt | 40 | ||||
-rw-r--r-- | ext/standard/tests/assert/assert_options_error.phpt | 2 | ||||
-rw-r--r-- | ext/standard/tests/math/base_convert_error.phpt | 2 | ||||
-rw-r--r-- | ext/standard/tests/math/base_convert_variation1.phpt | 18 | ||||
-rw-r--r-- | ext/standard/tests/math/decbin_basic.phpt | 12 | ||||
-rw-r--r-- | ext/standard/tests/math/decbin_basiclong_64bit.phpt | 10 | ||||
-rw-r--r-- | ext/standard/tests/math/decbin_variation1.phpt | 41 | ||||
-rw-r--r-- | ext/standard/tests/math/decbin_variation1_64bit.phpt | 37 | ||||
-rw-r--r-- | ext/standard/tests/math/dechex_basic.phpt | 12 | ||||
-rw-r--r-- | ext/standard/tests/math/dechex_basiclong_64bit.phpt | 10 | ||||
-rw-r--r-- | ext/standard/tests/math/dechex_variation1.phpt | 39 | ||||
-rw-r--r-- | ext/standard/tests/math/dechex_variation1_64bit.phpt | 38 | ||||
-rw-r--r-- | ext/standard/tests/math/decoct_basic.phpt | 12 | ||||
-rw-r--r-- | ext/standard/tests/math/decoct_basiclong_64bit.phpt | 8 | ||||
-rw-r--r-- | ext/standard/tests/math/decoct_variation1.phpt | 40 | ||||
-rw-r--r-- | ext/standard/tests/math/decoct_variation1_64bit.phpt | 38 |
16 files changed, 217 insertions, 142 deletions
diff --git a/ext/standard/tests/assert/assert_basic6.phpt b/ext/standard/tests/assert/assert_basic6.phpt new file mode 100644 index 0000000000..fdeffb057c --- /dev/null +++ b/ext/standard/tests/assert/assert_basic6.phpt @@ -0,0 +1,40 @@ +--TEST-- +assert() - Remove the assert callback +--INI-- +assert.active=1 +--FILE-- +<?php + +function f1() +{ + echo "foo\n"; +} + +assert_options(ASSERT_CALLBACK, "f1"); +var_dump(assert_options(ASSERT_CALLBACK)); + +try { + assert(false); +} catch (AssertionError $exception) { + echo $exception->getMessage() . "\n"; +} + +echo "\n"; + +assert_options(ASSERT_CALLBACK, null); +var_dump(assert_options(ASSERT_CALLBACK)); + +try { + assert(false); +} catch (AssertionError $exception) { + echo $exception->getMessage() . "\n"; +} + +?> +--EXPECT-- +string(2) "f1" +foo +assert(false) + +NULL +assert(false) diff --git a/ext/standard/tests/assert/assert_options_error.phpt b/ext/standard/tests/assert/assert_options_error.phpt index ba92867737..23ca2e9e03 100644 --- a/ext/standard/tests/assert/assert_options_error.phpt +++ b/ext/standard/tests/assert/assert_options_error.phpt @@ -10,4 +10,4 @@ try { } ?> --EXPECT-- -assert_options(): Argument #1 ($what) must have a valid value +assert_options(): Argument #1 ($what) must be an ASSERT_* constant diff --git a/ext/standard/tests/math/base_convert_error.phpt b/ext/standard/tests/math/base_convert_error.phpt index e6e9d5b49e..b2cf396ae3 100644 --- a/ext/standard/tests/math/base_convert_error.phpt +++ b/ext/standard/tests/math/base_convert_error.phpt @@ -31,4 +31,4 @@ try { *** Testing base_convert() : error conditions *** base_convert(): Argument #2 ($frombase) must be between 2 and 36 (inclusive) base_convert(): Argument #3 ($tobase) must be between 2 and 36 (inclusive) -Object of class classA could not be converted to string +base_convert(): Argument #1 ($number) must be of type string, classA given diff --git a/ext/standard/tests/math/base_convert_variation1.phpt b/ext/standard/tests/math/base_convert_variation1.phpt index 0f08b2d8ab..a1365b3e74 100644 --- a/ext/standard/tests/math/base_convert_variation1.phpt +++ b/ext/standard/tests/math/base_convert_variation1.phpt @@ -66,9 +66,13 @@ $inputs = array( $iterator = 1; foreach($inputs as $input) { echo "\n-- Iteration $iterator --\n"; - var_dump(base_convert($input, 10, 8)); + try { + var_dump(base_convert($input, 10, 8)); + } catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; + } $iterator++; -}; +} fclose($fp); ?> --EXPECTF-- @@ -141,11 +145,7 @@ string(1) "0" string(1) "0" -- Iteration 19 -- - -Warning: Array to string conversion in %s on line %d - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -string(1) "0" +base_convert(): Argument #1 ($number) must be of type string, array given -- Iteration 20 -- @@ -169,6 +169,4 @@ string(1) "0" string(1) "0" -- Iteration 25 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -string(1) "5" +base_convert(): Argument #1 ($number) must be of type string, resource given diff --git a/ext/standard/tests/math/decbin_basic.phpt b/ext/standard/tests/math/decbin_basic.phpt index da681dfbe8..1366997dcf 100644 --- a/ext/standard/tests/math/decbin_basic.phpt +++ b/ext/standard/tests/math/decbin_basic.phpt @@ -17,10 +17,14 @@ $values = array(10, null, ); -for ($i = 0; $i < count($values); $i++) { - $res = decbin($values[$i]); - var_dump($res); +foreach ($values as $value) { + try { + var_dump(decbin($value)); + } catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; + } } + ?> --EXPECT-- string(4) "1010" @@ -32,7 +36,7 @@ string(4) "1010" string(12) "111101101110" string(12) "111101101110" string(6) "100111" -string(1) "0" +decbin(): Argument #1 ($number) must be of type int, string given string(1) "1" string(1) "0" string(1) "0" diff --git a/ext/standard/tests/math/decbin_basiclong_64bit.phpt b/ext/standard/tests/math/decbin_basiclong_64bit.phpt index d48d729bc9..6e4dfa826b 100644 --- a/ext/standard/tests/math/decbin_basiclong_64bit.phpt +++ b/ext/standard/tests/math/decbin_basiclong_64bit.phpt @@ -20,8 +20,12 @@ $longVals = array( foreach ($longVals as $longVal) { - echo "--- testing: $longVal ---\n"; - var_dump(decbin($longVal)); + echo "--- testing: $longVal ---\n"; + try { + var_dump(decbin($longVal)); + } catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; + } } ?> @@ -51,7 +55,7 @@ string(32) "11111111111111111111111111111101" --- testing: 9223372036854775806 --- string(63) "111111111111111111111111111111111111111111111111111111111111110" --- testing: 9.2233720368548E+18 --- -string(64) "1000000000000000000000000000000000000000000000000000000000000000" +decbin(): Argument #1 ($number) must be of type int, float given --- testing: -9223372036854775807 --- string(64) "1000000000000000000000000000000000000000000000000000000000000001" --- testing: -9.2233720368548E+18 --- diff --git a/ext/standard/tests/math/decbin_variation1.phpt b/ext/standard/tests/math/decbin_variation1.phpt index 76a9849353..53f4bcaab4 100644 --- a/ext/standard/tests/math/decbin_variation1.phpt +++ b/ext/standard/tests/math/decbin_variation1.phpt @@ -77,15 +77,20 @@ $inputs = array( ); // loop through each element of $inputs to check the behaviour of decbin() -$iterator = 1; -foreach($inputs as $input) { +foreach($inputs as $i => $input) { + $iterator = $i + 1; echo "\n-- Iteration $iterator --\n"; - var_dump(decbin($input)); - $iterator++; -}; + + try { + var_dump(decbin($input)); + } catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; + } +} fclose($fp); + ?> ---EXPECTF-- +--EXPECT-- *** Testing decbin() : usage variations *** -- Iteration 1 -- @@ -101,10 +106,10 @@ string(14) "11000000111001" string(32) "11111111111111111111011011010111" -- Iteration 5 -- -string(32) "11111111111111111111111111111111" +decbin(): Argument #1 ($number) must be of type int, float given -- Iteration 6 -- -string(1) "0" +decbin(): Argument #1 ($number) must be of type int, float given -- Iteration 7 -- string(4) "1010" @@ -113,7 +118,7 @@ string(4) "1010" string(32) "11111111111111111111111111110110" -- Iteration 9 -- -string(32) "10111110100110010001101000001000" +decbin(): Argument #1 ($number) must be of type int, float given -- Iteration 10 -- string(1) "0" @@ -140,27 +145,25 @@ string(1) "1" string(1) "0" -- Iteration 18 -- -string(1) "0" +decbin(): Argument #1 ($number) must be of type int, string given -- Iteration 19 -- -string(1) "0" +decbin(): Argument #1 ($number) must be of type int, string given -- Iteration 20 -- -string(1) "0" +decbin(): Argument #1 ($number) must be of type int, array given -- Iteration 21 -- -string(1) "0" +decbin(): Argument #1 ($number) must be of type int, string given -- Iteration 22 -- -string(1) "0" +decbin(): Argument #1 ($number) must be of type int, string given -- Iteration 23 -- -string(1) "0" +decbin(): Argument #1 ($number) must be of type int, string given -- Iteration 24 -- - -Notice: Object of class classA could not be converted to int in %s on line %d -string(1) "1" +decbin(): Argument #1 ($number) must be of type int, classA given -- Iteration 25 -- string(1) "0" @@ -169,4 +172,4 @@ string(1) "0" string(1) "0" -- Iteration 27 -- -string(%d) "%d" +decbin(): Argument #1 ($number) must be of type int, resource given diff --git a/ext/standard/tests/math/decbin_variation1_64bit.phpt b/ext/standard/tests/math/decbin_variation1_64bit.phpt index cfaa600502..ed278bfed0 100644 --- a/ext/standard/tests/math/decbin_variation1_64bit.phpt +++ b/ext/standard/tests/math/decbin_variation1_64bit.phpt @@ -77,15 +77,18 @@ $inputs = array( ); // loop through each element of $inputs to check the behaviour of decbin() -$iterator = 1; -foreach($inputs as $input) { +foreach($inputs as $i => $input) { + $iterator = $i + 1; echo "\n-- Iteration $iterator --\n"; - var_dump(decbin($input)); - $iterator++; -}; + try { + var_dump(decbin($input)); + } catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; + } +} fclose($fp); ?> ---EXPECTF-- +--EXPECT-- *** Testing decbin() : usage variations *** -- Iteration 1 -- @@ -101,10 +104,10 @@ string(14) "11000000111001" string(64) "1111111111111111111111111111111111111111111111111111011011010111" -- Iteration 5 -- -string(1) "0" +decbin(): Argument #1 ($number) must be of type int, float given -- Iteration 6 -- -string(1) "0" +decbin(): Argument #1 ($number) must be of type int, float given -- Iteration 7 -- string(4) "1010" @@ -140,27 +143,25 @@ string(1) "1" string(1) "0" -- Iteration 18 -- -string(1) "0" +decbin(): Argument #1 ($number) must be of type int, string given -- Iteration 19 -- -string(1) "0" +decbin(): Argument #1 ($number) must be of type int, string given -- Iteration 20 -- -string(1) "0" +decbin(): Argument #1 ($number) must be of type int, array given -- Iteration 21 -- -string(1) "0" +decbin(): Argument #1 ($number) must be of type int, string given -- Iteration 22 -- -string(1) "0" +decbin(): Argument #1 ($number) must be of type int, string given -- Iteration 23 -- -string(1) "0" +decbin(): Argument #1 ($number) must be of type int, string given -- Iteration 24 -- - -Notice: Object of class classA could not be converted to int in %s on line %d -string(1) "1" +decbin(): Argument #1 ($number) must be of type int, classA given -- Iteration 25 -- string(1) "0" @@ -169,4 +170,4 @@ string(1) "0" string(1) "0" -- Iteration 27 -- -string(%d) "%d" +decbin(): Argument #1 ($number) must be of type int, resource given diff --git a/ext/standard/tests/math/dechex_basic.phpt b/ext/standard/tests/math/dechex_basic.phpt index 690e2a9842..729685c206 100644 --- a/ext/standard/tests/math/dechex_basic.phpt +++ b/ext/standard/tests/math/dechex_basic.phpt @@ -17,10 +17,14 @@ $values = array(10, null, ); -for ($i = 0; $i < count($values); $i++) { - $res = dechex($values[$i]); - var_dump($res); +foreach ($values as $value) { + try { + var_dump(dechex($value)); + } catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; + } } + ?> --EXPECT-- string(1) "a" @@ -32,7 +36,7 @@ string(1) "a" string(3) "f6e" string(3) "f6e" string(2) "27" -string(1) "0" +dechex(): Argument #1 ($number) must be of type int, string given string(1) "1" string(1) "0" string(1) "0" diff --git a/ext/standard/tests/math/dechex_basiclong_64bit.phpt b/ext/standard/tests/math/dechex_basiclong_64bit.phpt index 812bafbfb7..c7727c5ce8 100644 --- a/ext/standard/tests/math/dechex_basiclong_64bit.phpt +++ b/ext/standard/tests/math/dechex_basiclong_64bit.phpt @@ -20,8 +20,12 @@ $longVals = array( foreach ($longVals as $longVal) { - echo "--- testing: $longVal ---\n"; - var_dump(dechex($longVal)); + echo "--- testing: $longVal ---\n"; + try { + var_dump(dechex($longVal)); + } catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; + } } ?> @@ -51,7 +55,7 @@ string(8) "fffffffd" --- testing: 9223372036854775806 --- string(16) "7ffffffffffffffe" --- testing: 9.2233720368548E+18 --- -string(16) "8000000000000000" +dechex(): Argument #1 ($number) must be of type int, float given --- testing: -9223372036854775807 --- string(16) "8000000000000001" --- testing: -9.2233720368548E+18 --- diff --git a/ext/standard/tests/math/dechex_variation1.phpt b/ext/standard/tests/math/dechex_variation1.phpt index bd4ed35e3e..5dbe004a07 100644 --- a/ext/standard/tests/math/dechex_variation1.phpt +++ b/ext/standard/tests/math/dechex_variation1.phpt @@ -77,15 +77,20 @@ $inputs = array( ); // loop through each element of $inputs to check the behaviour of dechex() -$iterator = 1; -foreach($inputs as $input) { +foreach($inputs as $i => $input) { + $iterator = $i + 1; echo "\n-- Iteration $iterator --\n"; - var_dump(dechex($input)); + try { + var_dump(dechex($input)); + } catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; + } $iterator++; -}; +} fclose($fp); + ?> ---EXPECTF-- +--EXPECT-- *** Testing dechex() : usage variations *** -- Iteration 1 -- @@ -101,10 +106,10 @@ string(4) "3039" string(8) "fffff6d7" -- Iteration 5 -- -string(8) "ffffffff" +dechex(): Argument #1 ($number) must be of type int, float given -- Iteration 6 -- -string(1) "0" +dechex(): Argument #1 ($number) must be of type int, float given -- Iteration 7 -- string(1) "a" @@ -113,7 +118,7 @@ string(1) "a" string(8) "fffffff6" -- Iteration 9 -- -string(8) "be991a08" +dechex(): Argument #1 ($number) must be of type int, float given -- Iteration 10 -- string(1) "0" @@ -140,27 +145,25 @@ string(1) "1" string(1) "0" -- Iteration 18 -- -string(1) "0" +dechex(): Argument #1 ($number) must be of type int, string given -- Iteration 19 -- -string(1) "0" +dechex(): Argument #1 ($number) must be of type int, string given -- Iteration 20 -- -string(1) "0" +dechex(): Argument #1 ($number) must be of type int, array given -- Iteration 21 -- -string(1) "0" +dechex(): Argument #1 ($number) must be of type int, string given -- Iteration 22 -- -string(1) "0" +dechex(): Argument #1 ($number) must be of type int, string given -- Iteration 23 -- -string(1) "0" +dechex(): Argument #1 ($number) must be of type int, string given -- Iteration 24 -- - -Notice: Object of class classA could not be converted to int in %s on line %d -string(1) "1" +dechex(): Argument #1 ($number) must be of type int, classA given -- Iteration 25 -- string(1) "0" @@ -169,4 +172,4 @@ string(1) "0" string(1) "0" -- Iteration 27 -- -string(%d) "%s" +dechex(): Argument #1 ($number) must be of type int, resource given diff --git a/ext/standard/tests/math/dechex_variation1_64bit.phpt b/ext/standard/tests/math/dechex_variation1_64bit.phpt index ac815ea1dd..981ccba493 100644 --- a/ext/standard/tests/math/dechex_variation1_64bit.phpt +++ b/ext/standard/tests/math/dechex_variation1_64bit.phpt @@ -77,15 +77,19 @@ $inputs = array( ); // loop through each element of $inputs to check the behaviour of dechex() -$iterator = 1; -foreach($inputs as $input) { +foreach($inputs as $i => $input) { + $iterator = $i + 1; echo "\n-- Iteration $iterator --\n"; - var_dump(dechex($input)); - $iterator++; -}; + try { + var_dump(dechex($input)); + } catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; + } +} fclose($fp); + ?> ---EXPECTF-- +--EXPECT-- *** Testing dechex() : usage variations *** -- Iteration 1 -- @@ -101,10 +105,10 @@ string(4) "3039" string(16) "fffffffffffff6d7" -- Iteration 5 -- -string(1) "0" +dechex(): Argument #1 ($number) must be of type int, float given -- Iteration 6 -- -string(1) "0" +dechex(): Argument #1 ($number) must be of type int, float given -- Iteration 7 -- string(1) "a" @@ -140,27 +144,25 @@ string(1) "1" string(1) "0" -- Iteration 18 -- -string(1) "0" +dechex(): Argument #1 ($number) must be of type int, string given -- Iteration 19 -- -string(1) "0" +dechex(): Argument #1 ($number) must be of type int, string given -- Iteration 20 -- -string(1) "0" +dechex(): Argument #1 ($number) must be of type int, array given -- Iteration 21 -- -string(1) "0" +dechex(): Argument #1 ($number) must be of type int, string given -- Iteration 22 -- -string(1) "0" +dechex(): Argument #1 ($number) must be of type int, string given -- Iteration 23 -- -string(1) "0" +dechex(): Argument #1 ($number) must be of type int, string given -- Iteration 24 -- - -Notice: Object of class classA could not be converted to int in %s on line %d -string(1) "1" +dechex(): Argument #1 ($number) must be of type int, classA given -- Iteration 25 -- string(1) "0" @@ -169,4 +171,4 @@ string(1) "0" string(1) "0" -- Iteration 27 -- -string(%d) "%s" +dechex(): Argument #1 ($number) must be of type int, resource given diff --git a/ext/standard/tests/math/decoct_basic.phpt b/ext/standard/tests/math/decoct_basic.phpt index 46418df67d..4afdeb466e 100644 --- a/ext/standard/tests/math/decoct_basic.phpt +++ b/ext/standard/tests/math/decoct_basic.phpt @@ -17,10 +17,14 @@ $values = array(10, null, ); -for ($i = 0; $i < count($values); $i++) { - $res = decoct($values[$i]); - var_dump($res); +foreach ($values as $value) { + try { + var_dump(decoct($value)); + } catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; + } } + ?> --EXPECT-- string(2) "12" @@ -32,7 +36,7 @@ string(2) "12" string(4) "7556" string(4) "7556" string(2) "47" -string(1) "0" +decoct(): Argument #1 ($number) must be of type int, string given string(1) "1" string(1) "0" string(1) "0" diff --git a/ext/standard/tests/math/decoct_basiclong_64bit.phpt b/ext/standard/tests/math/decoct_basiclong_64bit.phpt index 8b61aa8cbf..0ebc7203f2 100644 --- a/ext/standard/tests/math/decoct_basiclong_64bit.phpt +++ b/ext/standard/tests/math/decoct_basiclong_64bit.phpt @@ -21,7 +21,11 @@ $longVals = array( foreach ($longVals as $longVal) { echo "--- testing: $longVal ---\n"; - var_dump(decoct($longVal)); + try { + var_dump(decoct($longVal)); + } catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; + } } ?> @@ -51,7 +55,7 @@ string(11) "37777777775" --- testing: 9223372036854775806 --- string(21) "777777777777777777776" --- testing: 9.2233720368548E+18 --- -string(22) "1000000000000000000000" +decoct(): Argument #1 ($number) must be of type int, float given --- testing: -9223372036854775807 --- string(22) "1000000000000000000001" --- testing: -9.2233720368548E+18 --- diff --git a/ext/standard/tests/math/decoct_variation1.phpt b/ext/standard/tests/math/decoct_variation1.phpt index 94d385de01..7912566175 100644 --- a/ext/standard/tests/math/decoct_variation1.phpt +++ b/ext/standard/tests/math/decoct_variation1.phpt @@ -78,15 +78,19 @@ $inputs = array( ); // loop through each element of $inputs to check the behaviour of decoct() -$iterator = 1; -foreach($inputs as $input) { +foreach ($inputs as $i => $input) { + $iterator = $i + 1; echo "\n-- Iteration $iterator --\n"; - var_dump(decoct($input)); - $iterator++; -}; + try { + var_dump(decoct($input)); + } catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; + } +} fclose($fp); + ?> ---EXPECTF-- +--EXPECT-- *** Testing decoct() : usage variations *** -- Iteration 1 -- @@ -102,10 +106,10 @@ string(5) "30071" string(11) "37777773327" -- Iteration 5 -- -string(11) "37777777777" +decoct(): Argument #1 ($number) must be of type int, float given -- Iteration 6 -- -string(1) "0" +decoct(): Argument #1 ($number) must be of type int, float given -- Iteration 7 -- string(2) "12" @@ -114,7 +118,7 @@ string(2) "12" string(11) "37777777766" -- Iteration 9 -- -string(11) "27646215010" +decoct(): Argument #1 ($number) must be of type int, float given -- Iteration 10 -- string(1) "0" @@ -141,27 +145,25 @@ string(1) "1" string(1) "0" -- Iteration 18 -- -string(1) "0" +decoct(): Argument #1 ($number) must be of type int, string given -- Iteration 19 -- -string(1) "0" +decoct(): Argument #1 ($number) must be of type int, string given -- Iteration 20 -- -string(1) "0" +decoct(): Argument #1 ($number) must be of type int, array given -- Iteration 21 -- -string(1) "0" +decoct(): Argument #1 ($number) must be of type int, string given -- Iteration 22 -- -string(1) "0" +decoct(): Argument #1 ($number) must be of type int, string given -- Iteration 23 -- -string(1) "0" +decoct(): Argument #1 ($number) must be of type int, string given -- Iteration 24 -- - -Notice: Object of class classA could not be converted to int in %s on line %d -string(1) "1" +decoct(): Argument #1 ($number) must be of type int, classA given -- Iteration 25 -- string(1) "0" @@ -170,4 +172,4 @@ string(1) "0" string(1) "0" -- Iteration 27 -- -string(%d) "%d" +decoct(): Argument #1 ($number) must be of type int, resource given diff --git a/ext/standard/tests/math/decoct_variation1_64bit.phpt b/ext/standard/tests/math/decoct_variation1_64bit.phpt index 7c1a8f2145..35a9c89288 100644 --- a/ext/standard/tests/math/decoct_variation1_64bit.phpt +++ b/ext/standard/tests/math/decoct_variation1_64bit.phpt @@ -78,15 +78,19 @@ $inputs = array( ); // loop through each element of $inputs to check the behaviour of decoct() -$iterator = 1; -foreach($inputs as $input) { +foreach($inputs as $i => $input) { + $iterator = $i + 1; echo "\n-- Iteration $iterator --\n"; - var_dump(decoct($input)); - $iterator++; -}; + try { + var_dump(decoct($input)); + } catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; + } +} fclose($fp); + ?> ---EXPECTF-- +--EXPECT-- *** Testing decoct() : usage variations *** -- Iteration 1 -- @@ -102,10 +106,10 @@ string(5) "30071" string(22) "1777777777777777773327" -- Iteration 5 -- -string(1) "0" +decoct(): Argument #1 ($number) must be of type int, float given -- Iteration 6 -- -string(1) "0" +decoct(): Argument #1 ($number) must be of type int, float given -- Iteration 7 -- string(2) "12" @@ -141,27 +145,25 @@ string(1) "1" string(1) "0" -- Iteration 18 -- -string(1) "0" +decoct(): Argument #1 ($number) must be of type int, string given -- Iteration 19 -- -string(1) "0" +decoct(): Argument #1 ($number) must be of type int, string given -- Iteration 20 -- -string(1) "0" +decoct(): Argument #1 ($number) must be of type int, array given -- Iteration 21 -- -string(1) "0" +decoct(): Argument #1 ($number) must be of type int, string given -- Iteration 22 -- -string(1) "0" +decoct(): Argument #1 ($number) must be of type int, string given -- Iteration 23 -- -string(1) "0" +decoct(): Argument #1 ($number) must be of type int, string given -- Iteration 24 -- - -Notice: Object of class classA could not be converted to int in %s on line %d -string(1) "1" +decoct(): Argument #1 ($number) must be of type int, classA given -- Iteration 25 -- string(1) "0" @@ -170,4 +172,4 @@ string(1) "0" string(1) "0" -- Iteration 27 -- -string(%d) "%d" +decoct(): Argument #1 ($number) must be of type int, resource given |