ID:               31606
 User updated by:  gutzas at moongate dot ro
 Reported By:      gutzas at moongate dot ro
 Status:           Bogus
 Bug Type:         Unknown/Other Function
 Operating System: Fedora Linux
 PHP Version:      4.3.10
 New Comment:

I understand, and yes, it works properly that way. Thank you, and sorry
for wasting your time.


Previous Comments:
------------------------------------------------------------------------

[2005-01-19 12:40:31] [EMAIL PROTECTED]

Your function definition already has a & which makes the variable pass
by reference. So you do not need the & when *calling* the function.

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

[2005-01-19 11:59:54] gutzas at moongate dot ro

I *need* to pass that variable by reference, my code is correct, and
PHP issues a warning which has nothing to do with reality. How can that
not be a bug?!

Obviously, the code I posted in the bug is the most canonical form I
could find to reproduce the bug. In this sample case I could have
passed the argument by value proper, but in my production code I need
it to be passed by reference, and I need to pass it via a variable
function name.

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

[2005-01-19 11:07:54] [EMAIL PROTECTED]

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

Remove the & from the call!

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

[2005-01-19 11:03:01] gutzas at moongate dot ro

Description:
------------
Passing by reference when the function is called as variable generates
a warning message, even if the function does accept its parameters by
reference.

The actual behaviour is however correct, even though the warning says
that the argument has been passed by value.

This is a major problem for intensively used sites where this
functionality is needed and warning messages are logged because the
logs grow to unmanageable sizes really fast.


Reproduce code:
---------------
<?

  function foo(&$param)
  {
    $param++;
  }

  $function_name='foo';
  $myParam=1;
  $function_name(&$myParam);
  echo("\n---> $myParam <---\n");

?>


Expected result:
----------------
---> 2 <---


Actual result:
--------------
<br />
<b>Warning</b>:  Call-time pass-by-reference has been deprecated -
argument passed by value;  If you would like to pass it by reference,
modify the declaration of [runtime function name]().  If you would like
to enable call-time pass-by-reference, you can set
allow_call_time_pass_reference to true in your INI file.  However,
future versions may not support this any longer.  in
<b>/var/www/html/mgv/dev/helpdesk_root/helpdesk/test_reference.php</b>
on line <b>10</b><br />

---> 2 <---



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


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

Reply via email to