tags:

views:

39

answers:

2

I noticed that Joomla uses less secure var type for variables in classes

Why is this?

In my own components,plugins,modules should I follow this convention or use a more secure private, public and protected keywords.

A: 

That is to be compatible with PHP4, which does not allow access modifiers and relies on the var keyword. See requirements here: http://www.joomla.org/technical-requirements.html, they support PHP4, though they do not recommend it.

Palantir
+1  A: 

Joomla's roots are in PHP 4, (and as @Palantir notes, they even still support it!).

It is very difficult to "add" PHP 5's new OOP features like private / public / protected to a complex system like that. There are too many dependencies to be aware of, and too much potential for obscure bugs.

They will probably start appearing in the future when PHP 4 support is dropped (shouldn't be long anymore), and parts of the system undergo a fundamental rewrite.

Pekka
So basically it would be OK for me to follow the better php5 option and specifically state in the documentation that the plugin does NOT support php4
jax
@jax yes, that sounds like the best way to go. PHP 4 is dead and shouldn't be supported any more.
Pekka