summaryrefslogtreecommitdiff
path: root/ext/standard/tests/array/array_key_exists_variation1.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/tests/array/array_key_exists_variation1.phpt')
-rw-r--r--ext/standard/tests/array/array_key_exists_variation1.phpt50
1 files changed, 16 insertions, 34 deletions
diff --git a/ext/standard/tests/array/array_key_exists_variation1.phpt b/ext/standard/tests/array/array_key_exists_variation1.phpt
index c6e8ba7806..2f25dbadee 100644
--- a/ext/standard/tests/array/array_key_exists_variation1.phpt
+++ b/ext/standard/tests/array/array_key_exists_variation1.phpt
@@ -15,7 +15,7 @@ Test array_key_exists() function : usage variations - Pass different data types
echo "*** Testing array_key_exists() : usage variations ***\n";
// Initialise function arguments not being substituted
-$search = array ('zero', 'key' => 'val', 'two');
+$search = array ('zero', 'key' => 'val', 'two', 10 => 'value');
//get an unset variable
$unset_var = 10;
@@ -90,7 +90,11 @@ $inputs = array(
$iterator = 1;
foreach($inputs as $input) {
echo "\n-- Iteration $iterator --\n";
- var_dump( array_key_exists($input, $search) );
+ try {
+ var_dump( array_key_exists($input, $search) );
+ } catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
$iterator++;
};
@@ -114,29 +118,19 @@ bool(false)
bool(false)
-- Iteration 5 --
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
-bool(false)
+bool(true)
-- Iteration 6 --
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
bool(false)
-- Iteration 7 --
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
bool(false)
-- Iteration 8 --
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
-bool(false)
+bool(true)
-- Iteration 9 --
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
-bool(false)
+bool(true)
-- Iteration 10 --
bool(false)
@@ -145,24 +139,16 @@ bool(false)
bool(false)
-- Iteration 12 --
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
-bool(false)
+bool(true)
-- Iteration 13 --
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
-bool(false)
+bool(true)
-- Iteration 14 --
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
-bool(false)
+bool(true)
-- Iteration 15 --
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
-bool(false)
+bool(true)
-- Iteration 16 --
bool(false)
@@ -171,9 +157,7 @@ bool(false)
bool(false)
-- Iteration 18 --
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
-bool(false)
+Illegal offset type
-- Iteration 19 --
bool(true)
@@ -185,9 +169,7 @@ bool(true)
bool(true)
-- Iteration 22 --
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
-bool(false)
+Illegal offset type
-- Iteration 23 --
bool(false)
@@ -197,6 +179,6 @@ bool(false)
-- Iteration 25 --
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
bool(false)
Done