Pressflow - PHP Notices

mikeytown2's picture

Currently fixing various notices and I find this query to be very useful in phpmyadmin. Be sure to have "Full Texts" selected under options.

SELECT
  COUNT(*) AS count,
  watchdog.*
FROM watchdog AS watchdog
WHERE type = 'php'
#AND variables NOT LIKE "%SQL%"
GROUP BY variables
ORDER BY
  count DESC,
  wid ASC

This is what I use on the dev box in settings.php; makes errors very verbose and enables dblog if it is disabled.

<?php
 
// Show Errors in output
 
ini_set('display_errors', '1');
 
// Report all php errors.
 
error_reporting(-1);
 
// Display errors using drupal_set_message().
 
$conf['error_level'] = 1;
 
// Enable the dblog module if it is disabled.
 
if (!module_exists('dblog')) {
   
register_shutdown_function('drupal_install_modules', array('dblog'));
   
register_shutdown_function('drupal_flush_all_caches');
  }
?>

Comments

pressflow and ubercart

alby111's picture

Installing Ubercart-6.x-2.6 with pressflow 6 , I have lots of issues with Notice: Undefined property" or "# Notice: Undefined index" , I wonder is this is a big problem or I can just ignore them ?

Issue Queue

mikeytown2's picture

Search the issue queue for core/that module and file a new bug with the full error text if you can't find it.

PHP Version

stevenator's picture

I see this error in Drupal mostly when the version of PHP I am running is not inline with the version of Drupal. You can fix the errors by changing some functions, but in the interest of not touching core or contrib files, putting in some error_reporting settings in either you php.ini file or the druapal settings.php will help.

I can bet that you are using

pedrorocha's picture

I can bet that you are using PHP 5.3 ;)

Drupal 6 core isn't compatible with it, that's why you are having this bunch of "Notice". The best is to change your PHP to 5.2, because you can't assure that all of the modules you'll use will be ok with 5.3.

I'm not sure, but i think Drupal 7 is ok with 5.3

I have been using PHP 5.3.x

Peter Bowey's picture

I have been using PHP 5.3.x with Drupal and Pressflow 6.22 for some time.
This is certainly a working combo!
Pressflow uses the more strict PHP E Notice - by default... great for revealing issues!

--
Linux: Web Developer
Peter Bowey Computer Solutions
Australia: GMT+9:30
(¯`·..·[ Peter ]·..·´¯)

Yes, Pressflow 6.x have such

pedrorocha's picture

Yes, Pressflow 6.x have such improvements that came on Drupal 7, on top of Drupal 6, so you can use PHP5.3(and finally can't use PHP4.x more). With Drupal 6 "basic" you'll have the notices.

thanks a lot

alby111's picture

Thanks everybody for such a quick response, so I understand that the problem for Drupal or pressflow 6.22 is not because the use of PHP 5.3 but because some modules are made for 5.2x . If so, any body knows of witch modules could those be, and if ubercart has problems with pressflow because the PHP version or other reason like lazy session?

Peter Bowey's picture

Installing Ubercart-6.x-2.6 with pressflow 6 , I have lots of issues with Notice: Undefined property" or "# Notice: Undefined index" , I wonder is this is a big problem or I can just ignore them ?

Based on my own experience, you can simply ignore them - but I [also] choose to report them [module's project team]- and / or fix them!

"Just think of the process as a

'PHP 5.3.x revealing microscope'

, and old code [or poorly written code] will show up with NOTICE reports!"

Adjust your D6 logging to minimize this -if you wish.

For the most part I have no serious issues with the latest [dev] Ubercart core or related modules.

[Blah Bits]: Drupal modules are not normally 'targeted' to any specific PHP.x version, it is more about programmer code skills / methods - and or the module age [PHP4 methods still live - for some coders]!

PHP 5.3.x is more like a object orientated language [oop] and prefers 'structure'. While Drupal does not yet fully implement 'oop's' [PHP: Classes and Objects ], it does certainly benefit from clean and solid code practices. Long live 'classes and methods' :-)

According to http://php.net/releases/5_3_8.php

All PHP users should note that the PHP 5.2 series is NOT supported anymore. All users are strongly encouraged to upgrade to PHP 5.3.8.

--
Linux: Web Developer
Peter Bowey Computer Solutions
Australia: GMT+9:30
(¯`·..·[ Peter ]·..·´¯)

D6: Run across multiple databases

mikeytown2's picture

With this patch applied to core
http://drupal.org/node/496184

The code below will tell you what PHP errors have the highest count across all databases in $db_url if it's an array.

<?php
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
header('Content-Type: text/plain');

global
$db_url;
$o = db_set_active();

$data = array();
foreach (
$db_url as $key => $value) {
 
$good = db_set_active($key, FALSE);
  if (!
$good) {
    continue;
  }
  if (!
db_table_exists('watchdog')) {
    continue;
  }

 
$results = db_query("
    SELECT
      COUNT(*) AS count,
      watchdog.*
    FROM {watchdog} AS watchdog
    WHERE type = 'php'
    GROUP BY variables
    ORDER BY
      count DESC,
      wid ASC"
);
  while (
$row = db_fetch_array($results)) {
    if (empty(
$data[$row['variables']])) {
     
$data[$row['variables']] = $row;
    }
    else {
     
$data[$row['variables']]['count'] += $row['count'];
    }
  }
}

$new_data = array();
foreach (
$data as $row) {
 
$row['readable'] = "\n" . t(str_replace('%', '@', str_replace('n (', "n \n(", $row['message'])), unserialize(str_replace('%', '@', $row['variables'])));
 
$new_data[$row['count']] = $row;
}
krsort($new_data);
$data = array_values($new_data);

db_set_active($o);
print_r($data);
?>

I modified the query a bit

greggles's picture

I modified the query a bit because I think that grouping by all variables in watchdog table may focus on notices from crawlers rather than notices found by normal users.

SELECT COUNT(*) AS count, variables, location FROM watchdog AS watchdog WHERE type = 'php'  GROUP BY variables ORDER BY   count DESC,   wid ASC limit 10;

High performance

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week