• I’ve noticed that error messages (from other plugins) have started appearing on a clients site of mine. These messages are from WP core which are only output to the screen when debugging is on. I can confirm that debugging is turned off.

    What I have found is the config/app.php file is setting the environment in this plugin to “dev”. This is then checked as part of the WPFluent package if it isn’t “prod” (which it isn’t) and then tells WP that it is ok to show errors on the screen!

    Can you confirm if this is simply an oversite at your end or is there a configuration issue with how this plugin is installed on the site? I couldn’t see anywhere in the DB, plugin UI, or in the code itself to change the environment to “prod”.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Syed Numan

    (@annuman)

    Hello @nwells,

    The config/app.php file you referenced is part of our plugin’s internal development structure. It does not control or override WordPress core behavior such as WP_DEBUG or error display.

    Manually changing this value is not recommended, as it could cause the plugin to malfunction. The plugin is shipped in a production ready state and does not require any environment adjustments from your end.

    Thank you

    Thread Starter nwells

    (@nwells)

    I agree, this shouldn’t be manually changed. The trouble is, it is being deployed in your plugin files being set to “dev”:

    return array (
    'name' => 'Ninja Tables',
    'slug' => 'ninja-tables',
    'domain_path' => '/language',
    'text_domain' => 'ninja-tables',
    'hook_prefix' => 'ninjatables',
    'rest_namespace' => 'ninjatables',
    'rest_version' => 'v2',
    'env' => 'dev',
    );

    Then, in WPDBConnection.php, it checks the environment variable and sets to show DB errors if the site is not in the “prod” environment:

    protected function setupWpdbInstance($wpdb)
    {
    $this->wpdb = $wpdb;

    $this->wpdb->show_errors(
    $this->shouldShowErrors()
    );
    }

    /**
    * Determine if database errors should be shown.
    *
    * @return bool
    */
    protected function shouldShowErrors()
    {
    return strpos(App::env(), 'prod') === false;
    }

    Yes, ideally, there wouldn’t be any DB errors but this site has a plugin with a bug in it unfortunately which is causing the error – I’ll be working with them as well.

    Does that help clear up where the issue is in your plugin and how it is causing an issue as it thinks it is in dev mode?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Dev mode is forced’ is closed to new replies.