Permalink
Browse files

Fix 'Undefined index: _stats' notice in bug API

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 6, 2014
1 parent f0885d9 commit c593f907520c6ae46230371a16ffe145d61bd0eb
Showing with 2 additions and 7 deletions.
  1. +2 −7 core/bug_api.php
View
@@ -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' );

0 comments on commit c593f90

Please sign in to comment.