Skip to content

Commit

Permalink
Fix #15698: system warning when editing profile
Browse files Browse the repository at this point in the history
When user clicks Submit button to edit an existing profile, without
first selecting one from the list, the following system warning was
triggered: 'extract() expects parameter 1 to be array, boolean given'.

The code now ensures that a profile has been selected before redirecting
to account_prof_edit_page.php, and issues a meaningful error message if
not.
  • Loading branch information
dregad committed Apr 4, 2013
1 parent c6e0b1b commit 7d1800e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions account_prof_update.php
Expand Up @@ -60,10 +60,18 @@
current_user_ensure_unprotected();

$f_action = gpc_get_string('action');
if( $f_action != 'add') {
$f_profile_id = gpc_get_int( 'profile_id' );

# Make sure user did select an existing profile from the list
if( $f_profile_id == 0 ) {
error_parameters( lang_get( 'select_profile' ) );
trigger_error( ERROR_EMPTY_FIELD, ERROR );
}
}

switch ( $f_action ) {
case 'edit':
$f_profile_id = gpc_get_int( 'profile_id' );
form_security_purge('profile_update');
print_header_redirect( 'account_prof_edit_page.php?profile_id=' . $f_profile_id );
break;
Expand Down Expand Up @@ -96,7 +104,6 @@
break;

case 'update':
$f_profile_id = gpc_get_int( 'profile_id' );
$f_platform = gpc_get_string( 'platform' );
$f_os = gpc_get_string( 'os' );
$f_os_build = gpc_get_string( 'os_build' );
Expand All @@ -116,7 +123,6 @@
break;

case 'delete':
$f_profile_id = gpc_get_int( 'profile_id' );
if ( profile_is_global( $f_profile_id ) ) {
access_ensure_global_level( config_get( 'manage_global_profile_threshold' ) );

Expand All @@ -131,7 +137,6 @@
break;

case 'make_default':
$f_profile_id = gpc_get_int( 'profile_id' );
current_user_set_pref( 'default_profile', $f_profile_id );
form_security_purge('profile_update');
print_header_redirect( 'account_prof_menu_page.php' );
Expand Down

0 comments on commit 7d1800e

Please sign in to comment.