E_ALL compilance

Yorirou - April 27, 2009 - 12:03
Project:Patterns
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

I got a rid of some notices.

AttachmentSize
patterns.patch1.59 KB

#1

Yorirou - May 1, 2009 - 10:35
Status:patch (to be ported)» active

I think this is not visible right now

#2

dman - August 30, 2009 - 14:40
Status:active» needs review

Yeah, me too. I got HEAPS of notices when trying to use patterns in an install profile.

The above patch has a few tabs in (naughty when doing compliance ;)

Here's my version of the same fixes, rolled today. I got EXACTLY the same points of notice as Yorirou .. plus one more.

AttachmentSize
patterns-php_strict_warnings.patch 1.92 KB

#3

dman - November 20, 2009 - 23:56

Re-roll.
It's not much fun to work with if my dev copy is going to remain out-of sync with the CVS copy. This means I can't submit any other patches until the code style is cleaned up.

AttachmentSize
patterns-php_strict_warnings-20091121.patch 7.92 KB

#4

joestewart@drup... - November 23, 2009 - 17:48

thanks for trying to clean these up.

Is this portion in there a related bugfix too?

@@ -930,7 +931,7 @@ function patterns_get_patterns($reset =
     $result = db_query('SELECT file FROM {patterns} WHERE status = 1');

     while ($pattern = db_fetch_object($result)) {
-      $enabled[] = $result->file;
+      $enabled[] = $pattern->file;
     }

     $priority = array();

#5

dman - November 23, 2009 - 21:28

It's a fix, it also triggered a strict warning, but to fix it meant repairing the logic also. $result->file is always undefined.
Looked like a typo that got overlooked to me.
Review the logic and see what you think, but I can't see how a db result object could ever have a ->file property, or why you would loop over all $patterns but do nothing with the values found.

This is one of those cases where turning on strict actually does expose some corners of the code that needed review. I think.

 
 

Drupal is a registered trademark of Dries Buytaert.