Sign Up

Have an account? Sign In Now

Sign In

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have a permission to ask a question, You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here
Sign InSign Up

ErrorCorner

ErrorCorner Logo ErrorCorner Logo

ErrorCorner Navigation

  • Home
  • Contact Us
  • About Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Contact Us
  • About Us
Home/ Questions/Q 812
Next
Answered
Kenil Vasani
Kenil Vasani

Kenil Vasani

  • 646 Questions
  • 567 Answers
  • 77 Best Answers
  • 26 Points
View Profile
  • 7
Kenil Vasani
Asked: December 18, 20202020-12-18T21:37:43+00:00 2020-12-18T21:37:43+00:00In: php

Undefined constant error in php 7.2

  • 7

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

php
  • 1 1 Answer
  • 10 Views
  • 0 Followers
  • 0
Answer
Share
  • Facebook

    1 Answer

    • Voted
    1. Kenil Vasani

      Kenil Vasani

      • 646 Questions
      • 567 Answers
      • 77 Best Answers
      • 26 Points
      View Profile
      Best Answer
      Kenil Vasani
      2020-12-18T21:36:30+00:00Added an answer on December 18, 2020 at 9:36 pm

      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:

      define('PI', 3.14);
      

      Below is a list of some cases that might cause the issue:

      • Forgetting to use a $ symbol at the start of a variable name.

        $name = "Aniket";
        echo name; // forgot to add $ before 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.

        echo $_POST[email];
        

        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:

        echo $_POST["email"];
        

      According to Deprecated features in PHP 7.2.x you should not use undefined constants because:

      Unquoted strings that are non-existent global constants are taken to be strings of themselves.

      This behaviour used to emit an E_NOTICE, but will now emit an E_WARNING

      • 9
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp

    You must login to add an answer.

    Forgot Password?

    Sidebar

    Ask A Question
    • Popular
    • Kenil Vasani

      SyntaxError: invalid syntax to repo init in the AOSP code

      • 5 Answers
    • Kenil Vasani

      xlrd.biffh.XLRDError: Excel xlsx file; not supported

      • 3 Answers
    • Kenil Vasani

      Homebrew fails on MacOS Big Sur

      • 3 Answers
    • Kenil Vasani

      runtimeError: package fails to pass a sanity check for numpy ...

      • 3 Answers
    • Kenil Vasani

      Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains ...

      • 2 Answers

    Explore

    • Most Answered
    • Most Visited
    • Most Voted
    • Random

    © 2020-2021 ErrorCorner. All Rights Reserved
    by ErrorCorner.com