File tree Expand file tree Collapse file tree 6 files changed +38
-3
lines changed Expand file tree Collapse file tree 6 files changed +38
-3
lines changed Original file line number Diff line number Diff line change @@ -2586,6 +2586,10 @@ static zend_never_inline uint32_t ZEND_FASTCALL zend_array_key_exists_fast(HashT
2586
2586
static zend_never_inline uint32_t ZEND_FASTCALL zend_array_key_exists_slow (zval * subject , zval * key OPLINE_DC EXECUTE_DATA_DC )
2587
2587
{
2588
2588
if (EXPECTED (Z_TYPE_P (subject ) == IS_OBJECT )) {
2589
+ zend_error (E_DEPRECATED , "array_key_exists(): "
2590
+ "Using array_key_exists() on objects is deprecated. "
2591
+ "Use isset() or property_exists() instead" );
2592
+
2589
2593
HashTable * ht = zend_get_properties_for (subject , ZEND_PROP_PURPOSE_ARRAY_CAST );
2590
2594
uint32_t result = zend_array_key_exists_fast (ht , key OPLINE_CC EXECUTE_DATA_CC );
2591
2595
zend_release_properties (ht );
Original file line number Diff line number Diff line change @@ -22,13 +22,15 @@ var_dump(isset($b[37])); //true
22
22
var_dump (isset ($ b ['no_exists ' ])); //false
23
23
var_dump (empty ($ b ['b ' ])); //true
24
24
var_dump (empty ($ b [37 ])); //true
25
- --EXPECT --
25
+ --EXPECTF --
26
26
bool (false )
27
27
bool (false )
28
28
bool (false )
29
29
bool (false )
30
30
bool (true )
31
31
bool (true )
32
+
33
+ Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset () or property_exists () instead in %s on line %d
32
34
bool (true )
33
35
NULL
34
36
bool(true )
Original file line number Diff line number Diff line change @@ -6330,6 +6330,9 @@ PHP_FUNCTION(array_key_exists)
6330
6330
ht = Z_ARRVAL_P (array );
6331
6331
} else {
6332
6332
ht = zend_get_properties_for (array , ZEND_PROP_PURPOSE_ARRAY_CAST );
6333
+ php_error_docref (NULL , E_DEPRECATED ,
6334
+ "Using array_key_exists() on objects is deprecated. "
6335
+ "Use isset() or property_exists() instead" );
6333
6336
}
6334
6337
6335
6338
switch (Z_TYPE_P (key )) {
Original file line number Diff line number Diff line change @@ -280,13 +280,25 @@ Warning: array_key_exists(): The first argument should be either a string or an
280
280
bool(false)
281
281
282
282
*** Testing operation on objects ***
283
+
284
+ Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
283
285
bool(false)
286
+
287
+ Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
284
288
bool(false)
289
+
290
+ Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
285
291
bool(true)
292
+
293
+ Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
286
294
bool(false)
295
+
296
+ Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
287
297
bool(true)
288
298
bool(true)
289
299
300
+ Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
301
+
290
302
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
291
303
bool(false)
292
304
Done
Original file line number Diff line number Diff line change @@ -46,13 +46,17 @@ var_dump($class2);
46
46
47
47
echo "Done " ;
48
48
?>
49
- --EXPECT --
49
+ --EXPECTF --
50
50
*** Testing array_key_exists() : object functionality ***
51
51
52
52
-- Do not assign a value to $class1->var3 --
53
53
$key = var1:
54
+
55
+ Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
54
56
bool(true)
55
57
$key = var3:
58
+
59
+ Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
56
60
bool(true)
57
61
$class1:
58
62
object(myClass)#1 (3) {
@@ -66,6 +70,8 @@ object(myClass)#1 (3) {
66
70
67
71
-- Assign a value to $class2->var3 --
68
72
$key = var3:
73
+
74
+ Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
69
75
bool(true)
70
76
$class2:
71
77
object(myClass)#2 (3) {
Original file line number Diff line number Diff line change @@ -48,15 +48,21 @@ var_dump($class2);
48
48
49
49
echo "Done " ;
50
50
?>
51
- --EXPECT --
51
+ --EXPECTF --
52
52
*** Testing array_key_exists() : object functionality ***
53
53
54
54
-- Do not assign a value to $class1->var3 --
55
55
$key = var1:
56
+
57
+ Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
56
58
bool(true)
57
59
$key = var2:
60
+
61
+ Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
58
62
bool(false)
59
63
$key = var3:
64
+
65
+ Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
60
66
bool(false)
61
67
$class1:
62
68
object(myClass)#1 (3) {
@@ -70,6 +76,8 @@ object(myClass)#1 (3) {
70
76
71
77
-- Assign a value to $class2->var3 --
72
78
$key = var3:
79
+
80
+ Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
73
81
bool(false)
74
82
$class2:
75
83
object(myClass)#2 (3) {
You can’t perform that action at this time.
0 commit comments