简体   繁体   English

为什么Joomla不使用私人,公共和受保护的关键字?

[英]Why does Joomla not use private, public and protected keywords?

I noticed that Joomla uses less secure var type for variables in classes 我注意到Joomla为类中的变量使用了不太安全的var类型

Why is this? 为什么是这样?

In my own components,plugins,modules should I follow this convention or use a more secure private, public and protected keywords. 在我自己的components,plugins,modules ,我应该遵循此约定,或者使用更安全的私有,公共和受保护的关键字。

Joomla's roots are in PHP 4, (and as @Palantir notes, they even still support it!). Joomla的根源是PHP 4(并且正如@Palantir所指出的那样,它们甚至仍然支持它!)。

It is very difficult to "add" PHP 5's new OOP features like private / public / protected to a complex system like that. 很难将PHP 5的新OOP功能(例如private / public / protected “添加”到这样的复杂系统中。 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. 在将来不再支持PHP 4(不再需要很长时间)时,它们可能会开始出现,并且系统的某些部分将进行基本的重写。

That is to be compatible with PHP4, which does not allow access modifiers and relies on the var keyword. 那将与PHP4兼容,PHP4不允许访问修饰符,并且依赖于var关键字。 See requirements here: http://www.joomla.org/technical-requirements.html , they support PHP4, though they do not recommend it. 请参阅此处的要求: http : //www.joomla.org/technical-requirements.html ,它们支持PHP4,尽管他们不建议这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM