Skip to content

Commit 7d1800e

Browse files
committedApr 4, 2013
Fix #15698: system warning when editing profile
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.
1 parent c6e0b1b commit 7d1800e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed
 

‎account_prof_update.php

+9-4
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,18 @@
6060
current_user_ensure_unprotected();
6161

6262
$f_action = gpc_get_string('action');
63+
if( $f_action != 'add') {
64+
$f_profile_id = gpc_get_int( 'profile_id' );
65+
66+
# Make sure user did select an existing profile from the list
67+
if( $f_profile_id == 0 ) {
68+
error_parameters( lang_get( 'select_profile' ) );
69+
trigger_error( ERROR_EMPTY_FIELD, ERROR );
70+
}
71+
}
6372

6473
switch ( $f_action ) {
6574
case 'edit':
66-
$f_profile_id = gpc_get_int( 'profile_id' );
6775
form_security_purge('profile_update');
6876
print_header_redirect( 'account_prof_edit_page.php?profile_id=' . $f_profile_id );
6977
break;
@@ -96,7 +104,6 @@
96104
break;
97105

98106
case 'update':
99-
$f_profile_id = gpc_get_int( 'profile_id' );
100107
$f_platform = gpc_get_string( 'platform' );
101108
$f_os = gpc_get_string( 'os' );
102109
$f_os_build = gpc_get_string( 'os_build' );
@@ -116,7 +123,6 @@
116123
break;
117124

118125
case 'delete':
119-
$f_profile_id = gpc_get_int( 'profile_id' );
120126
if ( profile_is_global( $f_profile_id ) ) {
121127
access_ensure_global_level( config_get( 'manage_global_profile_threshold' ) );
122128

@@ -131,7 +137,6 @@
131137
break;
132138

133139
case 'make_default':
134-
$f_profile_id = gpc_get_int( 'profile_id' );
135140
current_user_set_pref( 'default_profile', $f_profile_id );
136141
form_security_purge('profile_update');
137142
print_header_redirect( 'account_prof_menu_page.php' );

0 commit comments

Comments
 (0)
Please sign in to comment.