Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Aiheen aloitti: Sir Osis of Liver - helmikuu 26, 2020, 11:34:12 AP

Otsikko: Error saving profile changes
Kirjoitti: Sir Osis of Liver - helmikuu 26, 2020, 11:34:12 AP
One member is having a problem saving profile changes -



/index.php?action=profile;area=forumprofile;u=6303;save
Call to undefined function dl()



Only happens in Forum Profile, only his account.  Checked mine and several other accounts, works fine.  Clean install with 5 mods installed, running with large production database.  He gets same error with different themes.

Advanced Topic Prefix Mod 4.0.3
Register At Post View 1.1
Join Reason 1.5
Default_Membergroup 2.0
Global Headers Footers 2.1a

Forum version: SMF 2.0.17
GD version: bundled (2.1.0 compatible)
Database Server: MariaDB
MySQL version: 10.3.22-MariaDB-cll-lve
PHP: 7.2.27
Server version: LiteSpeed
Otsikko: Re: Error saving profile changes
Kirjoitti: m4z - helmikuu 26, 2020, 11:39:03 AP
fileinfo extension included in php.ini?
Otsikko: Re: Error saving profile changes
Kirjoitti: Sir Osis of Liver - helmikuu 26, 2020, 11:44:49 AP
Will check tonight, but wouldn't think it's anything in php.ini as it's only affecting one account (so far), and nothing was changed in php config during rebuild.  Migrated to new host (mine), that shouldn't have caused a problem.

Otsikko: Re: Error saving profile changes
Kirjoitti: Shambles - helmikuu 26, 2020, 01:51:48 IP
Lainaus käyttäjältä: Sir Osis of Liver - helmikuu 26, 2020, 11:34:12 AP
One member is having a problem saving profile changes...

Is he, by any chance, trying to update his avatar by uploading a file?

If so, the fileinfo remark becomes valid and the extension requires checking to ensure it's being loaded in php.ini.
Otsikko: Re: Error saving profile changes
Kirjoitti: Sir Osis of Liver - helmikuu 26, 2020, 08:01:09 IP
No, if you load the Forum Profile page and save without doing anything, still throws the error.  What is function dl()?

Oddly, doesn't happen on clone I'm running on same host, different server.
Otsikko: Re: Error saving profile changes
Kirjoitti: Sir Osis of Liver - helmikuu 26, 2020, 09:05:03 IP
Ok, function dl() is in Subs-Package.php, it's called from Profile-Modify.php -



// Checks whether a file or data retrieved by fetch_web_data has the expected MIME type.
// Returns 1 if the detected MIME type matches the pattern, 0 if it doesn't, or 2 if we can't check.
function check_mime_type($data, $type_pattern, $is_path = false)
{
// On Windows, the Fileinfo extension may not be enabled by default.
if (!extension_loaded('fileinfo'))
{
// Maybe we can load it dynamically?
$loaded = false;
$safe = ini_get('safe_mode');
$dl_ok = ini_get('enable_dl');
if (empty($safe) && !empty($dl_ok))
$loaded = @dl(((PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '') . 'fileinfo.' . PHP_SHLIB_SUFFIX);

// Oh well. We tried.
if (!$loaded)
return 2;
}

// Just some nice, simple data to analyze.
if (empty($is_path))
$mime_type = finfo_buffer(finfo_open(FILEINFO_MIME), $data);

// A file, or maybe a URL?
else
{
// Local file.
if (file_exists($data))
$mime_type = mime_content_type($data);

// URL.
elseif (url_exists($data))
$mime_type = finfo_buffer(finfo_open(FILEINFO_MIME), fetch_web_data($data));

// Non-existent files obviously don't have the right MIME type.
else
return 0;
}

return (int) @preg_match('~' . $type_pattern . '~', $mime_type);
}



Problem is member's avatar, it's an external link and for some reason SMF doesn't like it.  If I remove avatar, fixes error.  If I try to reenter url or upload file, I get this -



The following errors occurred when trying to save your profile:
The avatar you have selected is either too large or not an avatar.



Avatars are set to resize using html.  File attached.
Otsikko: Re: Error saving profile changes
Kirjoitti: Looking - maaliskuu 11, 2020, 05:29:36 IP
Sir, did you get a work around? While a fix is implemented for the next update this call to dl() is a real problem for those on shared hosting and have gone passed PHP 5.3 as it has been removed in 5.4 >
Otsikko: Re: Error saving profile changes
Kirjoitti: Sir Osis of Liver - maaliskuu 11, 2020, 09:41:53 IP
Yes, it's fixed.  For reasons unknown, some needed php modules were not selected and mime type check on avatars was not working.  It affected all members.  Crocweb support reset php to default settings and we're good.