Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

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

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

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

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8428013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:56:14+00:00 2026-06-10T04:56:14+00:00

When I set error_reporting(E_ALL | E_STRICT); , my code produces Undefined variable errors. I

  • 0

When I set error_reporting(E_ALL | E_STRICT);, my code produces Undefined variable errors. I can solve them, but I am wondering whether there is any difference in speed or memory usage between writing code that passes strict checks, and just turning E_STRICT off?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T04:56:15+00:00Added an answer on June 10, 2026 at 4:56 am

    There is no mechanical benefit. You are, however, protected from doing really common, really dumb things like not always initializing a variable before using it – because with E_STRICT on, PHP will generate an error instead of allowing functions to break in potentially-catastrophic, and probably-invisible ways.

    For example, it’s completely conceivable that a database-backed application uses a variable that isn’t initialized by all possible execution paths:

    // Adds an allergy to the user's records
    public function Add($AllergyID) {
        $Patient = $this->Patient->Load();
    
        if ($Patient->Insurance->StartDate < now()) {
              $Allergies = $Patient->Allergies->Get();
              $Allergies[] = $AllergyID;
        }
    
        $Patient->Allergies->Set($Allergies);
    }
    

    Eventually it doesn’t get initialized, and somebody’s medical records table is silently truncated.

    In short, you should always develop with all warnings: it’s your first line of defense. When it comes time to move your code into production, though, you absolutely want error reporting off. You don’t want malicious users gaining insight into the inner workings of your application, or – worse – your database.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The code chokes at fopen(): <?php ini_set('display_errors',1); error_reporting(E_ALL); $fp = fopen(/path/to/file/some_file.txt,a) or die(can't open
In my development machine I have error_reporting set to E_ALL | E_STRICT to see
In php I have my error_reporting set to E_ALL . I was wondering if
I have simple code: <?php error_reporting(E_ALL); ini_set('display_errors', true); ini_set('html_errors', false); $test = array(); $test
I am in a peculiar problem with PHP error. I set error_reporting = E_ALL
is there a way to set error_reporting(E_ALL); for a specific directory rather than including
I have this code: <?php ini_set('display_errors', true); error_reporting(E_ALL); include ../../../wp-load.php; $groups = array(); if
I've set this in my php script: error_reporting(E_ALL ^ E_DEPRECATED); And yet when I
<?php error_reporting(E_ALL); ini_set(display_errors, 1); $AWS_ACCESS_KEY_ID = KEY; $AWS_SECRET_ACCESS_KEY = ACCESS KEY; $base_url = http://webservices.amazon.com/onca/xml?;
<?php ini_set('display_errors',1); error_reporting(E_ALL); require_once('/include/adLDAP.php'); $adldap = new adLDAP(); $username = user123; $password = pass123;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.