summaryrefslogtreecommitdiff
path: root/Zend/tests/modify_isref_value_return.phpt
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2016-04-12 14:39:05 +0200
committerNikita Popov <nikic@php.net>2016-04-12 14:44:29 +0200
commit4e585eb42941cead2a1a3f9824c84d03af621391 (patch)
tree484d543175afdbf9a971e26caab1211069f78823 /Zend/tests/modify_isref_value_return.phpt
parent6a2eee520accd26b2b2388ff433887f21f892690 (diff)
downloadphp-git-4e585eb42941cead2a1a3f9824c84d03af621391.tar.gz
Fix ZEND_SEPARATE for by-val func returning ref zval
Diffstat (limited to 'Zend/tests/modify_isref_value_return.phpt')
-rw-r--r--Zend/tests/modify_isref_value_return.phpt25
1 files changed, 25 insertions, 0 deletions
diff --git a/Zend/tests/modify_isref_value_return.phpt b/Zend/tests/modify_isref_value_return.phpt
new file mode 100644
index 0000000000..1b3122711e
--- /dev/null
+++ b/Zend/tests/modify_isref_value_return.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Indirect modification of isref by-value return value not possible
+--FILE--
+<?php
+
+class A {
+ public $b;
+}
+
+$arr = [];
+
+$a = new A;
+$a->b =& $arr;
+
+(new ReflectionProperty('A', 'b'))->getValue($a)[] = 42;
+
+var_dump($a);
+
+?>
+--EXPECT--
+object(A)#1 (1) {
+ ["b"]=>
+ &array(0) {
+ }
+}