Error: Cannot redeclare imagepalettetotruecolor() on SPIP

Today, I had to migrate a client’s project which used a 2.1.13 version of SPIP.
The old server was running under version 5.3 of PHP while the new server is running PHP version 5.5.

So once everything was migrate, I was confronted with the following error:

PHP Fatal error:  Cannot redeclare imagepalettetotruecolor() in /var/www/foo/htdocs/ecrire/inc/filtres_images_lib_mini.php on line 399

After some googling,  I came across thoses links [1] [2]

[1] http://core.spip.org/projects/spip/repository/revisions/20656
[2] http://core.spip.org/projects/spip/repository/revisions/20658

So here, the modified file ecrire/inc/filtres_images_lib_mini.php

// Transforme une image a palette indexée
// (256 couleurs max) en "vraies" couleurs RGB
// http://doc.spip.org/@imagepalettetotruecolor
if (!function_exists("imagepalettetotruecolor")) {
function imagepalettetotruecolor(&$img) {
if (!$img OR !function_exists('imagecreatetruecolor')) {
return false;
} elseif (!imageistruecolor($img)) {
$w = imagesx($img);
$h = imagesy($img);
$img1 = imagecreatetruecolor($w,$h);

//Conserver la transparence si possible

if(function_exists('ImageCopyResampled')) {
if (function_exists("imageAntiAlias")) imageAntiAlias($img1,true);
@imagealphablending($img1, false);
@imagesavealpha($img1,true);
@ImageCopyResampled($img1, $img, 0, 0, 0, 0, $w, $h, $w, $h);
} else {
imagecopy($img1,$img,0,0,0,0,$w,$h);
}

$img = $img1;
}
return true;
}
}