vinkla / wordplate

A boilerplate for WordPress, built with Composer and designed with sensible defaults.
2.11k stars 155 forks source link

strict type declaration in wp-config #237

Closed alexandre-tobia closed 5 years ago

alexandre-tobia commented 5 years ago

Hi,

It is possible to remove, or move, the

declare(strict_types=1);

In the wp-config.php ?

Some plugin (like W3 Total cache) and many others, when activated( or updated, configured...), add some constant in the beginning of this file (wp-config) just before the strict type declaration

Fatal error: strict_types declaration must be the very first statement in the script in Fatal error: strict_types declaration must be the very first statement in the script in /Users/alexandretobia/Sites/kisio/public/wp-config.php on line 12

Thats has already break some production's environnement, so i've already remove this line on my projects, but maybe you can remove this line (i dont think im the only one who encoutered this problem)

Thanks !

vinkla commented 5 years ago

Yes, it is possible to remove the strict type declaration.

Some plugin (like W3 Total cache) and many others, when activated( or updated, configured...), add some constant in the beginning of this file (wp-config) just before the strict type declaration.

WordPress plugins such as W3 Total cache shouldn't write to PHP files. With WordPlate we strive to push the WordPress stack forward adopting new features such as strict types. We've already had to make compromises such as leaving the line below in the wp-config.php file since some plugins read that file as plain text 🤷‍♂

https://github.com/wordplate/wordplate/blob/3e54d3207b1a2843bb066ff4f0bc603cdb4531e7/public/wp-config.php#L92