core security update
This commit is contained in:
@@ -207,9 +207,11 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
|
||||
protected $green = array(0, 255, 0, 0);
|
||||
protected $blue = array(0, 0, 255, 0);
|
||||
protected $yellow = array(255, 255, 0, 0);
|
||||
protected $fuchsia = array(255, 0, 255, 0); // Used as background colors.
|
||||
protected $transparent = array(0, 0, 0, 127);
|
||||
protected $white = array(255, 255, 255, 0);
|
||||
protected $transparent = array(0, 0, 0, 127);
|
||||
// Used as rotate background colors.
|
||||
protected $fuchsia = array(255, 0, 255, 0);
|
||||
protected $rotate_transparent = array(255, 255, 255, 127);
|
||||
|
||||
protected $width = 40;
|
||||
protected $height = 20;
|
||||
@@ -275,6 +277,7 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
|
||||
$files = array(
|
||||
'image-test.png',
|
||||
'image-test.gif',
|
||||
'image-test-no-transparency.gif',
|
||||
'image-test.jpg',
|
||||
);
|
||||
|
||||
@@ -334,13 +337,6 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
|
||||
// Systems using non-bundled GD2 don't have imagerotate. Test if available.
|
||||
if (function_exists('imagerotate')) {
|
||||
$operations += array(
|
||||
'rotate_5' => array(
|
||||
'function' => 'rotate',
|
||||
'arguments' => array(5, 0xFF00FF), // Fuchsia background.
|
||||
'width' => 42,
|
||||
'height' => 24,
|
||||
'corners' => array_fill(0, 4, $this->fuchsia),
|
||||
),
|
||||
'rotate_90' => array(
|
||||
'function' => 'rotate',
|
||||
'arguments' => array(90, 0xFF00FF), // Fuchsia background.
|
||||
@@ -348,13 +344,6 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
|
||||
'height' => 40,
|
||||
'corners' => array($this->fuchsia, $this->red, $this->green, $this->blue),
|
||||
),
|
||||
'rotate_transparent_5' => array(
|
||||
'function' => 'rotate',
|
||||
'arguments' => array(5),
|
||||
'width' => 42,
|
||||
'height' => 24,
|
||||
'corners' => array_fill(0, 4, $this->transparent),
|
||||
),
|
||||
'rotate_transparent_90' => array(
|
||||
'function' => 'rotate',
|
||||
'arguments' => array(90),
|
||||
@@ -363,6 +352,49 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
|
||||
'corners' => array($this->transparent, $this->red, $this->green, $this->blue),
|
||||
),
|
||||
);
|
||||
// As of PHP version 5.5, GD uses a different algorithm to rotate images
|
||||
// than version 5.4 and below, resulting in different dimensions.
|
||||
// See https://bugs.php.net/bug.php?id=65148.
|
||||
// For the 40x20 test images, the dimensions resulting from rotation will
|
||||
// be 1 pixel smaller in both width and height in PHP 5.5 and above.
|
||||
// @todo: If and when the PHP bug gets solved, add an upper limit
|
||||
// version check.
|
||||
if (version_compare(PHP_VERSION, '5.5', '>=')) {
|
||||
$operations += array(
|
||||
'rotate_5' => array(
|
||||
'function' => 'rotate',
|
||||
'arguments' => array(5, 0xFF00FF), // Fuchsia background.
|
||||
'width' => 41,
|
||||
'height' => 23,
|
||||
'corners' => array_fill(0, 4, $this->fuchsia),
|
||||
),
|
||||
'rotate_transparent_5' => array(
|
||||
'function' => 'rotate',
|
||||
'arguments' => array(5),
|
||||
'width' => 41,
|
||||
'height' => 23,
|
||||
'corners' => array_fill(0, 4, $this->rotate_transparent),
|
||||
),
|
||||
);
|
||||
}
|
||||
else {
|
||||
$operations += array(
|
||||
'rotate_5' => array(
|
||||
'function' => 'rotate',
|
||||
'arguments' => array(5, 0xFF00FF), // Fuchsia background.
|
||||
'width' => 42,
|
||||
'height' => 24,
|
||||
'corners' => array_fill(0, 4, $this->fuchsia),
|
||||
),
|
||||
'rotate_transparent_5' => array(
|
||||
'function' => 'rotate',
|
||||
'arguments' => array(5),
|
||||
'width' => 42,
|
||||
'height' => 24,
|
||||
'corners' => array_fill(0, 4, $this->rotate_transparent),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Systems using non-bundled GD2 don't have imagefilter. Test if available.
|
||||
@@ -430,6 +462,11 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
|
||||
}
|
||||
// Now check each of the corners to ensure color correctness.
|
||||
foreach ($values['corners'] as $key => $corner) {
|
||||
// The test gif that does not have transparency has yellow where the
|
||||
// others have transparent.
|
||||
if ($file === 'image-test-no-transparency.gif' && $corner === $this->transparent) {
|
||||
$corner = $this->yellow;
|
||||
}
|
||||
// Get the location of the corner.
|
||||
switch ($key) {
|
||||
case 0:
|
||||
|
||||
Reference in New Issue
Block a user