Skip to content

Commit 76f421d

Browse files
committed
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1: Fix #52070: imagedashedline() - dashed line sometimes is not visible
2 parents 8b642af + 9c37d95 commit 76f421d

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ PHP NEWS
1414
too long). (Jacob Hipps)
1515
. Fixed incorrect write to getenv result in FPM reload. (Jakub Zelenka)
1616

17+
- GD:
18+
. Fixed bug #52070 (imagedashedline() - dashed line sometimes is not visible).
19+
(cmb)
20+
1721
- mbstring:
1822
. Fixed bug #75944 (Wrong cp1251 detection). (dmk001)
1923
. Fixed bug #76113 (mbstring does not build with Oniguruma 6.8.1).

ext/gd/libgd/gd.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,6 @@ void gdImageDashedLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color
13381338
} else {
13391339
wid = 1;
13401340
}
1341-
wid = (int)(thick * sin(atan2(dy, dx)));
13421341
vert = 1;
13431342

13441343
d = 2 * dy - dx;

ext/gd/tests/bug52070.phpt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
Bug #52070 (imagedashedline() - dashed line sometimes is not visible)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('gd')) die('skip gd extension not available');
6+
?>
7+
--FILE--
8+
<?php
9+
$im = imagecreate(1200, 800);
10+
$background_color = imagecolorallocate($im, 40, 40, 40);
11+
$color = imagecolorallocate($im, 255, 255, 255);
12+
imagedashedline($im, 800, 400, 300, 400, $color);
13+
imagedashedline($im, 800, 400, 300, 800, $color);
14+
imagedashedline($im, 800, 400, 400, 800, $color);
15+
imagedashedline($im, 800, 400, 500, 800, $color);
16+
imagedashedline($im, 800, 400, 600, 800, $color);
17+
imagedashedline($im, 800, 400, 700, 800, $color);
18+
imagedashedline($im, 800, 400, 800, 800, $color);
19+
include_once __DIR__ . '/func.inc';
20+
test_image_equals_file(__DIR__ . '/bug52070.png', $im);
21+
?>
22+
===DONE===
23+
--EXPECT--
24+
The images are equal.
25+
===DONE===

ext/gd/tests/bug52070.png

2.17 KB
Loading

0 commit comments

Comments
 (0)