I have theses errors in php v7.2
but don’t see any E_WARNING
when using php v7.1
.
How can I resolve following errors?
/web13/web/boutique/includes/Sites/Shop/NavigationHistory.php on line 39
[12-Jan-2018 22:44:20 America/Toronto] PHP Warning: Use of undefined constant MODULE_HEADER_SELECT_TEMPLATE_STATUS – assumed ‘MODULE_HEADER_SELECT_TEMPLATE_STATUS’ (this will throw an Error in a future version of PHP) in /var/www/clients/client1/web13/web/boutique/includes/Sites/Shop/Template.php on line 356
Kenil Vasani
This is a common warning that occurs whenever PHP has detected the usage of an undefined constant.
Here is an example of constant being defined in PHP:
Below is a list of some cases that might cause the issue:
Forgetting to use a $ symbol at the start of a variable name.
The above code will throw: Notice: Use of undefined constant name – assumed ‘name’. Because there is no dollar sign in front of the variable “name”, PHP assumes that I was trying to reference a constant variable called “name”.
Forgetting to place quotes around strings.
In the example above, I failed to place quotes around the
$_POST
variable“email”
. This code will throw: Notice: Use of undefined constant name – assumed ’email’.To fix this, I’d obviously have to do the following:
According to Deprecated features in PHP 7.2.x you should not use undefined constants because: