[TYPO3-core] #53682, PHP 5.5.6, call-time pass-by-reference, PHP 5.6

Helmut Hummel helmut.hummel at typo3.org
Fri Dec 13 11:02:20 CET 2013

Hi Markus, hi everybody

On 13.12.13 10:06, Markus Klein wrote:

> So again: A pass by reference is used to change the original variable and has nothing to do with the fact that objects are passed by reference.

Thanks for the detailed explanations!

To sum it up: Only "call-time pass-by-reference" is deprectated in PHP 
and this is not used in the code in question, neither the original one, 
nor in the proposed change.

However there are still two things in the existing code that bothered me 
for long, as they are not necessary and even bad practice.

1. The reference modifier is used in the function declaration although 
the variable is expected is an object.

Although technically and internally there might be a difference having 
or not haivng it, practically it is not needed and in fact is a leftover 
from PHP 4 coding practice.

2. The constructor being part of the interface.

This is bad because interfaces should describe the behaviour of an 
object and the constructor is an implementatin detail how the object is 

Therefore I propose the following:

1. Get rid of the contructor method in the (ToolBarItemHook) interface
2. Get rid of the reference modifiers in the implementations of this 
interface. Third party code must do that too if affected by this PHP 
bug, but this can be done any time as there is not interface restriction 
any more
3. Rather than applying breaks to our object creation code by adding 
additional reflection methods[1], I propose to remove reflection for 99% 
of the cases altogether.[2] (I would be fine adding the workaround from 
[1] in the default case of the switch statement, but only if absolutely 

All changes could also be backported to older branches, as they are non 
breaking and pretty straightforward.

What do you think?

Kind regards,

Helmut Hummel
Release Manager TYPO3 6.0
TYPO3 Core Developer, TYPO3 Security Team Member

TYPO3 .... inspiring people to share!
Get involved: typo3.org

More information about the TYPO3-team-core mailing list