Re: Fatal error: Cannot redeclare str_contains()
Reply #10 –
Hello @willvin ;
Now i understand. Normally it is not related with any changes. ( I mean this is not a case that, the preview was working properly at first then in any changes it is not working. )
At the beginning phase i am receiving this message. For example, you just start new project and create a table then publish it or activate the preview. (no change in anything just publish a simple project) you will receive this error. No changes no different settings or parameters. Just install software and start new project and publish.
As far as i understand from short internet search; a function was used twice or multiple times on Functions.php file.
Here is a simple explanation;
If you see error message 'PHP Fatal error: Cannot redeclare function' or similar error message in your script, it means there is a problem with your script code (it tries to declare the same function multiple times).
This error says that your function is already defined. This could mean:
you have the same function defined in two files
you have the same function defined in two places in the same file
the file in which your function is defined is included two times (so, it seems the function is defined two times)
To help with the third point, a solution would be to use include_once instead of include when including your functions.php file -- so it cannot be included more than once.
Thank you very much for your interest.