mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
e470e22e20
- Fixed bug #36214 (__get method works properly only when conditional operator is used). - Fixed bug #39449 (Overloaded array properties do not work correctly). - Fixed bug #39990 (Cannot "foreach" over overloaded properties).
41 lines
534 B
PHP
Executable File
41 lines
534 B
PHP
Executable File
--TEST--
|
|
Bug #39449 (Overloaded array properties do not work correctly)
|
|
--FILE--
|
|
<?php
|
|
class A {
|
|
private $keys = array();
|
|
public function & __get($val) {
|
|
return $this->keys[$val];
|
|
}
|
|
public function __set($k, $v) {
|
|
$this->keys[$k] = $v;
|
|
}
|
|
}
|
|
|
|
$a =new A();
|
|
$a->arr = array('a','b','c');
|
|
|
|
$b = &$a->arr;
|
|
$b[]= 'd';
|
|
|
|
foreach ($a->arr as $k => $v) {
|
|
echo "$k => $v\n";
|
|
}
|
|
|
|
$a->arr[]='d';
|
|
|
|
foreach ($a->arr as $k => $v) {
|
|
echo "$k => $v\n";
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
0 => a
|
|
1 => b
|
|
2 => c
|
|
3 => d
|
|
0 => a
|
|
1 => b
|
|
2 => c
|
|
3 => d
|
|
4 => d
|