Is there a PHP 5.2 compatibility mode for PHP 5.3?

I am currently developing a Wordpress plugin. I just found out that most of the main Wordpress hosting environments still use PHP 5.2. Given the fact that security patches for 5.2 are still released, although 5.2 is no longer officially supported, it is very likely that 5.2 will not be available soon.

So, it looks like I will need to do refactoring where I used several 5.3 functions, namely late static binding and closing.

Ideally, I do not want to completely destroy the 5.3 environment just for the 5.2 installation. Is there a way to set the “compatibility mode” for my 5.3 setting so that it only accepts 5.2 syntax?

+6
source share
1 answer

Unable to do this, you will need to install 5.2.

If you can live by catching syntax level incompatibilities ( static:: , lambda functions, goto , ...), then you can have the binary binary 5.2 in an isolated place and run file syntax checking ( php -l ) as a build step. However, you will not be warned about using new functions, new arguments, etc.

+3
source

Source: https://habr.com/ru/post/893359/


All Articles