CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Suppressing PHP Notices and Warnings
Pages: [1]

Author Topic: Suppressing PHP Notices and Warnings  (Read 1484 times)

Upperholme

  • Administrator
  • Ask me questions
  • *****
  • Posts: 568
  • Karma: 8
    • MC3
  • CiviCRM version: 4.x
  • CMS version: Drupal 6.x/7.x, Wordpress, Joomla
Suppressing PHP Notices and Warnings
March 18, 2015, 11:30:30 am
I'm working with a version 4.4.11 installation with Wordpress, and we recently moved to a different hosting provider (Civihosting) which I've had good experience with over the years. The migration went smoothly but we're seeing issues where PHP notices and warnings are appearing on Civi pages (we've spotted them when trying to go through a deduplication (merge and go to next record) and also more recently when trying to add a tag to a contact.

The php.ini file on the server is set not to display errors, and Hershel has double-checked everything for me and confirms that it's all good (thanks Hershel). And yet we are continuing to see these errors reported on-screen.

I'm about to update to 4.4.latest and I'm hoping that this is down to a bug in 4.4.11 (although I've not found anything in the issue queue other than a fix to suppress these notices in AJAx calls).

Wordpress isn't my strongest suit, and I guess this might Wordpress-related (we're using WP 4.0.1 currently).

If the update doesn't resolve this we're stumped, so any advice on this would be most welcome.



Graham Mitchell
http://mc3.coop

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Suppressing PHP Notices and Warnings
March 19, 2015, 12:36:31 am
For what it is worth (my Wordpress knowledge is probably a lot less than yours :-)) my guess would be to check with Wordpress, certainly if the problem does not occur with Drupal installs.
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Upperholme

  • Administrator
  • Ask me questions
  • *****
  • Posts: 568
  • Karma: 8
    • MC3
  • CiviCRM version: 4.x
  • CMS version: Drupal 6.x/7.x, Wordpress, Joomla
Re: Suppressing PHP Notices and Warnings
March 19, 2015, 12:39:35 am
Hi Erik

Having just upgraded a copy of the site to 4.4.14, one of the instances (when setting tags on a contact record) appears to have been fixed, but the notices are still showing when I do the deduplication.

I guess we keep looking...
Graham Mitchell
http://mc3.coop

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Suppressing PHP Notices and Warnings
March 19, 2015, 05:38:13 am
Even in CiviCRM 4.5.8 (for WordPress) the function error_reporting is called several times in the code:

Code: [Select]
civicrm/install/index.php:        error_reporting(1);
civicrm/install/index.php:        error_reporting(1);
civicrm/packages/pearcmd.php:          $errno & E_DEPRECATED) || !error_reporting()) {
civicrm/packages/cron-expression/tests/bootstrap.php:error_reporting(E_ALL | E_STRICT);
civicrm/packages/vendor/symfony/finder/Symfony/Component/Finder/SplFileInfo.php:        $level = error_reporting(0);
civicrm/packages/vendor/symfony/finder/Symfony/Component/Finder/SplFileInfo.php:        error_reporting($level);
civicrm/packages/PHP/php_beautifier:    error_reporting(E_ALL);
civicrm/packages/PHP/Beautifier.php:// error_reporting(E_ALL);
civicrm/packages/ezc/autoload/document_autoload.php:    'ezcDocumentErrorReporting'                          => 'Document/interfaces/error_reporting.php',
civicrm/packages/Smarty/Smarty.class.php:     * When set, smarty does uses this value as error_reporting-level.
civicrm/packages/Smarty/Smarty.class.php:    var $error_reporting  =  null;
civicrm/packages/Smarty/Smarty.class.php:        $_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(isset($this->error_reporting)
civicrm/packages/Smarty/Smarty.class.php:               ? $this->error_reporting : error_reporting() & ~E_NOTICE);
civicrm/packages/Smarty/Smarty.class.php:                    error_reporting($_smarty_old_error_level);
civicrm/packages/Smarty/Smarty.class.php:                    error_reporting($_smarty_old_error_level);
civicrm/packages/Smarty/Smarty.class.php:            error_reporting($_smarty_old_error_level);
civicrm/packages/Smarty/Smarty.class.php:            error_reporting($_smarty_old_error_level);
civicrm/packages/PEAR/pearcmd.php:    if ((defined('E_STRICT') && $errno & E_STRICT) || !error_reporting()) {
civicrm/packages/PEAR/RunTest.php:        $this->ini_overwrites[] = 'error_reporting=' . (E_ALL & ~(E_DEPRECATED | E_STRICT));
civicrm/packages/PaymentExpress/pxaccess.inc.php: error_reporting(E_ERROR);
civicrm/CRM/Utils/Network.php:    $old_error_reporting = error_reporting();
civicrm/CRM/Utils/Network.php:    error_reporting($old_error_reporting & ~E_WARNING);
civicrm/CRM/Utils/Network.php:        error_reporting($old_error_reporting);
civicrm/CRM/Utils/Network.php:    error_reporting($old_error_reporting);
civicrm/CRM/Utils/System/Drupal6.php:    error_reporting(1);
civicrm/CRM/Utils/System/Drupal.php:    error_reporting(1);
civicrm/CRM/Core/Config.php:        error_reporting(error_reporting() & ~E_DEPRECATED);
civicrm/CRM/Queue/ErrorPolicy.php:    if (!(error_reporting() & $errno)) {

I can understand why this is in the installer, but the other ones are not all clear.

Beyond that, WordPress also calls this function in various places. All this makes it difficult to know when/if a php.ini setting is being overridden. :(
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Upperholme

  • Administrator
  • Ask me questions
  • *****
  • Posts: 568
  • Karma: 8
    • MC3
  • CiviCRM version: 4.x
  • CMS version: Drupal 6.x/7.x, Wordpress, Joomla
Re: Suppressing PHP Notices and Warnings
March 19, 2015, 07:16:48 am
Just installed 4.4.14 with Drupal 7 locally with MAMP. Set to put everything on screen.

Couldn't get it to even display a notice where it was playing up under Wordpress. And nothing reported in the Drupal log. Not sure where that leaves us?
Graham Mitchell
http://mc3.coop

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Suppressing PHP Notices and Warnings
March 19, 2015, 07:36:16 am
I would say we have just found a WordPress specific bug that either needs to be solved in the way CiviCRM is set up in WP or needs to be solved by writing an instruction paragraph in the installation tutorial on how to remove these notices?
And I am assuming you have checked this http://aristeides.com/blog/wp-hide-php-errors/#.VQrexMsrQ6s?
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Upperholme

  • Administrator
  • Ask me questions
  • *****
  • Posts: 568
  • Karma: 8
    • MC3
  • CiviCRM version: 4.x
  • CMS version: Drupal 6.x/7.x, Wordpress, Joomla
Re: Suppressing PHP Notices and Warnings
March 19, 2015, 07:48:05 am
Thanks Erik

Indeed I have read the post that you link to and included that in my wp-config.php file, to no apparent effect.

I think I'll do one more test install locally to see if I can reproduce the issue...
Graham Mitchell
http://mc3.coop

Upperholme

  • Administrator
  • Ask me questions
  • *****
  • Posts: 568
  • Karma: 8
    • MC3
  • CiviCRM version: 4.x
  • CMS version: Drupal 6.x/7.x, Wordpress, Joomla
Re: Suppressing PHP Notices and Warnings
March 22, 2015, 01:45:56 pm
Solved!

The notices were getting shown because of two custom-made extensions - created and installed not by me I should add - in which the debug settings that you would expect when the extension was being developed - had not been commented out once the site went into production mode.

I'd previously ignored this possibility because the extensions appeared to be totally unrelated to the aspects of CivicRM where we were seeing the error messages getting displayed.

Won't make that mistake again.

Thanks for your help, folks.
Graham Mitchell
http://mc3.coop

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Suppressing PHP Notices and Warnings

This forum was archived on 2017-11-26.