Recently my aplications started throwing errors of this kind:
PHP Fatal error: Cannot redeclare {X Class} (previously declared in {X File: X line}) in {X File: X line}
After some investigations, I came to the conclusion that the PHP code is somehow being executed twice.
To make sure, I created a file with the following code:
error_reporting(E_ALL);
define('SOMETHING', 'ITS OK');
echo SOMETHING;
die();
That is the entire code of the file. Yet sometimes, when requesting that file, the following error is beeing produced:
PHP Notice: Constant SOMETHING already defined in {Y File} on line 6
Do you know what kind of setting could be causing this?
The issue seems easyer to reproduce with fast consecutive requests but it might not be limited to that scenario, sometimes it seems to happen on a single request (but Im not considering this a fact)
The issue seem to appear because of proactive defense in imunify360. https://www.imunify360.com/proactive-defense . Disabling the proactive defense php module seems to resolve the issue.