#49249 [WFx]: Call-time pass-by-reference deprecated -> undeprecate
ID: 49249
Updated by: rasmus@php.net
Reported By: ile at dennisgiese dot de
Status: Wont fix
Bug Type: Feature/Change Request
Operating System: Win XP Sp3
PHP Version: 5.3.0
New Comment:
There are actually really good technical reasons for turning them off
and not allowing by-refs to functions that do not handle them properly.
Previous Comments:
------------------------------------------------------------------------
[2009-08-14 19:43:25] ile at dennisgiese dot de
maybe but think of php functions like array_walk! you can turn them off
then as well...
don't tell me what is wrong-reasoned or not. just look at what is
wrong-reasoned from YOUR site. i just tool that simple example since it
was the closest i had used.
just telling me ONE single reason, WHY it should be turned off!
it is nonsense - and, as stated above - throws php back to stoneage
since EVERY other "good" programming language i know, make use of
call-time pass-by-reference.
and i won't look up general lists for reasons "why" because there are
no reasons why to turn that off.
------------------------------------------------------------------------
[2009-08-14 08:48:21] derick@php.net
You're using references for all the wrong reasons here as well. Please
refer to the php-general list as to why.
------------------------------------------------------------------------
[2009-08-14 05:20:52] ile at dennisgiese dot de
Description:
------------
Please undreprecate Call-Time pass-by-reference, since it is a fully
supported and used way of programming style in almost EVERY serious and
"big" language!
Reproduce code:
---------------
If you have any kind of class or stack of functions you surely want to
keep lines of code as short as possible. on the other hand you surely
don't want to "copy" your variables just to call a function...
example:
building an XML document, while using a (sub)function in order to
create only sligthly different paths:
private function _prepareRequest()
{
//[some other code]
$this->_StoreInterval("from",&$xmlwriter,$this->startdate);
$this->_StoreInterval("to",&$xmlwriter,$this->enddate);
//[some other code]
}
private function _StoreInterval($kind,&$xmlwriter,$date)
{
$xmlwriter->startElement($kind);
$xmlwriter->writeElement("day",date("d",$date));
$xmlwriter->writeElement("month",date("m",$date));
$xmlwriter->writeElement("year",date("Y",$date));
$xmlwriter->writeElement("hour",date("H",$date));
$xmlwriter->endElement();
}
Expected result:
----------------
in 5.3.0 this still works, but got an warning because this is
"deprecated"...
Actual result:
--------------
actually this should be working anyway, since i don't want to waste
memory just to copy and paste back results from this subfunction.
if this won't work it makes - to some extend - building functions
useles.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49249&edit=1
Thread (4 messages)