summaryrefslogtreecommitdiff
path: root/Zend/tests/objects_032.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests/objects_032.phpt')
-rw-r--r--Zend/tests/objects_032.phpt40
1 files changed, 40 insertions, 0 deletions
diff --git a/Zend/tests/objects_032.phpt b/Zend/tests/objects_032.phpt
new file mode 100644
index 000000000..e5e3ecadb
--- /dev/null
+++ b/Zend/tests/objects_032.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Covariant return-by-ref constraints
+--FILE--
+<?php
+
+class A implements ArrayAccess {
+ public $foo = array();
+
+ public function &offsetGet($n) {
+ return $this->foo[$n];
+ }
+
+ public function offsetSet($n, $v) {
+ }
+ public function offsetUnset($n) {
+ }
+ public function offsetExists($n) {
+ }
+}
+
+$a = new A;
+
+$a['foo']['bar'] = 2;
+
+var_dump($a);
+
+?>
+==DONE==
+--EXPECTF--
+object(A)#1 (1) {
+ ["foo"]=>
+ array(1) {
+ ["foo"]=>
+ array(1) {
+ ["bar"]=>
+ int(2)
+ }
+ }
+}
+==DONE==