b374k
m1n1 1.01
Apache/2.2.15 (CentOS)
Linux obd60-6c49958d75-2q7cw 5.4.0-174-generic #193-Ubuntu SMP Thu Mar 7 14:29:28 UTC 2024 x86_64
uid=48(apache) gid=48(apache) groups=48(apache)
server ip : 172.67.192.52 | your ip : 10.244.126.0
safemode OFF
 >  / usr / share / pear / test / propro / tests /
Filename/usr/share/pear/test/propro/tests/002.phpt
Size1.3 kb
Permissionrw-r--r--
Ownerapache
Create time26-May-2024 11:05
Last modified16-Feb-2017 23:52
Last accessed16-Feb-2017 23:52
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
--TEST--
property proxy
--SKIPIF--
<?php if (!extension_loaded("propro")) print "skip"; ?>
--FILE--
<?php

echo "Test\n";

class c {
private $storage = array();
function __get($p) {
return new php\PropertyProxy($this->storage, $p);
}
function __set($p, $v) {
$this->storage[$p] = $v;
}
}

$c = new c;
$c->data["foo"] = 1;
var_dump(
isset($c->data["foo"]),
isset($c->data["bar"])
);

var_dump($c);

$c->data[] = 1;
$c->data[] = 2;
$c->data[] = 3;
$c->data["bar"][] = 123;
$c->data["bar"][] = 456;

var_dump($c);
unset($c->data["bar"][0]);

var_dump($c);

?>
DONE
--EXPECTF--
Test
bool(true)
bool(false)
object(c)#%d (1) {
["storage":"c":private]=>
array(1) {
["data"]=>
array(1) {
["foo"]=>
int(1)
}
}
}
object(c)#%d (1) {
["storage":"c":private]=>
array(1) {
["data"]=>
array(5) {
["foo"]=>
int(1)
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
["bar"]=>
array(2) {
[0]=>
int(123)
[1]=>
int(456)
}
}
}
}
object(c)#%d (1) {
["storage":"c":private]=>
array(1) {
["data"]=>
array(5) {
["foo"]=>
int(1)
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
["bar"]=>
array(1) {
[1]=>
int(456)
}
}
}
}
DONE