[PHP-DEV] Bug #520: reference variables in class functions From: be <email protected>
Date: 07/08/98

From: be <email protected>
Operating system: solaris 2.5.1
PHP version: 3.0 Final Release
PHP Bug Type: Misbehaving function
Bug description:
defining a function with reference variables

like this:

function funcname(&$parm) {
;
}

doesnt work inside classes. The following script documents this
(sorry i could not get it shorter)

<?php
class a {
 
  function one(&$s) {
  # see -------^
 
    $s="bar";
  }
 
  function two() {
 
    $s="foo";
    $this->one($s);
    # see -----^
    print $s."\n";
 
    $s="foo";
    $this->one(&$s);
    # see -----^
    print $s."\n";
 
  }
 
}
 
$o = new a;
$o->two();
 
?>

It should produce:

bar
bar

But it produces

foo
bar

I suspect this behaviour to cause a core dump under certain circumstances.

I assume this is a bug?