sniper          Wed Feb 25 13:54:15 2004 EDT

  Added files:                 
    /php-src/tests/lang bug27395.phpt 
  Log:
  Test for bug #27395
  

http://cvs.php.net/co.php/php-src/tests/lang/bug27395.phpt?r=1.1&p=1
Index: php-src/tests/lang/bug27395.phpt
+++ php-src/tests/lang/bug27395.phpt
--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)
}

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to