[TYPO3-core] RFC: #2100: Warning: Call-time pass-by-referencehasbeen deprecated

Martin Kutschker Martin.Kutschker at blackbox.net
Thu Dec 29 22:32:40 CET 2005


Holzinger Franz <franz at fholzinger.com> writes on 
Thu, 29 Dec 2005 22:21:58 +0100 (MET):

> Hello Martin,
> 
> 
> > Do you think it's possible to change the function declaration? I
> > think the references have been introduced to reduce memory
> > footprint.
> > 
> The behaviour will remain as before when the reference operator is in
> the function declaration. And only this will work with PHP 5 without
> warnings.


I know, what I meant is if it is save to change the function declaration. It's unsafe in situations like this:

BEFORE:

function foo($a) {...}
$x = 'abc';
foo($x);
foo('abc');

AFTER:

function foo(&$a) {...}
$x = 'abc';
foo($x);
foo('abc'); // ERROR!!

So if you change it, you have to check all calls.

SOLUTION:

function foo($a) {...}
$x = 'abc';
foo($x);
$y = 'abc'
foo($y);



> >Note: I don't argue to use all-time pass-by-reference, but ask for
> > references in the declaration.
> >
> What is an 'all-time pass-by-reference' ?


A copy'n'paste error. The 'c' in 'call' is missing.

Masi




More information about the TYPO3-team-core mailing list