Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

"Fix" #0016431: Numerous "Invalid argument supplied for foreach()" er…

…rors when installing with DB script printed to screen
  • Loading branch information...
commit 4231e1b31611c46c22662dbd97df7022bd227b26 1 parent 930c6c3
@grangeway grangeway authored
Showing with 7 additions and 5 deletions.
  1. +7 −5 core/database_api.php
View
12 core/database_api.php
@@ -604,11 +604,13 @@ function db_index_exists( $p_table_name, $p_index_name ) {
$t_indexes = $g_db->MetaIndexes( $p_table_name );
- # Can't use in_array() since it is case sensitive
- $t_index_name = utf8_strtolower( $p_index_name );
- foreach( $t_indexes as $t_current_index_name => $t_current_index_obj ) {
- if( utf8_strtolower( $t_current_index_name ) == $t_index_name ) {
- return true;
+ if( !empty( $t_indexes ) ) {
+ # Can't use in_array() since it is case sensitive
+ $t_index_name = utf8_strtolower( $p_index_name );
+ foreach( $t_indexes as $t_current_index_name => $t_current_index_obj ) {
+ if( utf8_strtolower( $t_current_index_name ) == $t_index_name ) {
+ return true;
+ }
}
}
return false;
Please sign in to comment.
Something went wrong with that request. Please try again.