@@ -124,11 +124,10 @@ public function __get( $p_name ) {
124
124
* if the version can't be found. If the second parameter is
125
125
* false, return false if the version can't be found.
126
126
* @param int $p_version_id
127
- * @param bool $p_trigger_errors
128
127
* @return array
129
128
* @throws MantisBT\Exception\Issue\Version\VersionNotFound
130
129
*/
131
- function version_cache_row ( $ p_version_id, $ p_trigger_errors = true ) {
130
+ function version_cache_row ( $ p_version_id ) {
132
131
global $ g_cache_versions ;
133
132
134
133
$ c_version_id = (int )$ p_version_id ;
@@ -143,13 +142,7 @@ function version_cache_row( $p_version_id, $p_trigger_errors = true ) {
143
142
$ row = db_fetch_array ( $ result );
144
143
145
144
if ( !$ row ) {
146
- $ g_cache_versions [$ c_version_id ] = false ;
147
-
148
- if ( $ p_trigger_errors ) {
149
- throw new MantisBT \Exception \Issue \Version \VersionNotFound ( $ p_version_id );
150
- } else {
151
- return false ;
152
- }
145
+ throw new MantisBT \Exception \Issue \Version \VersionNotFound ( $ p_version_id );
153
146
}
154
147
155
148
$ g_cache_versions [$ c_version_id ] = $ row ;
@@ -165,7 +158,12 @@ function version_cache_row( $p_version_id, $p_trigger_errors = true ) {
165
158
* @return bool
166
159
*/
167
160
function version_exists ( $ p_version_id ) {
168
- return version_cache_row ( $ p_version_id , false ) !== false ;
161
+ try {
162
+ version_cache_row ( $ p_version_id );
163
+ } catch ( MantisBT \Exception \Issue \Version \VersionNotFound $ e ) {
164
+ return false ;
165
+ }
166
+ return true ;
169
167
}
170
168
171
169
/**
0 commit comments