Edit report at https://bugs.php.net/bug.php?id=62664&edit=1

 ID:                 62664
 User updated by:    katelyn dot schiesser at gmail dot com
 Reported by:        katelyn dot schiesser at gmail dot com
 Summary:            Passing inline-set variables by reference fails
 Status:             Not a bug
 Type:               Bug
 Package:            *General Issues
 Operating System:   Centos 6.2
 PHP Version:        5.3.15
 Block user comment: N
 Private report:     N

 New Comment:

So you're saying they removed things like: 

test(&$var)

For functions that aren't defined to accept variables passed by reference?


Previous Comments:
------------------------------------------------------------------------
[2012-07-26 21:26:51] cataphr...@php.net

That you for your report, but it's simply not supported. Given that call-time 
pass-by-ref was removed in PHP 5.4, there's no point in even considering 
supporting such a case.

------------------------------------------------------------------------
[2012-07-26 08:31:46] katelyn dot schiesser at gmail dot com

Description:
------------
I apologize in advance if this has been reported elsewhere, I searched without 
finding anything.

I have tested this on boxes running versions of PHP 5.3.13, and 5.3.3.

[slowbro@node05 ~]$ php -v
PHP 5.3.3 (cli) (built: Jul  3 2012 16:53:21)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

The issue is that I can't pass inline-set variables by reference.

For example, this works:

test($var='something');


...but this doesn't:

test(&$var='something');


Perhaps this is the way the engine works or something- but I would think it 
would be easy enough to (and make sense to) allow this.

Test script:
---------------
function test(&$var){
  $var = 'something else';
}

test(&$newvar='something');
echo $newvar;

Expected result:
----------------
something else

Actual result:
--------------
PHP Parse error:  syntax error, unexpected '=', expecting ')' in php shell code 
on 
line 1


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=62664&edit=1

Reply via email to