mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
dcc8463ae5
Deprecate use of key(), current(), next(), prev(), reset() and end() on objects. Cast the object to array first. Part of https://wiki.php.net/rfc/deprecations_php_8_1.
25 lines
452 B
PHP
25 lines
452 B
PHP
--TEST--
|
|
Bug #71266 (Missing separation of properties HT in foreach etc)
|
|
--FILE--
|
|
<?php
|
|
$one = 1;
|
|
$two = 2;
|
|
$arr = ['foo' => $one, 'bar' => $two];
|
|
$obj = (object) $arr;
|
|
foreach ($obj as $val) {
|
|
var_dump($val);
|
|
$obj->bar = 42;
|
|
}
|
|
|
|
$arr = ['foo' => $one, 'bar' => $two];
|
|
$obj = (object) $arr;
|
|
next($obj);
|
|
var_dump(current($arr));
|
|
?>
|
|
--EXPECTF--
|
|
int(1)
|
|
int(42)
|
|
|
|
Deprecated: next(): Calling next() on an object is deprecated in %s on line %d
|
|
int(1)
|