Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

display_errors is always set to On. It should honor the php.ini setting instead #3009

Closed
anonymous-matomo-user opened this issue Mar 5, 2012 · 6 comments
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@anonymous-matomo-user
Copy link

As put in evidence by the "security" plugin, display_errors is always on by default.

The line:
ini_set('display_errors', (!defined('PIWIK_DISPLAY_ERRORS') || PIWIK_DISPLAY_ERRORS) ? 1 : 0);

should be:
ini_set('display_errors', (defined('PIWIK_DISPLAY_ERRORS') && PIWIK_DISPLAY_ERRORS) ? 1 : 0);

@robocoder
Copy link
Contributor

It's a bit more complicated than that. In newer php versions, that line actually has no effect (ie can only be set in php.ini). And depending on the php version, it can be a non-boolean value (which PhpSecInfo doesn't recognize).

The fix is to remove the line, update the bootstrap.php docs, and fix PhpSecInfo detection.

@robocoder
Copy link
Contributor

From http://ca2.php.net/manual/en/errorfunc.configuration.php#ini.display-errors

Although display_errors may be set at runtime (with ini_set()), it won't have any affect if the script has fatal errors. This is because the desired runtime action does not get executed.

@robocoder
Copy link
Contributor

(In [5973]) refs #3009 - don't set display_errors in vain; updated online docs (re: bootstrap.php)

@robocoder
Copy link
Contributor

Haha... it's a bug in the php documentation.

I just tested:

<?php ini_set('display_errors', 1); require_once('nonexistent.php');

vs

<?php ini_set('display_errors', 0); require_once('nonexistent.php');

And the latter DID suppress the fatal error.

@robocoder
Copy link
Contributor

(In [5974]) fixes #3009 - display_errors now defaults to disabled; leaving PhpSecInfo "as is" because ini_set("display_errors", "stderr") is still leaky

@anonymous-matomo-user
Copy link
Author

About the line:

<?php ini_set('display_errors', 0); require_once('nonexistent.php');

What you are probably seeing is a blank page. Which is neither a bug in the php doc nor in the php execution:
. the script is halted with a fatal error - you will find it in the error log
. no error message is printed to screen

More meaningful tests are:

<?php ini_set('display_errors', 0); require_once('nonexistent.php'); echo 'hi';

or

<?php require_once('nonexistent.php'); ini_set('display_errors', 0);

@anonymous-matomo-user anonymous-matomo-user added this to the 1.12.x - Piwik 1.12.x milestone Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

2 participants