Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.0.0a2

Bug #16170 Undefined Offset -1 in MultiLineConditionSniff.php on line 68
Submitted: 2009-05-02 13:25 UTC Modified: 2009-05-05 07:08 UTC
From: lukas_schroeder Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.2.0RC1)
PHP Version: 5.2.5 OS: MacOSX10.5
Roadmaps: (Not assigned)    
Subscription  



Patch MultiLineSniff Revisions
Revision 2009-05-02 13:25 UTC
Developer lukas_schroeder
 
Download patch

--- /tmp/MultiLineConditionSniff.php	2009-05-02 14:18:31.000000000 +0200
+++ /tmp/ml_patch.p0	2009-05-02 14:18:16.000000000 +0200
@@ -65,8 +65,10 @@
             }
         }
 
-        if ($tokens[$i]['code'] === T_WHITESPACE) {
-            $statementIndent = strlen($tokens[$i]['content']);
+        if ($i >= 0) {
+            if ($tokens[$i]['code'] === T_WHITESPACE) {
+                $statementIndent = strlen($tokens[$i]['content']);
+            }
         }
 
         // Each line between the parenthesis should be indented 4 spaces