summaryrefslogtreecommitdiff
path: root/tests/lang/passByReference_010.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lang/passByReference_010.phpt')
-rw-r--r--tests/lang/passByReference_010.phpt61
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/lang/passByReference_010.phpt b/tests/lang/passByReference_010.phpt
new file mode 100644
index 0000000..0393cce
--- /dev/null
+++ b/tests/lang/passByReference_010.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Passing assignments by reference
+--FILE--
+<?php
+
+function f(&$a) {
+ var_dump($a);
+ $a = "a.changed";
+}
+
+echo "\n\n---> Pass constant assignment by reference:\n";
+f($a="a.original");
+var_dump($a);
+
+echo "\n\n---> Pass variable assignment by reference:\n";
+unset($a);
+$a = "a.original";
+f($b = $a);
+var_dump($a);
+
+echo "\n\n---> Pass reference assignment by reference:\n";
+unset($a, $b);
+$a = "a.original";
+f($b =& $a);
+var_dump($a);
+
+echo "\n\n---> Pass concat assignment by reference:\n";
+unset($a, $b);
+$b = "b.original";
+$a = "a.original";
+f($b .= $a);
+var_dump($a);
+
+?>
+--EXPECTF--
+
+
+---> Pass constant assignment by reference:
+
+Strict Standards: Only variables should be passed by reference in %s on line 9
+string(10) "a.original"
+string(10) "a.original"
+
+
+---> Pass variable assignment by reference:
+
+Strict Standards: Only variables should be passed by reference in %s on line 15
+string(10) "a.original"
+string(10) "a.original"
+
+
+---> Pass reference assignment by reference:
+string(10) "a.original"
+string(9) "a.changed"
+
+
+---> Pass concat assignment by reference:
+
+Strict Standards: Only variables should be passed by reference in %s on line 28
+string(20) "b.originala.original"
+string(10) "a.original"