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 |
Jump to:
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.
| Attachment | Size |
|---|---|
| simpletest.fixnotice.patch | 718 bytes |

#1
Whoops, cnr.
#2
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
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
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
This issue should fix problem: #449198: SimpleTest: Clean up test loading and related API
#6
Any plans to backport that change?
#7
subscribing
#8
subscribing
#9
Should be fixed with latest backport.
#10
Automatically closed -- issue fixed for 2 weeks with no activity.