diff options
author | foobar <sniper@php.net> | 2004-02-25 18:54:15 +0000 |
---|---|---|
committer | foobar <sniper@php.net> | 2004-02-25 18:54:15 +0000 |
commit | 4a32ba458c9b141ce33799ea67298f547ed2af44 (patch) | |
tree | d3f95b5d65344a400882a08f6eafc0b897487599 /tests | |
parent | 85edb21e3a8770dda9df8ebc999ab22196c08e67 (diff) | |
download | php-git-4a32ba458c9b141ce33799ea67298f547ed2af44.tar.gz |
Test for bug #27395
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lang/bug27395.phpt | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/lang/bug27395.phpt b/tests/lang/bug27395.phpt new file mode 100644 index 0000000000..7a9e07b691 --- /dev/null +++ b/tests/lang/bug27395.phpt @@ -0,0 +1,60 @@ +--TEST-- +Bug #27395 (reference to an array index makes the array to be passed by reference always) +--FILE-- +<?php + +function theFunction($arg) { + $arg[0] = 2; +} + +// Reference on array index +$arr1 = array (1); +$reference1 =& $arr1[0]; + +var_dump($reference1); +var_dump($arr1); +theFunction($arr1); +var_dump($reference1); +var_dump($arr1); + +echo "--------\n"; + +// Reference on array +$arr2 = array (1); +$reference2 =& $arr2; + +var_dump($reference2); +var_dump($arr2); +theFunction($arr2); +var_dump($reference2); +var_dump($arr2); + +?> +--EXPECT-- +int(1) +array(1) { + [0]=> + &int(1) +} +int(1) +array(1) { + [0]=> + &int(1) +} +-------- +array(1) { + [0]=> + int(1) +} +array(1) { + [0]=> + int(1) +} +array(1) { + [0]=> + int(1) +} +array(1) { + [0]=> + int(1) +} |