Skip to content

Updating the PHP version of a running project

PHP 4 -> 5.6

imagepng function

# add something
$dummy = imagecolorallocate($im, 255, 255, 255);
imagepng ($im); #
unset($dummy);

$HTTP_SERVER_VARS variable

$HTTP_SERVER_VARS = $_SERVER;

htmlspecialchars function The project was written for the cp1251 encoding. In PHP 5, the function returns an empty string when processing Cyrillic characters.

# fix
htmlspecialchars($str, NULL, 'cp1251');