diff options
| author | Ant Phillips <ant@php.net> | 2008-11-28 10:41:19 +0000 |
|---|---|---|
| committer | Ant Phillips <ant@php.net> | 2008-11-28 10:41:19 +0000 |
| commit | 775389cd1d0dc08d54c17c6abac7e56d2eef9bcb (patch) | |
| tree | 9c3c406032dbd86f26ce00ecc48c075fa0653d43 /tests/lang/passByReference_010.phpt | |
| parent | ea5dd34c77aad29e783636faaabf6b361059be18 (diff) | |
| download | php-git-775389cd1d0dc08d54c17c6abac7e56d2eef9bcb.tar.gz | |
Language tests: checked on PHP 5.2.6, 5.3 and 6.0 (Windows, Linux and Linux 64 bit).
Diffstat (limited to 'tests/lang/passByReference_010.phpt')
| -rw-r--r-- | tests/lang/passByReference_010.phpt | 61 |
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 0000000000..0393cce2d1 --- /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" |
