It happens on the registration form or during its submission.
replace on line 199:
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
by:
$error = preg_replace_callback(
'#^([A-Z_]+)$#',
function ($matches) use ($user) {
return !empty($user->lang[$matches[1]]) ? $user->lang[$matches[1]] : $matches[1];
},
$error
);
Then i could see another error:
[STDERR] PHP Strict Standards: Non-static method custom_profile::build_insert_sql_array() should not be called statically in includes/functions_user.php on line 263\n
on that line replaced:
$db->sql_build_array('INSERT', custom_profile::build_insert_sql_array($cp_data));
by:
$customProfileInstance = new custom_profile();
$sql = 'INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' ' .
$db->sql_build_array('INSERT', $customProfileInstance->build_insert_sql_array($cp_data));
BUT!:
later I have found an error with that replacement above, when i have tried to submit registration form with a custom (antispam field)
It apparently have been solved by inserting:
// Insert Custom Profile Fields
if ($cp_data !== false && sizeof($cp_data)) {
$cp_data['user_id'] = (int) $user_id;
if (!class_exists('custom_profile')) {
include_once($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
}
$customProfileInstance = new custom_profile();
$insertData = $customProfileInstance->build_insert_sql_array($cp_data);
if ($insertData !== false && is_array($insertData)) {
$sql = 'INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $insertData);
} else {
throw new Exception("Failed to build insert SQL array.");
}
between the line:
$user_id = $db->sql_nextid();
and:
$db->sql_query($sql);
(meaning do not replace these lines, but replace the code between that two lines)
Later there one more error in same file:
PHP Strict Standards: Non-static method custom_profile::build_insert_sql_array() should not be called statically in /includes/functions_user.php on line 277\n
This is untested, but possibly replace:
$sql = 'INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' ' .
$db->sql_build_array('INSERT', custom_profile::build_insert_sql_array($cp_data));
by:
$customProfileInstance = new custom_profile();
$sqlArray = $db->sql_build_array('INSERT', $customProfileInstance->build_insert_sql_array($cp_data));
$sql = 'INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' ' . $sqlArray;
it no longer producing an error on user registration submission