After switching servers, and operating system versions (Debian "Lenny" to "Squeeze"), all moved sites (without exception) emit insane amounts of PHP errors ("type: PHP", "Severity: error") into the watchdog logs, all complaining about "Undefined index", "Undefined variable", "Undefined constant", or "Undefined property".

At first I thought this might indicate some minor bugs in a couple of modules, but after monitoring watchdog for a while, basically every module/theme I'm running causes these errors, including core. Some examples:

Notice: Undefined index: key in format_xml_elements() (line 1114 of /var/www/drupal/includes/common.inc).
...
Notice: Undefined variable: node in include() (line 131 of /var/www/drupal/sites/all/themes/acquia_prosper/page.tpl.php).
...
Notice: Undefined index: HTTPS in translate_this_display_button() (line 60 of /var/www/drupal/sites/all/modules/translate_this/translate_this.module).
...
Notice: Undefined offset: 0 in content_taxonomy_token_values() (line 48 of /var/www/drupal/sites/all/modules/content_taxonomy/includes/content_taxonomy.token.inc).
...
Notice: Use of undefined constant OPENLIBRARY_COVERS_API_ROOT - assumed 'OPENLIBRARY_COVERS_API_ROOT' in include_once() (line 27 of /var/www/drupal/sites/all/modules/openlibrary/openlibrary.module).
...
Notice: Undefined variable: term_desc in _taxonomy_vtn_terms_blocks_view() (line 187 of /var/www/drupal/sites/all/modules/taxonomy_vtn/taxonomy_vtn_terms_blocks/taxonomy_vtn_terms_blocks.module).
...
Notice: Trying to get property of non-object in include() (line 13 of /var/www/drupal/sites/all/themes/rh/custom-pager.tpl.php).
...
Notice: Undefined property: stdClass::$parent in include() (line 12 of /var/www/drupal/sites/all/themes/rh/custom-pager.tpl.php).

As far as I know, watchdog messages prepended with "Notice:" are not severe and can be ignored. The sites seem to operate fine, but I'm shocked by the amout of errors - there's basically nothing else in the watchdog log, and far more than 100 of these PHP errors are recoreded in every watchdog log in every site per minute. Considering the impact of this on the database server, I'd like to either resolve these errors, if possible, or to disable these notices. However, ./admin/settings/error-reporting does not allow to completely disable error logging.

Any ideas or suggestions?

Comments

asb’s picture

The global php.ini file allows to suppress PHP error notices:

; Common Values:
;   E_ALL & ~E_NOTICE  (Show all errors, except for notices and coding standards warnings.)
;   E_ALL & ~E_NOTICE | E_STRICT  (Show all errors, except for notices)
;   E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR  (Show only errors)
;   E_ALL | E_STRICT  (Show all errors, warnings and notices including coding standards.)
; Default Value: E_ALL & ~E_NOTICE
; Development Value: E_ALL | E_STRICT
; Production Value: E_ALL & ~E_DEPRECATED
; http://php.net/error-reporting

The default setting on Debian "Squeeze" is:

error_reporting = E_ALL & ~E_DEPRECATED

This quiets Drupal's watchdog logs down:

error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR

Though I'm not sure if this setting can be generally recommended for production use as even notices might indicate failures in the code.

niner94949’s picture

I've mysteriously started receiving these as well. I can't figure out what is going on. Very strange as it's as you said 'hundreds' of these all with the same time stamp.

jday’s picture

same weird errors on a new linode server using ubuntu lucid and php pinned to karmic 5.2

ericbroder’s picture

Starting about a week ago I keep getting weird php errors in my sandbox. First I thought it was a new module I was testing. Then I realized that my Drupal logs are filled with php errors the minute I sync down a new database. These errors are all over the place and don't make sense, such as:

Notice: Undefined variable: tokens in uc_rules_token_values()
Notice: Undefined offset: 1 in jquery_ui_add()
Notice: Trying to get property of non-object in jquery_ui_add()
Notice: Undefined index: path in admin_menu_link_build()
Notice: Undefined index: page callback in page_manager_search_menu_alter()

Any ideas what could be causing this? I'm on Ubuntu 10.10, Apache/2.2.16, MySQL database 5.1.49, PHP 5.2.10-2ubuntu6.

Thanks,
Eric

asb’s picture

Bugs in the modules you are using are causing this. You can suppress the errors by modifying the PHP error level, or you can debug the code.

If you follow each of the errors in each module's issue queue, you'll probably find a many related reports, and a couple of patches.

willhowlett’s picture

I am experiencing this as well after migrating from a Wamp setup to Lamp (CentOS 6), on Drupal 6 sites.

My initial thought was that they couldn't all be down to module errors, as the error reporting level was set to 'all' on the old server as well and no messages were received there. However we have updated php from 5.2.13 to 5.3.3, and mysql from 5.1.45 to 5.1.52 as part of the move, so could this explain the errors? (Some modules not being updated for php 5.3 seems a possiblity - though I notice ericbroder is on 5.2 and getting errors)

The only other difference I can think of is that we are now using Drush to maintain the sites.

Any advice much appreciated, as I'd rather not have to change the error level if possible.

willhowlett’s picture

Ok, for my situation it appears that this explains it: http://groups.drupal.org/node/194883

i.e. the errors I'm receiving are due to specific modules not being ready for php 5.3.

I'll have to take a closer look at these modules and decide how problematic I think they are. I'm really not keen on getting a new server together just to run an older version of php on it.

cdcg21’s picture

* notice: Undefined index: #node in /home/drunken6/public_html/modifiedcycletrader.com/sites/all/modules/nap/modules/uc_nap/uc_nap.module on line 76.
* notice: Undefined variable: type in /home/drunken6/public_html/modifiedcycletrader.com/sites/all/modules/ubercart/uc_product/uc_product.module on line 1747.
* notice: Undefined index: #node in /home/drunken6/public_html/modifiedcycletrader.com/sites/all/modules/node_author/nodeauthor.module on line 233.
* notice: Trying to get property of non-object in /home/drunken6/public_html/modifiedcycletrader.com/sites/all/modules/node_author/nodeauthor.module on line 233.
* notice: Trying to get property of non-object in /home/drunken6/public_html/modifiedcycletrader.com/sites/all/modules/node_author/nodeauthor.module on line 166.
* notice: Undefined index: blog in /home/drunken6/public_html/modifiedcycletrader.com/sites/all/modules/paypernode/paypernode.module on line 163.
* notice: Undefined index: ad in /home/drunken6/public_html/modifiedcycletrader.com/sites/all/modules/paypernode/paypernode.module on line 163.
* notice: Undefined index: image in /home/drunken6/public_html/modifiedcycletrader.com/sites/all/modules/paypernode/paypernode.module on line 163.
* notice: Undefined index: product in /home/drunken6/public_html/modifiedcycletrader.com/sites/all/modules/paypernode/paypernode.module on line 163.
* notice: Undefined index: product_kit in /home/drunken6/public_html/modifiedcycletrader.com/sites/all/modules/paypernode/paypernode.module on line 163.
* notice: Undefined index: forum in /home/drunken6/public_html/modifiedcycletrader.com/sites/all/modules/paypernode/paypernode.module on line 163.
* notice: Undefined index: panel in /home/drunken6/public_html/modifiedcycletrader.com/sites/all/modules/paypernode/paypernode.module on line 163.
* notice: Undefined index: page in /home/drunken6/public_html/modifiedcycletrader.com/sites/all/modules/paypernode/paypernode.module on line 163.
* notice: Undefined index: profile in /home/drunken6/public_html/modifiedcycletrader.com/sites/all/modules/paypernode/paypernode.module on line 163.
* notice: Undefined index: story in /home/drunken6/public_html/modifiedcycletrader.com/sites/all/modules/paypernode/paypernode.module on line 163.
* notice: Undefined variable: title_color in /home/drunken6/public_html/modifiedcycletrader.com/sites/all/themes/mix_and_match/page.tpl.php on line 43.
* notice: Undefined variable: slogan_color in /home/drunken6/public_html/modifiedcycletrader.com/sites/all/themes/mix_and_match/page.tpl.php on line 43.
* notice: Undefined index: #node in /home/drunken6/public_html/modifiedcycletrader.com/sites/all/modules/nap/modules/uc_nap/uc_nap.module on line 76.
* notice: Undefined variable: type in /home/drunken6/public_html/modifiedcycletrader.com/sites/all/modules/ubercart/uc_product/uc_product.module on line 1747.
* notice: Undefined index: #node in /home/drunken6/public_html/modifiedcycletrader.com/sites/all/modules/node_author/nodeauthor.module on line 233.
* notice: Trying to get property of non-object in /home/drunken6/public_html/modifiedcycletrader.com/sites/all/modules/node_author/nodeauthor.module on line 233.
* notice: Trying to get property of non-object in /home/drunken6/public_html/modifiedcycletrader.com/sites/all/modules/node_author/nodeauthor.module on line 166.

I don't know what to do

willhowlett’s picture

Was this also after changing host? Are you able to provide what php / mysql / apache version you're on? Interested to know if there are any similarities between our setups.