XF 2.0 Errors with Avatar Import

skotos

Member
On my conversion of a large vB4 database to XF2 I got into the avatar import and found a new error which is 500ing the install process
  • ErrorException: Fatal Error: imagecreatefrompng(): gd-png: fatal libpng error: IDAT: invalid distance too far back
  • src/XF/Image/Gd.php:48
  • Generated by: Sandy
  • Oct 10, 2018 at 5:49 PM
Stack trace
#0 [internal function]: XF::handleFatalError()
#1 {main}
Request state
array(4) {
["url"] => string(21) "/admin.php?import/run"
["referrer"] => string(40) "http://test-xf.rpg.net/admin.php?import/"
["_GET"] => array(1) {
["import/run"] => string(0) ""
}
["_POST"] => array(1) {
["_xfToken"] => string(8) "********"
}
}
This should be the newest versions of XF & the importers, downloaded today.

Thanks.
 
Last edited:
Any help with this? I saw some comments from several months ago about the vB importer's inability to convert avatars without fatal-erroring, but at the time it said there was a fix.

(The error doesn't even show me what image is causing problems, not that I want to have to hand correct every image that the converter can't correctly deal with.)
 
Hmm, I don't think there is much that could be done except skipping the bad file.
Your are using PHP 7 so you could try to wrap the whole switch block (in src/XF/Image/Gd.php lines 24 to 53) in a Try-Catch Block
PHP:
try
{
...
}
catch (\ErrorException)
{
    // smth. went badly wrong while trying to create an image handle
    return false;
}
 
Last edited:
I must admit to a lack of familiarity with PHP 7's try/catch functions, but that unfortunately doesn't work.

try {

[the switch]

}

catch (\ErrorException $e)

{

return false;

}

We get:
  • ErrorException: Fatal Error: imagecreatefrompng(): gd-png: fatal libpng error: IDAT: invalid distance too far back
  • src/XF/Image/Gd.php:50
  • Generated by: ShannonA
  • Oct 12, 2018 at 11:34 AM
Stack trace
#0 [internal function]: XF::handleFatalError()
#1 {main}
Request state
array(4) {
["url"] => string(21) "/admin.php?import/run"
["referrer"] => string(40) "http://test-xf.rpg.net/admin.php?import/"
["_GET"] => array(1) {
["import/run"] => string(0) ""
}
["_POST"] => array(1) {
["_xfToken"] => string(8) "********"
}
}

Thanks very much for your suggestion, @Kirby.

However, I'm starting to become discouraging by the lack of official support here for these import bugs. We're currently in the process of testing out vB5 and XF conversions, and though the interface of XF looks very slick and modern, it's looking like vB5 is going to win by default as the only one that works.
 
Personally I would stay far far ayway from vB 5.

We've converted a couple vBulletin installations to XF so far (another one is scheduled for next week) and havn't hint any showstoppers, though I have to admin that issues like tihs one are not showstoppers for me/us, just issues that have to be dealt with.

Converting a forum from one software to another is always a major process, especially if teh forum is old and large.
If ouy feel unsafe and/or run into problems you might want to consider getting a professional/conversion speciallist doing the conversion, XenForo is well worh it :)
 
For the record, the conversion script was treating all of the avatars as if they were PNG files, even though they were clearly GIFs. I don't know what its logic was, but it's clearly wrong.

Rather than try and figure out why it was wrong, I told it to import them as GIFs by hand:
10a11,12
> $type = IMAGETYPE_GIF;
>
This was apparently exacerbated by a known libGD bug where it throws fatal errors that aren't catchable. It might be that it's fixed in the newest libGD, but not, I believe, the one in Debian Stretch, which makes this conversion bug critical.
 
Top Bottom