|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25006 Call-time pass-by-reference has been deprecated
Submitted: 2003-08-10 17:30 UTC Modified: 2003-08-10 17:45 UTC
From: marcus at gooseflesh dot de Assigned:
Status: Not a bug Package: Variables related
PHP Version: 4.3.2 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
29 + 44 = ?
Subscribe to this entry?

 [2003-08-10 17:30 UTC] marcus at gooseflesh dot de
I have really big problems with your newest change to php. having Call-time pass-by-reference has been deprecated without having objects passed-by-reference makes the usability of your language really impractical. 


function foo($var); // is by-value if you pass an object it will be copied.

function foo(&$var); // is by-reference but you cannot pass null or a value.

foo(17); // error
foo(null); // error

function foo(&$var = null); // error

Because you have unsuitable method signiture overloading and now no call-time pass-by-reference an efficient way of designing applications or libraries in your language is now impossible.

It's a pity. At the moment I don't feel like to finish my php projects.



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-10 17:45 UTC]
You of course cannot pass a constant as a reference.
So you also cannot pass NULL by eference.
But you can pass a pareameter set to NULL of course:
  function t(&$p) {}
  $x = NULL;

Having said the above it should be clear why you can't initialize function parameters which are passed by reference. The initialization value would be a const.

Seems you should redesign your apps/libs to something that makes more sense.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Feb 29 14:01:34 2024 UTC