Skip to content

Commit

Permalink
Fix 'Undefined index: _stats' notice in bug API
Browse files Browse the repository at this point in the history
This is a regression introduced by a change in filter API by commit
5458f70. In filter_cache_result(), the
2nd param to bug_cache_database_result() was changed from 'false' to
default (null). Consequently the '_stats' element was no longer present,
triggering the notice.

Problem solved by relying on array_key_exists() instead of is_null() to
check for the '_stats' array element.

Fixes #17494
  • Loading branch information
dregad committed Jul 7, 2014
1 parent f0885d9 commit c593f90
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions core/bug_api.php
Expand Up @@ -1485,13 +1485,8 @@ function bug_get_bugnote_stats( $p_bug_id ) {
global $g_cache_bug;
$c_bug_id = (int)$p_bug_id;

if( !is_null( $g_cache_bug[$c_bug_id]['_stats'] ) ) {
if( $g_cache_bug[$c_bug_id]['_stats'] === false ) {
return false;
} else {
$t_stats = $g_cache_bug[$c_bug_id]['_stats'];
}
return $t_stats;
if( array_key_exists( '_stats', $g_cache_bug[$c_bug_id] ) ) {
return $g_cache_bug[$c_bug_id]['_stats'];
}

$t_bugnote_table = db_get_table( 'bugnote' );
Expand Down

0 comments on commit c593f90

Please sign in to comment.