1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 16:22:37 +01:00
Files
archived-php-src/Zend/tests/isset_array.phpt
Ayesh Karunaratne b8e380ab09 Update deprecation message for incompatible float to int conversion
Updates the deprecation message for implicit incompatible float to int conversion from:

```
Implicit conversion from non-compatible float %.*H to int in %s on line %d
```

to

```
Implicit conversion from float %.*H to int loses precision in %s on line %d
```

Related: #6661
2021-06-07 14:36:11 +02:00

51 lines
885 B
PHP

--TEST--
Using isset() with arrays
--FILE--
<?php
$array = [
0 => true,
"a" => true,
];
var_dump(isset($array[0]));
var_dump(isset($array["a"]));
var_dump(isset($array[false]));
var_dump(isset($array[0.6]));
var_dump(isset($array[true]));
var_dump(isset($array[null]));
var_dump(isset($array[STDIN]));
try {
isset($array[[]]);
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
try {
isset($array[new stdClass()]);
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
?>
--EXPECTF--
bool(true)
bool(true)
bool(true)
Deprecated: Implicit conversion from float 0.6 to int loses precision in %s on line %d
bool(true)
bool(false)
bool(false)
Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
bool(false)
Illegal offset type in isset or empty
Illegal offset type in isset or empty