News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

upgrading to 2.0.18 test failed

Started by bbmtalk, January 11, 2022, 10:18:53 PM

Previous topic - Next topic

bbmtalk

Hello, I am trying to upgrade from 2.0.17 to 2.0.18 and have one failed test. I have found and replaced the code as suggested. After replacing the code, the test still failed. Any suggestion?

'preload' => create_function('', '
global $cur_profile, $context;

// Split up the birthdate....
list ($uyear, $umonth, $uday) = explode(\'-\', empty($cur_profile[\'birthdate\']) || $cur_profile[\'birthdate\'] == \'0001-01-01\' ? \'0000-00-00\' : $cur_profile[\'birthdate\']);
$context[\'member\'][\'birth_date\'] = array(
\'year\' => $uyear == \'0004\' ? \'0000\' : $uyear,
\'month\' => $umonth,
\'day\' => $uday,
);

return true;
'),
'input_validate' => create_function('&$value', '
global $profile_vars, $cur_profile;

if (isset($_POST[\'bday2\'], $_POST[\'bday3\']) && $value > 0 && $_POST[\'bday2\'] > 0)
{
// Set to blank?
if ((int) $_POST[\'bday3\'] == 1 && (int) $_POST[\'bday2\'] == 1 && (int) $value == 1)
$value = \'0001-01-01\';
else
$value = checkdate($value, $_POST[\'bday2\'], $_POST[\'bday3\'] < 4 ? 4 : $_POST[\'bday3\']) ? sprintf(\'%04d-%02d-%02d\', $_POST[\'bday3\'] < 4 ? 4 : $_POST[\'bday3\'], $_POST[\'bday1\'], $_POST[\'bday2\']) : \'0001-01-01\';
}
else
$value = \'0001-01-01\';

$profile_vars[\'birthdate\'] = $value;
$cur_profile[\'birthdate\'] = $value;
return false;
'),
),
// Setting the birthdate the old style way?
'birthdate' => array(
'type' => 'hidden',
'permission' => 'profile_extra',
'input_validate' => create_function('&$value', '
global $cur_profile;
// !!! Should we check for this year and tell them they made a mistake :P? (based on coppa at least?)
if (preg_match(\'/(\d{4})[\-\., ](\d{2})[\-\., ](\d{2})/\', $value, $dates) === 1)
{
$value = checkdate($dates[2], $dates[3], $dates[1] < 4 ? 4 : $dates[1]) ? sprintf(\'%04d-%02d-%02d\', $dates[1] < 4 ? 4 : $dates[1], $dates[2], $dates[3]) : \'0001-01-01\';
return true;
}
else
{
$value = empty($cur_profile[\'birthdate\']) ? \'0001-01-01\' : $cur_profile[\'birthdate\'];
return false;
}
'),
),
'date_registered' => array(

'preload' => function() use ($cur_profile, &$context)
{
// Split up the birthdate....
list ($uyear, $umonth, $uday) = explode('-', empty($cur_profile['birthdate']) || $cur_profile['birthdate'] === '1004-01-01' ? '--' : $cur_profile['birthdate']);
$context['member']['birth_date'] = array(
'year' => $uyear,
'month' => $umonth,
'day' => $uday,
);

return true;
},
'input_validate' => function(&$value) use (&$cur_profile, &$profile_vars)
{
if (isset($_POST['bday2'], $_POST['bday3']) && $value > 0 && $_POST['bday2'] > 0)
{
// Set to blank?
if ((int) $_POST['bday3'] == 1 && (int) $_POST['bday2'] == 1 && (int) $value == 1)
$value = '1004-01-01';
else
$value = checkdate($value, $_POST['bday2'], $_POST['bday3'] < 1004 ? 1004 : $_POST['bday3']) ? sprintf('%04d-%02d-%02d', $_POST['bday3'] < 1004 ? 1004 : $_POST['bday3'], $_POST['bday1'], $_POST['bday2']) : '1004-01-01';
}
else
$value = '1004-01-01';

$profile_vars['birthdate'] = $value;
$cur_profile['birthdate'] = $value;
return false;
},
),
// Setting the birthdate the old style way?
'birthdate' => array(
'type' => 'hidden',
'permission' => 'profile_extra',
'input_validate' => function(&$value) use ($cur_profile)
{
// @todo Should we check for this year and tell them they made a mistake :P? (based on coppa at least?)
if (preg_match('/(\d{4})[\-\., ](\d{2})[\-\., ](\d{2})/', $value, $dates) === 1)
{
$value = checkdate($dates[2], $dates[3], $dates[1] < 4 ? 4 : $dates[1]) ? sprintf('%04d-%02d-%02d', $dates[1] < 4 ? 4 : $dates[1], $dates[2], $dates[3]) : '1004-01-01';
return true;
}
else
{
$value = empty($cur_profile['birthdate']) ? '1004-01-01' : $cur_profile['birthdate'];
return false;
}
},
),
'date_registered' => array(

Kindred

If you changed the code to the target changed code,  then the auto process will fail, but you should continue on.

However,  you need to look at WHY the auto process failed.  Usually, it's because a mod has changed the original code... and by just applying the changed code, you have broken the mod
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

bbmtalk

Quote from: Kindred on January 12, 2022, 12:04:16 AMIf you changed the code to the target changed code,  then the auto process will fail, but you should continue on.

However,  you need to look at WHY the auto process failed.  Usually, it's because a mod has changed the original code... and by just applying the changed code, you have broken the mod

Thanks for your help. I proceeded to upgrade to 2.0.18. How do I look at the auto process?

I only have two mods in my forum

Simple Audio Video Embedder
Country Flags

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Steve

@bbmtalk ... I see that you've been here since Kindred's post so is this resolved or do you still have questions?
DO NOT pm me for support!

Advertisement: