Skip to content

Commit c174344

Browse files
committed
Return bool from imageinterlace()
The function accepts a bool since PHP 8.0, so it should also return a bool to keep things consistent. Furthermore a null return from this functions is not possible.
1 parent faf1567 commit c174344

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

ext/gd/gd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2601,7 +2601,7 @@ PHP_FUNCTION(imageinterlace)
26012601
gdImageInterlace(im, INT);
26022602
}
26032603

2604-
RETURN_LONG(gdImageGetInterlaced(im));
2604+
RETURN_BOOL(gdImageGetInterlaced(im));
26052605
}
26062606
/* }}} */
26072607

ext/gd/gd.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ function imagecolorstotal(GdImage $image): int {}
179179

180180
function imagecolortransparent(GdImage $image, ?int $color = null): ?int {}
181181

182-
function imageinterlace(GdImage $image, ?bool $enable = null): ?int {}
182+
function imageinterlace(GdImage $image, ?bool $enable = null): bool {}
183183

184184
function imagepolygon(GdImage $image, array $points, int $num_points_or_color, ?int $color = null): bool {}
185185

ext/gd/gd_arginfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 63898b501cc3ae38585fe0c6f70a9f7865fbee4d */
2+
* Stub hash: 155175c4f5b60aaed37df2210ae6a5e7f979dae2 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gd_info, 0, 0, IS_ARRAY, 0)
55
ZEND_END_ARG_INFO()
@@ -363,7 +363,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecolortransparent, 0, 1, IS_
363363
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, color, IS_LONG, 1, "null")
364364
ZEND_END_ARG_INFO()
365365

366-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imageinterlace, 0, 1, IS_LONG, 1)
366+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imageinterlace, 0, 1, _IS_BOOL, 0)
367367
ZEND_ARG_OBJ_INFO(0, image, GdImage, 0)
368368
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, enable, _IS_BOOL, 1, "null")
369369
ZEND_END_ARG_INFO()

ext/gd/tests/bug77700.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ if (!extension_loaded('gd')) die('skip gd extension not available');
88
<?php
99
$im = imagecreatetruecolor(10, 10);
1010
imagefilledrectangle($im, 0, 0, 9, 9, imagecolorallocate($im, 255, 255, 255));
11-
imageinterlace($im, 1);
11+
imageinterlace($im, true);
1212
imagegif($im, __DIR__ . 'bug77700.gif');
1313

1414
$im = imagecreatefromgif(__DIR__ . 'bug77700.gif');
1515
var_dump(imageinterlace($im));
1616
?>
1717
--EXPECT--
18-
int(1)
18+
bool(true)
1919
--CLEAN--
2020
<?php
2121
unlink(__DIR__ . 'bug77700.gif');

ext/gd/tests/imageinterlace_basic.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ $image = imagecreatetruecolor(100, 100);
1414
var_dump(imageinterlace($image));
1515
?>
1616
--EXPECT--
17-
int(0)
17+
bool(false)

ext/gd/tests/imageinterlace_variation1.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ if (!extension_loaded("gd")) die("skip GD not present");
1212

1313
$image = imagecreatetruecolor(100, 100);
1414

15-
var_dump(imageinterlace($image, 1));
15+
var_dump(imageinterlace($image, true));
1616
var_dump(imageinterlace($image));
1717
?>
1818
--EXPECT--
19-
int(1)
20-
int(1)
19+
bool(true)
20+
bool(true)

ext/gd/tests/imageinterlace_variation2.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ if (!extension_loaded("gd")) die("skip GD not present");
1313
$image = imagecreatetruecolor(100, 100);
1414

1515
//setting the interlace bit to on
16-
imageinterlace($image, 1);
16+
imageinterlace($image, true);
1717

1818
//setting de interlace bit to off
19-
var_dump(imageinterlace($image, 0));
19+
var_dump(imageinterlace($image, false));
2020
var_dump(imageinterlace($image));
2121
?>
2222
--EXPECT--
23-
int(0)
24-
int(0)
23+
bool(false)
24+
bool(false)

0 commit comments

Comments
 (0)