Undefined variable: classes Notice - simpletest.module - line 504 - simpletest_get_all_tests()

lyricnz - April 27, 2009 - 13:23
Project:SimpleTest
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:minor
Assigned:boombatower
Status:closed
Description

The code starting at line 504 reads:

<?php
 
if (count($classes) == 0) {
   
drupal_set_message('No test cases found.', 'error');
    return
FALSE;
  }
  return
$classes;
}
?>

However $classes is not set in all code-paths. It either needs to be initialized at the top, or checked with !isset at the bottom. With this change, simpletest/tests/block.test goes "110 passes, 0 fails, and 0 exceptions" with E_ALL.

See attachment for the initialization approach.

AttachmentSize
simpletest.fixnotice.patch718 bytes

#1

lyricnz - April 27, 2009 - 13:24
Status:active» needs review

Whoops, cnr.

#2

boombatower - April 27, 2009 - 17:05

As I commented http://drupal.org/node/442332#comment-1525776 shouldn't it effect D7 as well?

Seems like the code is fundamentally flawed...in that it caches $formatted_classes, but returns $classes.

I was planning on re-working this function in Drupal 7 (soon), so perhaps I should just do that.

#3

lyricnz - April 27, 2009 - 21:37

Yeah, now that I look at it - the code doesn't make any sense, and will return array() every time it's called (except the first).

Looks like it was broken by this change on March 31 (the static getInfo()).

Should we raise a new issue, or retask this one?

#4

boombatower - April 27, 2009 - 22:24
Status:needs review» postponed

I plan to re-work the function and all the places it is called shortly.

Waiting on my first cleanup: #445950: SimpleTest interface separation and cleanup.

#5

boombatower - May 3, 2009 - 19:45

#6

lyricnz - June 13, 2009 - 04:57

Any plans to backport that change?

#7

Stalski - June 18, 2009 - 21:25

subscribing

#8

hotelfoo - July 10, 2009 - 03:05

subscribing

#9

boombatower - September 14, 2009 - 19:48
Assigned to:Anonymous» boombatower
Status:postponed» fixed

Should be fixed with latest backport.

#10

System Message - September 28, 2009 - 19:50
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.