From:             [EMAIL PROTECTED]
Operating system: all
PHP version:      4.1.1
PHP Bug Type:     Feature/Change Request
Bug description:  functions returning references, oddity(?)

I think it is a bit funny that when returning references from functions you
get something looking kind of this in the end:
$a = & & $b;

That is, I think it would be more logic if a function that is specified to
return a reference wouldn't need to be set on the return side to return a
reference.. since I doesn't make my self clear, here is as an example what
I mean:

class a {
  var $b;
  function &fc() {
    return $this->b;
  }
}

$c = new a();
// A)
$myvar = $c->fc();
-----------------------------------
Now this will not work as I seem would be logical, instead one need to do
the last line:
// B)
$myvar = &$c->fc();

This seems funny.. My logic says that since the function is defined to
return a reference it would be enough (A).. no need to do it again like in
(B). This is true when passing a reference: somefunc($myvar) will result
in passing an reference if the func is defined like
function somefunc(&$arg)


Is there any chance of a change?
Opinions, comments etc. ?

-- 
Edit bug report at http://bugs.php.net/?id=15599&edit=1
-- 
Fixed in CVS:        http://bugs.php.net/fix.php?id=15599&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=15599&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=15599&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=15599&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=15599&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=15599&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=15599&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=15599&r=submittedtwice

Reply via email to