I can confirm this issue. The solution would be simple: just
handle the special case of 1D polygons by delegating to
gdImagePolygon(); there's nothing to fill anyway.
The attached patch "git-am" does this, but it also breaks several
PHPTs. This demands further investigation on whether this is
caused by major behavioral changes (it doesn't appear so), and
maybe some discussion.