Convert GD Resources to objects

This commit is contained in:
Mark 2019-09-27 19:47:24 +02:00 committed by Christoph M. Becker
parent c0a54f41b3
commit 8aad466c42
39 changed files with 758 additions and 1228 deletions

1
NEWS
View file

@ -13,6 +13,7 @@ PHP NEWS
. Fixed bug #69044 (discrepency between time and microtime). (krakjoe)
- GD:
. Replaced gd resources with objects. (Mark Randall)
. Removed deprecated image2wbmp(). (cmb)
. Removed deprecated png2wbmp() and jpeg2wbmp(). (cmb)

View file

@ -136,6 +136,9 @@ PHP 8.0 UPGRADE NOTES
warning.
- GD:
. The GD extension now uses objects as the underlying data structure for
images, rather than resources. These objects are completely opaque, i.e.
they don't have any methods.
. The deprecated function image2wbmp() has been removed.
RFC: https://wiki.php.net/rfc/image2wbmp
. The deprecated functions png2wbmp() and jpeg2wbmp() have been removed.

View file

@ -1,2 +1,2 @@
GD imaging
Rasmus Lerdorf, Stig Bakken, Jim Winstead, Jouni Ahto, Ilia Alshanetsky, Pierre-Alain Joye, Marcus Boerger
Rasmus Lerdorf, Stig Bakken, Jim Winstead, Jouni Ahto, Ilia Alshanetsky, Pierre-Alain Joye, Marcus Boerger, Mark Randall

File diff suppressed because it is too large Load diff

View file

@ -7,262 +7,262 @@ function imageloadfont(string $filename) {}
function imagesetstyle($im, array $styles): bool {}
/** @return resource|false */
/** @return GdImage|false */
function imagecreatetruecolor(int $x_size, int $y_size) {}
function imageistruecolor($im): bool {}
function imageistruecolor(GdImage $im): bool {}
function imagetruecolortopalette($im, bool $ditherFlag, int $colorWanted): bool {}
function imagetruecolortopalette(GdImage $im, bool $ditherFlag, int $colorWanted): bool {}
function imagepalettetotruecolor($im): bool {}
function imagepalettetotruecolor(GdImage $im): bool {}
function imagecolormatch($im1, $im2): bool {}
function imagesetthickness($im, int $thickness): bool {}
function imagesetthickness(GdImage $im, int $thickness): bool {}
function imagefilledellipse($im, int $cx, int $cy, int $w, int $h, int $color): bool {}
function imagefilledellipse(GdImage $im, int $cx, int $cy, int $w, int $h, int $color): bool {}
function imagefilledarc($im, int $cx, int $cy, int $w, int $h, int $s, int $e, int $col, int $style): bool {}
function imagefilledarc(GdImage $im, int $cx, int $cy, int $w, int $h, int $s, int $e, int $col, int $style): bool {}
function imagealphablending($im, bool $blend): bool {}
function imagealphablending(GdImage $im, bool $blend): bool {}
function imagesavealpha($im, bool $save): bool {}
function imagesavealpha(GdImage $im, bool $save): bool {}
function imagelayereffect($im, int $effect): bool {}
function imagelayereffect(GdImage $im, int $effect): bool {}
/** @return int|false */
function imagecolorallocatealpha($im, int $red, int $green, int $blue, int $alpha) {}
function imagecolorallocatealpha(GdImage $im, int $red, int $green, int $blue, int $alpha) {}
/** @return int|false */
function imagecolorresolvealpha($im, int $red, int $green, int $blue, int $alpha) {}
function imagecolorresolvealpha(GdImage $im, int $red, int $green, int $blue, int $alpha) {}
/** @return int|false */
function imagecolorclosestalpha($im, int $red, int $green, int $blue, int $alpha) {}
function imagecolorclosestalpha(GdImage $im, int $red, int $green, int $blue, int $alpha) {}
/** @return int|false */
function imagecolorexactalpha($im, int $red, int $green, int $blue, int $alpha) {}
function imagecolorexactalpha(GdImage $im, int $red, int $green, int $blue, int $alpha) {}
function imagecopyresampled($dst_im, $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_w, int $dst_h, int $src_w, int $src_h): bool {}
function imagecopyresampled(GdImage $dst_im, GdImage $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_w, int $dst_h, int $src_w, int $src_h): bool {}
#ifdef PHP_WIN32
/** @return resource|false */
/** @return GdImage|false */
function imagegrabwindow(int $handle, int $client_area = 0) {}
/** @return resource|false */
/** @return GdImage|false */
function imagegrabscreen() {}
#endif
/** @return resource|false */
function imagerotate($im, float $angle, int $bgdcolor, int $ignoretransparent = 0) {}
/** @return GdImage|false */
function imagerotate(GdImage $im, float $angle, int $bgdcolor, int $ignoretransparent = 0) {}
function imagesettile($im, $tile): bool {}
function imagesettile(GdImage $im, $tile): bool {}
function imagesetbrush($im, $brush): bool {}
function imagesetbrush(GdImage $im, $brush): bool {}
/** @return resource|false */
/** @return GdImage|false */
function imagecreate(int $x_size, int $y_size) {}
function imagetypes(): int {}
/** @return resource|false */
/** @return GdImage|false */
function imagecreatefromstring(string $image) {}
/** @return resource|false */
/** @return GdImage|false */
function imagecreatefromgif(string $filename) {}
#ifdef HAVE_GD_JPG
/** @return resource|false */
/** @return GdImage|false */
function imagecreatefromjpeg(string $filename) {}
#endif
#ifdef HAVE_GD_PNG
/** @return resource|false */
/** @return GdImage|false */
function imagecreatefrompng(string $filename) {}
#endif
#ifdef HAVE_GD_WEBP
/** @return resource|false */
/** @return GdImage|false */
function imagecreatefromwebp(string $filename) {}
#endif
/** @return resource|false */
/** @return GdImage|false */
function imagecreatefromxbm(string $filename) {}
#ifdef HAVE_GD_XPM
/** @return resource|false */
/** @return GdImage|false */
function imagecreatefromxpm(string $filename) {}
#endif
/** @return resource|false */
/** @return GdImage|false */
function imagecreatefromwbmp(string $filename) {}
/** @return resource|false */
/** @return GdImage|false */
function imagecreatefromgd(string $filename) {}
/** @return resource|false */
/** @return GdImage|false */
function imagecreatefromgd2(string $filename) {}
/** @return resource|false */
/** @return GdImage|false */
function imagecreatefromgd2part(string $filename, int $srcX, int $srcY, int $width, int $height) {}
#ifdef HAVE_GD_BMP
/** @return resource|false */
/** @return GdImage|false */
function imagecreatefrombmp(string $filename) {}
#endif
#ifdef HAVE_GD_TGA
/** @return resource|false */
/** @return GdImage|false */
function imagecreatefromtga(string $filename) {}
#endif
function imagexbm($im, ?string $filename, int $foreground = UNKNOWN): bool {}
function imagexbm(GdImage $im, ?string $filename, int $foreground = UNKNOWN): bool {}
function imagegif($im, $to = NULL): bool {}
function imagegif(GdImage $im, $to = NULL): bool {}
#ifdef HAVE_GD_PNG
function imagepng($im, $to = NULL, int $quality = UNKNOWN, int $filters = UNKNOWN): bool {}
function imagepng(GdImage $im, $to = NULL, int $quality = UNKNOWN, int $filters = UNKNOWN): bool {}
#endif
#ifdef HAVE_GD_WEBP
function imagewebp($im, $to = NULL, int $quality = UNKNOWN): bool {}
function imagewebp(GdImage $im, $to = NULL, int $quality = UNKNOWN): bool {}
#endif
#ifdef HAVE_GD_JPG
function imagejpeg($im, $to = NULL, int $quality = UNKNOWN): bool {}
function imagejpeg(GdImage $im, $to = NULL, int $quality = UNKNOWN): bool {}
#endif
function imagewbmp($im, $to = NULL, int $foreground = UNKNOWN): bool {}
function imagewbmp(GdImage $im, $to = NULL, int $foreground = UNKNOWN): bool {}
function imagegd($im, $to = UNKNOWN): bool {}
function imagegd(GdImage $im, $to = UNKNOWN): bool {}
function imagegd2($im, $to = UNKNOWN, int $chunk_size = UNKNOWN, int $type = UNKNOWN): bool {}
function imagegd2(GdImage $im, $to = UNKNOWN, int $chunk_size = UNKNOWN, int $type = UNKNOWN): bool {}
#ifdef HAVE_GD_BMP
function imagebmp($im, $to = NULL, int $compressed = 1): bool {}
function imagebmp(GdImage $im, $to = NULL, int $compressed = 1): bool {}
#endif
function imagedestroy($im): bool {}
function imagedestroy(GdImage $im): bool {}
/** @return int|false */
function imagecolorallocate($im, int $red, int $green, int $blue) {}
function imagecolorallocate(GdImage $im, int $red, int $green, int $blue) {}
function imagepalettecopy($dst, $src): void {}
function imagepalettecopy(GdImage $dst, GdImage $src): void {}
/** @return int|false */
function imagecolorat($im, int $x, int $y) {}
function imagecolorat(GdImage $im, int $x, int $y) {}
/** @return int|false */
function imagecolorclosest($im, int $red, int $green, int $blue) {}
function imagecolorclosest(GdImage $im, int $red, int $green, int $blue) {}
/** @return int|false */
function imagecolorclosesthwb($im, int $red, int $green, int $blue) {}
function imagecolorclosesthwb(GdImage $im, int $red, int $green, int $blue) {}
function imagecolordeallocate($im, int $index): bool {}
function imagecolordeallocate(GdImage $im, int $index): bool {}
/** @return int|false */
function imagecolorresolve($im, int $red, int $green, int $blue) {}
function imagecolorresolve(GdImage $im, int $red, int $green, int $blue) {}
/** @return int|false */
function imagecolorexact($im, int $red, int $green, int $blue) {}
function imagecolorexact(GdImage $im, int $red, int $green, int $blue) {}
/** @return ?false */
function imagecolorset($im, int $color, int $red, int $green, int $blue, int $alpha = 0) {}
function imagecolorset(GdImage $im, int $color, int $red, int $green, int $blue, int $alpha = 0) {}
/** @return array|false */
function imagecolorsforindex($im, int $index) {}
function imagecolorsforindex(GdImage $im, int $index) {}
function imagegammacorrect($im, float $inputgamma, float $outputgamma): bool {}
function imagegammacorrect(GdImage $im, float $inputgamma, float $outputgamma): bool {}
function imagesetpixel($im, int $x, int $y, int $col): bool {}
function imagesetpixel(GdImage $im, int $x, int $y, int $col): bool {}
function imageline($im, int $x1, int $y1, int $x2, int $y2, int $col): bool {}
function imageline(GdImage $im, int $x1, int $y1, int $x2, int $y2, int $col): bool {}
function imagedashedline($im, int $x1, int $y1, int $x2, int $y2, int $col): bool {}
function imagedashedline(GdImage $im, int $x1, int $y1, int $x2, int $y2, int $col): bool {}
function imagerectangle($im, int $x1, int $y1, int $x2, int $y2, int $col): bool {}
function imagerectangle(GdImage $im, int $x1, int $y1, int $x2, int $y2, int $col): bool {}
function imagefilledrectangle($im, int $x1, int $y1, int $x2, int $y2, int $col): bool {}
function imagefilledrectangle(GdImage $im, int $x1, int $y1, int $x2, int $y2, int $col): bool {}
function imagearc($im, int $cx, int $cy, int $w, int $h, int $s, int $e, int $col): bool {}
function imagearc(GdImage $im, int $cx, int $cy, int $w, int $h, int $s, int $e, int $col): bool {}
function imageellipse($im, int $cx, int $cy, int $w, int $h, int $color): bool {}
function imageellipse(GdImage $im, int $cx, int $cy, int $w, int $h, int $color): bool {}
function imagefilltoborder($im, int $x, int $y, int $border, int $col): bool {}
function imagefilltoborder(GdImage $im, int $x, int $y, int $border, int $col): bool {}
function imagefill($im, int $x, int $y, int $col): bool {}
function imagefill(GdImage $im, int $x, int $y, int $col): bool {}
function imagecolorstotal($im): int {}
function imagecolorstotal(GdImage $im): int {}
function imagecolortransparent($im, int $col = UNKNOWN): ?int {}
function imagecolortransparent(GdImage $im, int $col = UNKNOWN): ?int {}
function imageinterlace($im, int $interlace = UNKNOWN): ?int {}
function imageinterlace(GdImage $im, int $interlace = UNKNOWN): ?int {}
function imagepolygon($im, array $points, int $num_pos, int $col): bool {}
function imagepolygon(GdImage $im, array $points, int $num_pos, int $col): bool {}
function imageopenpolygon($im, array $points, int $num_pos, int $col): bool {}
function imageopenpolygon(GdImage $im, array $points, int $num_pos, int $col): bool {}
function imagefilledpolygon($im, array $points, int $num_pos, int $col): bool {}
function imagefilledpolygon(GdImage $im, array $points, int $num_pos, int $col): bool {}
function imagefontwidth(int $font): int {}
function imagefontheight(int $font): int {}
function imagechar($im, int $font, int $x, int $y, string $c, int $col): bool {}
function imagechar(GdImage $im, int $font, int $x, int $y, string $c, int $col): bool {}
function imagecharup($im, int $font, int $x, int $y, string $c, int $col): bool {}
function imagecharup(GdImage $im, int $font, int $x, int $y, string $c, int $col): bool {}
function imagestring($im, int $font, int $x, int $y, string $str, int $col): bool {}
function imagestring(GdImage $im, int $font, int $x, int $y, string $str, int $col): bool {}
function imagestringup($im, int $font, int $x, int $y, string $str, int $col): bool {}
function imagestringup(GdImage $im, int $font, int $x, int $y, string $str, int $col): bool {}
function imagecopy($dst_im, $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h): bool {}
function imagecopy(GdImage $dst_im, GdImage $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h): bool {}
function imagecopymerge($dst_im, $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h, int $pct): bool {}
function imagecopymerge(GdImage $dst_im, GdImage $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h, int $pct): bool {}
function imagecopymergegray($dst_im, $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h, int $pct): bool {}
function imagecopymergegray(GdImage $dst_im, GdImage $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h, int $pct): bool {}
function imagecopyresized($dst_im, $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_w, int $dst_h, int $src_w, int $src_h): bool {}
function imagecopyresized(GdImage $dst_im, GdImage $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_w, int $dst_h, int $src_w, int $src_h): bool {}
function imagesx($im): int {}
function imagesx(GdImage $im): int {}
function imagesy($im): int {}
function imagesy(GdImage $im): int {}
function imagesetclip($im, int $x1, int $x2, int $y1, int $y2): bool {}
function imagesetclip(GdImage $im, int $x1, int $x2, int $y1, int $y2): bool {}
function imagegetclip($im): array {}
function imagegetclip(GdImage $im): array {}
#ifdef HAVE_GD_FREETYPE
/** @return array|false */
function imageftbbox(float $size, float $angle, string $font_file, string $text, array $extrainfo = UNKNOWN) {}
function imagefttext($im, float $size, float $angle, int $x, int $y, int $col, string $font_file, string $text, array $extrainfo = UNKNOWN) {}
function imagefttext(GdImage $im, float $size, float $angle, int $x, int $y, int $col, string $font_file, string $text, array $extrainfo = UNKNOWN) {}
function imagettfbbox(float $size, float $angle, string $font_file, string $text) {}
function imagettftext($im, float $size, float $angle, int $x, int $y, int $col, string $font_file, string $text) {}
function imagettftext(GdImage $im, float $size, float $angle, int $x, int $y, int $col, string $font_file, string $text) {}
#endif
function imagefilter($im, int $filtertype, $arg1 = UNKNOWN, $arg2 = UNKNOWN, $arg3 = UNKNOWN, $arg4 = UNKNOWN): bool {}
function imagefilter(GdImage $im, int $filtertype, $arg1 = UNKNOWN, $arg2 = UNKNOWN, $arg3 = UNKNOWN, $arg4 = UNKNOWN): bool {}
function imageconvolution($im, array $matrix3x3, float $div, float $offset): bool {}
function imageconvolution(GdImage $im, array $matrix3x3, float $div, float $offset): bool {}
function imageflip($im, int $mode): bool {}
function imageflip(GdImage $im, int $mode): bool {}
function imageantialias($im, bool $on): bool {}
function imageantialias(GdImage $im, bool $on): bool {}
/** @return resource|false */
function imagecrop($im, array $rect) {}
/** @return GdImage|false */
function imagecrop(GdImage $im, array $rect) {}
/** @return resource|false */
function imagecropauto($im, int $mode = IMG_CROP_DEFAULT, float $threshold = 0.5, int $color = -1) {}
/** @return GdImage|false */
function imagecropauto(GdImage $im, int $mode = IMG_CROP_DEFAULT, float $threshold = 0.5, int $color = -1) {}
/** @return resource|false */
function imagescale($im, int $new_width, int $new_height = UNKNOWN, int $mode = IMG_BILINEAR_FIXED) {}
/** @return GdImage|false */
function imagescale(GdImage $im, int $new_width, int $new_height = UNKNOWN, int $mode = IMG_BILINEAR_FIXED) {}
/** @return resource|false */
function imageaffine($im, array $affine, array $clip = UNKNOWN) {}
/** @return GdImage|false */
function imageaffine(GdImage $im, array $affine, array $clip = UNKNOWN) {}
/** @return array|false */
function imageaffinematrixget(int $type, $options = UNKNOWN) {}
@ -270,7 +270,7 @@ function imageaffinematrixget(int $type, $options = UNKNOWN) {}
/** @return array|false */
function imageaffinematrixconcat(array $m1, array $m2) {}
function imagesetinterpolation($im, int $method = IMG_BILENEAR_FIXED): bool {}
function imagesetinterpolation(GdImage $im, int $method = IMG_BILENEAR_FIXED): bool {}
/** @return array|true */
function imageresolution($im, int $res_x = UNKNOWN, int $res_y = UNKNOWN) {}
function imageresolution(GdImage $im, int $res_x = UNKNOWN, int $res_y = UNKNOWN) {}

View file

@ -18,11 +18,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecreatetruecolor, 0, 0, 2)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imageistruecolor, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagetruecolortopalette, 0, 3, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, ditherFlag, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, colorWanted, IS_LONG, 0)
ZEND_END_ARG_INFO()
@ -35,12 +35,12 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecolormatch, 0, 2, _IS_BOOL,
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagesetthickness, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, thickness, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagefilledellipse, 0, 6, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, cx, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, cy, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, w, IS_LONG, 0)
@ -49,7 +49,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagefilledellipse, 0, 6, _IS_BO
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagefilledarc, 0, 9, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, cx, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, cy, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, w, IS_LONG, 0)
@ -61,22 +61,22 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagefilledarc, 0, 9, _IS_BOOL,
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagealphablending, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, blend, _IS_BOOL, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagesavealpha, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, save, _IS_BOOL, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagelayereffect, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, effect, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecolorallocatealpha, 0, 0, 5)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, red, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, green, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, blue, IS_LONG, 0)
@ -90,8 +90,8 @@ ZEND_END_ARG_INFO()
#define arginfo_imagecolorexactalpha arginfo_imagecolorallocatealpha
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecopyresampled, 0, 10, _IS_BOOL, 0)
ZEND_ARG_INFO(0, dst_im)
ZEND_ARG_INFO(0, src_im)
ZEND_ARG_OBJ_INFO(0, dst_im, GdImage, 0)
ZEND_ARG_OBJ_INFO(0, src_im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, dst_x, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, dst_y, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, src_x, IS_LONG, 0)
@ -115,19 +115,19 @@ ZEND_END_ARG_INFO()
#endif
ZEND_BEGIN_ARG_INFO_EX(arginfo_imagerotate, 0, 0, 3)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, angle, IS_DOUBLE, 0)
ZEND_ARG_TYPE_INFO(0, bgdcolor, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, ignoretransparent, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagesettile, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_INFO(0, tile)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagesetbrush, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_INFO(0, brush)
ZEND_END_ARG_INFO()
@ -195,19 +195,19 @@ ZEND_END_ARG_INFO()
#endif
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagexbm, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 1)
ZEND_ARG_TYPE_INFO(0, foreground, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagegif, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_INFO(0, to)
ZEND_END_ARG_INFO()
#if defined(HAVE_GD_PNG)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagepng, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_INFO(0, to)
ZEND_ARG_TYPE_INFO(0, quality, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, filters, IS_LONG, 0)
@ -216,7 +216,7 @@ ZEND_END_ARG_INFO()
#if defined(HAVE_GD_WEBP)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagewebp, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_INFO(0, to)
ZEND_ARG_TYPE_INFO(0, quality, IS_LONG, 0)
ZEND_END_ARG_INFO()
@ -224,14 +224,14 @@ ZEND_END_ARG_INFO()
#if defined(HAVE_GD_JPG)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagejpeg, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_INFO(0, to)
ZEND_ARG_TYPE_INFO(0, quality, IS_LONG, 0)
ZEND_END_ARG_INFO()
#endif
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagewbmp, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_INFO(0, to)
ZEND_ARG_TYPE_INFO(0, foreground, IS_LONG, 0)
ZEND_END_ARG_INFO()
@ -239,7 +239,7 @@ ZEND_END_ARG_INFO()
#define arginfo_imagegd arginfo_imagegif
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagegd2, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_INFO(0, to)
ZEND_ARG_TYPE_INFO(0, chunk_size, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
@ -247,7 +247,7 @@ ZEND_END_ARG_INFO()
#if defined(HAVE_GD_BMP)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagebmp, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_INFO(0, to)
ZEND_ARG_TYPE_INFO(0, compressed, IS_LONG, 0)
ZEND_END_ARG_INFO()
@ -256,19 +256,19 @@ ZEND_END_ARG_INFO()
#define arginfo_imagedestroy arginfo_imageistruecolor
ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecolorallocate, 0, 0, 4)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, red, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, green, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, blue, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagepalettecopy, 0, 2, IS_VOID, 0)
ZEND_ARG_INFO(0, dst)
ZEND_ARG_INFO(0, src)
ZEND_ARG_OBJ_INFO(0, dst, GdImage, 0)
ZEND_ARG_OBJ_INFO(0, src, GdImage, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecolorat, 0, 0, 3)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, x, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, y, IS_LONG, 0)
ZEND_END_ARG_INFO()
@ -278,7 +278,7 @@ ZEND_END_ARG_INFO()
#define arginfo_imagecolorclosesthwb arginfo_imagecolorallocate
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecolordeallocate, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
ZEND_END_ARG_INFO()
@ -287,7 +287,7 @@ ZEND_END_ARG_INFO()
#define arginfo_imagecolorexact arginfo_imagecolorallocate
ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecolorset, 0, 0, 5)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, color, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, red, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, green, IS_LONG, 0)
@ -296,25 +296,25 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecolorset, 0, 0, 5)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecolorsforindex, 0, 0, 2)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagegammacorrect, 0, 3, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, inputgamma, IS_DOUBLE, 0)
ZEND_ARG_TYPE_INFO(0, outputgamma, IS_DOUBLE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagesetpixel, 0, 4, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, x, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, y, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, col, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imageline, 0, 6, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, x1, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, y1, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, x2, IS_LONG, 0)
@ -329,7 +329,7 @@ ZEND_END_ARG_INFO()
#define arginfo_imagefilledrectangle arginfo_imageline
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagearc, 0, 8, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, cx, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, cy, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, w, IS_LONG, 0)
@ -342,7 +342,7 @@ ZEND_END_ARG_INFO()
#define arginfo_imageellipse arginfo_imagefilledellipse
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagefilltoborder, 0, 5, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, x, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, y, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, border, IS_LONG, 0)
@ -352,21 +352,21 @@ ZEND_END_ARG_INFO()
#define arginfo_imagefill arginfo_imagesetpixel
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecolorstotal, 0, 1, IS_LONG, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecolortransparent, 0, 1, IS_LONG, 1)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, col, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imageinterlace, 0, 1, IS_LONG, 1)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, interlace, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagepolygon, 0, 4, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, points, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, num_pos, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, col, IS_LONG, 0)
@ -383,7 +383,7 @@ ZEND_END_ARG_INFO()
#define arginfo_imagefontheight arginfo_imagefontwidth
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagechar, 0, 6, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, font, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, x, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, y, IS_LONG, 0)
@ -394,7 +394,7 @@ ZEND_END_ARG_INFO()
#define arginfo_imagecharup arginfo_imagechar
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagestring, 0, 6, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, font, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, x, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, y, IS_LONG, 0)
@ -405,8 +405,8 @@ ZEND_END_ARG_INFO()
#define arginfo_imagestringup arginfo_imagestring
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecopy, 0, 8, _IS_BOOL, 0)
ZEND_ARG_INFO(0, dst_im)
ZEND_ARG_INFO(0, src_im)
ZEND_ARG_OBJ_INFO(0, dst_im, GdImage, 0)
ZEND_ARG_OBJ_INFO(0, src_im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, dst_x, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, dst_y, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, src_x, IS_LONG, 0)
@ -416,8 +416,8 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecopy, 0, 8, _IS_BOOL, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecopymerge, 0, 9, _IS_BOOL, 0)
ZEND_ARG_INFO(0, dst_im)
ZEND_ARG_INFO(0, src_im)
ZEND_ARG_OBJ_INFO(0, dst_im, GdImage, 0)
ZEND_ARG_OBJ_INFO(0, src_im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, dst_x, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, dst_y, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, src_x, IS_LONG, 0)
@ -436,7 +436,7 @@ ZEND_END_ARG_INFO()
#define arginfo_imagesy arginfo_imagecolorstotal
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagesetclip, 0, 5, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, x1, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, x2, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, y1, IS_LONG, 0)
@ -444,7 +444,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagesetclip, 0, 5, _IS_BOOL, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagegetclip, 0, 1, IS_ARRAY, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_END_ARG_INFO()
#if defined(HAVE_GD_FREETYPE)
@ -459,7 +459,7 @@ ZEND_END_ARG_INFO()
#if defined(HAVE_GD_FREETYPE)
ZEND_BEGIN_ARG_INFO_EX(arginfo_imagefttext, 0, 0, 8)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, size, IS_DOUBLE, 0)
ZEND_ARG_TYPE_INFO(0, angle, IS_DOUBLE, 0)
ZEND_ARG_TYPE_INFO(0, x, IS_LONG, 0)
@ -482,7 +482,7 @@ ZEND_END_ARG_INFO()
#if defined(HAVE_GD_FREETYPE)
ZEND_BEGIN_ARG_INFO_EX(arginfo_imagettftext, 0, 0, 8)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, size, IS_DOUBLE, 0)
ZEND_ARG_TYPE_INFO(0, angle, IS_DOUBLE, 0)
ZEND_ARG_TYPE_INFO(0, x, IS_LONG, 0)
@ -494,7 +494,7 @@ ZEND_END_ARG_INFO()
#endif
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagefilter, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, filtertype, IS_LONG, 0)
ZEND_ARG_INFO(0, arg1)
ZEND_ARG_INFO(0, arg2)
@ -503,43 +503,43 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagefilter, 0, 2, _IS_BOOL, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imageconvolution, 0, 4, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, matrix3x3, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, div, IS_DOUBLE, 0)
ZEND_ARG_TYPE_INFO(0, offset, IS_DOUBLE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imageflip, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imageantialias, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, on, _IS_BOOL, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecrop, 0, 0, 2)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, rect, IS_ARRAY, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecropauto, 0, 0, 1)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, threshold, IS_DOUBLE, 0)
ZEND_ARG_TYPE_INFO(0, color, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_imagescale, 0, 0, 2)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, new_width, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, new_height, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_imageaffine, 0, 0, 2)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, affine, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, clip, IS_ARRAY, 0)
ZEND_END_ARG_INFO()
@ -555,12 +555,12 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_imageaffinematrixconcat, 0, 0, 2)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagesetinterpolation, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, method, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_imageresolution, 0, 0, 1)
ZEND_ARG_INFO(0, im)
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
ZEND_ARG_TYPE_INFO(0, res_x, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, res_y, IS_LONG, 0)
ZEND_END_ARG_INFO()

View file

@ -1,215 +0,0 @@
/*
+----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Stanislav Malyshev <stas@php.net> |
+----------------------------------------------------------------------+
*/
#include "php_gd.h"
#define CTX_PUTC(c,ctx) ctx->putC(ctx, c)
static void _php_image_output_putc(struct gdIOCtx *ctx, int c) /* {{{ */
{
/* without the following downcast, the write will fail
* (i.e., will write a zero byte) for all
* big endian architectures:
*/
unsigned char ch = (unsigned char) c;
php_write(&ch, 1);
} /* }}} */
static int _php_image_output_putbuf(struct gdIOCtx *ctx, const void* buf, int l) /* {{{ */
{
return php_write((void *)buf, l);
} /* }}} */
static void _php_image_output_ctxfree(struct gdIOCtx *ctx) /* {{{ */
{
if(ctx) {
efree(ctx);
}
} /* }}} */
static void _php_image_stream_putc(struct gdIOCtx *ctx, int c) /* {{{ */ {
char ch = (char) c;
php_stream * stream = (php_stream *)ctx->data;
php_stream_write(stream, &ch, 1);
} /* }}} */
static int _php_image_stream_putbuf(struct gdIOCtx *ctx, const void* buf, int l) /* {{{ */
{
php_stream * stream = (php_stream *)ctx->data;
return php_stream_write(stream, (void *)buf, l);
} /* }}} */
static void _php_image_stream_ctxfree(struct gdIOCtx *ctx) /* {{{ */
{
if(ctx->data) {
ctx->data = NULL;
}
if(ctx) {
efree(ctx);
}
} /* }}} */
static void _php_image_stream_ctxfreeandclose(struct gdIOCtx *ctx) /* {{{ */
{
if(ctx->data) {
php_stream_close((php_stream *) ctx->data);
ctx->data = NULL;
}
if(ctx) {
efree(ctx);
}
} /* }}} */
/* {{{ _php_image_output_ctx */
static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)())
{
zval *imgind;
char *file = NULL;
size_t file_len = 0;
zend_long quality, basefilter;
zend_bool compressed = 1;
gdImagePtr im;
int argc = ZEND_NUM_ARGS();
int q = -1, i;
int f = -1;
gdIOCtx *ctx = NULL;
zval *to_zval = NULL;
php_stream *stream;
int close_stream = 1;
/* The third (quality) parameter for Wbmp and Xbm stands for the foreground color index when called
* from imagey<type>().
*/
switch (image_type) {
case PHP_GDIMG_TYPE_XBM:
if (zend_parse_parameters(argc, "rp!|ll", &imgind, &file, &file_len, &quality, &basefilter) == FAILURE) {
return;
}
break;
case PHP_GDIMG_TYPE_BMP:
if (zend_parse_parameters(argc, "r|z!b", &imgind, &to_zval, &compressed) == FAILURE) {
return;
}
break;
default:
/* PHP_GDIMG_TYPE_GIF
* PHP_GDIMG_TYPE_PNG
* PHP_GDIMG_TYPE_JPG
* PHP_GDIMG_TYPE_WBM
* PHP_GDIMG_TYPE_WEBP
* */
if (zend_parse_parameters(argc, "r|z!ll", &imgind, &to_zval, &quality, &basefilter) == FAILURE) {
return;
}
}
if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(imgind), "Image", phpi_get_le_gd())) == NULL) {
return;
}
if (image_type != PHP_GDIMG_TYPE_BMP && argc >= 3) {
q = quality; /* or colorindex for foreground of BW images (defaults to black) */
if (argc == 4) {
f = basefilter;
}
}
if (argc > 1 && to_zval != NULL) {
if (Z_TYPE_P(to_zval) == IS_RESOURCE) {
php_stream_from_zval_no_verify(stream, to_zval);
if (stream == NULL) {
RETURN_FALSE;
}
close_stream = 0;
} else if (Z_TYPE_P(to_zval) == IS_STRING) {
if (CHECK_ZVAL_NULL_PATH(to_zval)) {
zend_type_error("Invalid 2nd parameter, filename must not contain null bytes");
return;
}
stream = php_stream_open_wrapper(Z_STRVAL_P(to_zval), "wb", REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL);
if (stream == NULL) {
RETURN_FALSE;
}
} else {
php_error_docref(NULL, E_WARNING, "Invalid 2nd parameter, it must a filename or a stream");
RETURN_FALSE;
}
} else if (argc > 1 && file != NULL) {
stream = php_stream_open_wrapper(file, "wb", REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL);
if (stream == NULL) {
RETURN_FALSE;
}
} else {
ctx = ecalloc(1, sizeof(gdIOCtx));
ctx->putC = _php_image_output_putc;
ctx->putBuf = _php_image_output_putbuf;
ctx->gd_free = _php_image_output_ctxfree;
}
if (!ctx) {
ctx = ecalloc(1, sizeof(gdIOCtx));
ctx->putC = _php_image_stream_putc;
ctx->putBuf = _php_image_stream_putbuf;
if (close_stream) {
ctx->gd_free = _php_image_stream_ctxfreeandclose;
} else {
ctx->gd_free = _php_image_stream_ctxfree;
}
ctx->data = (void *)stream;
}
switch(image_type) {
case PHP_GDIMG_TYPE_JPG:
(*func_p)(im, ctx, q);
break;
case PHP_GDIMG_TYPE_WEBP:
if (q == -1) {
q = 80;
}
(*func_p)(im, ctx, q);
break;
case PHP_GDIMG_TYPE_PNG:
(*func_p)(im, ctx, q, f);
break;
case PHP_GDIMG_TYPE_XBM:
case PHP_GDIMG_TYPE_WBM:
if (argc < 3) {
for(i=0; i < gdImageColorsTotal(im); i++) {
if(!gdImageRed(im, i) && !gdImageGreen(im, i) && !gdImageBlue(im, i)) break;
}
q = i;
}
if (image_type == PHP_GDIMG_TYPE_XBM) {
(*func_p)(im, file ? file : "", q, ctx);
} else {
(*func_p)(im, q, ctx);
}
break;
case PHP_GDIMG_TYPE_BMP:
(*func_p)(im, ctx, (int) compressed);
break;
default:
(*func_p)(im, ctx);
break;
}
ctx->gd_free(ctx);
RETURN_TRUE;
}
/* }}} */

View file

@ -31,7 +31,9 @@ var_dump(imagecreatefromstring($str2));
echo "Done\n";
?>
--EXPECTF--
resource(%d) of type (gd)
resource(%d) of type (gd)
--EXPECT--
object(GdImage)#2 (0) {
}
object(GdImage)#2 (0) {
}
Done

View file

@ -28,8 +28,10 @@ var_dump(imagecrop($img, array("x" => 0x7fffff00, "y" => 0, "width" => 10, "heig
var_dump(imagecrop($img, array("x" => 0, "y" => 0, "width" => 65535, "height" => 65535)));
?>
--EXPECTF--
resource(%d) of type (gd)
resource(%d) of type (gd)
object(GdImage)#2 (0) {
}
object(GdImage)#2 (0) {
}
Array
(
[x] => a
@ -39,11 +41,13 @@ Array
)
Warning: imagecrop(): one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully
in %sbug66356.php on line %d
in %s on line %d
bool(false)
resource(%d) of type (gd)
resource(%d) of type (gd)
object(GdImage)#2 (0) {
}
object(GdImage)#2 (0) {
}
Warning: imagecrop(): product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
in %sbug66356.php on line %d
in %s on line %d
bool(false)

View file

@ -10,4 +10,5 @@ $img = imagerotate(imagecreate(10,10),45,0x7ffffff9);
var_dump($img);
?>
--EXPECT--
resource(5) of type (gd)
object(GdImage)#2 (0) {
}

View file

@ -9,7 +9,6 @@ if (!extension_loaded('gd')) die('skip gd extension not available');
$im = imagecreatefromxbm(__DIR__ . DIRECTORY_SEPARATOR . 'bug73968.xbm');
var_dump($im);
?>
===DONE===
--EXPECTF--
resource(%d) of type (gd)
===DONE===
--EXPECT--
object(GdImage)#1 (0) {
}

View file

@ -21,7 +21,6 @@ for ($i = 0; $i < $width; $i += 16) {
}
}
?>
===DONE===
--EXPECTF--
resource(%d) of type (gd)
===DONE===
--EXPECT--
object(GdImage)#1 (0) {
}

View file

@ -10,9 +10,8 @@ memory_limit=2G
--FILE--
<?php
$im = imagecreate(2**28, 1);
if(is_resource($im)) {
imagescale($im, 1, 1, IMG_TRIANGLE);
}
imagescale($im, 1, 1, IMG_TRIANGLE);
?>
===DONE===
--EXPECTF--

View file

@ -9,7 +9,6 @@ if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.5', '<=')) die('skip upstrea
<?php
var_dump(imagecreatefrombmp(__DIR__ . '/bug77391.bmp'));
?>
===DONE===
--EXPECTF--
resource(%d) of type (gd)
===DONE===
--EXPECT--
object(GdImage)#1 (0) {
}

View file

@ -0,0 +1,20 @@
--TEST--
Checks that GdImage instances cannot be cloned
--SKIPIF--
<?php
if(!extension_loaded('gd')) {
die('skip gd extension is not loaded');
}
?>
--FILE--
<?php
$img_src = imagecreatetruecolor(32, 32);
$img_dst = clone $img_src;
?>
--EXPECTF--
Fatal error: Uncaught Error: Trying to clone an uncloneable object of class GdImage in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d

View file

@ -0,0 +1,21 @@
--TEST--
GdImage instances must not be serialized
--SKIPIF--
<?php
if(!extension_loaded('gd')) {
die('skip gd extension is not loaded');
}
?>
--FILE--
<?php
$img_src = imagecreatetruecolor(32, 32);
var_dump(serialize($img_src));
?>
--EXPECTF--
Fatal error: Uncaught Exception: Serialization of 'GdImage' is not allowed in %s:%d
Stack trace:
#0 %s(%d): serialize(Object(GdImage))
#1 {main}
thrown in %s on line %d

View file

@ -1,21 +0,0 @@
--TEST--
Testing wrong parameter resource in imageantialias() of GD library
--CREDITS--
Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
#testfest PHPSP on 2009-06-20
--SKIPIF--
<?php
if (!extension_loaded("gd")) die("skip GD not present");
?>
--FILE--
<?php
$image = tmpfile();
try {
var_dump(imageantialias($image, true));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
imageantialias(): supplied resource is not a valid Image resource

View file

@ -1,21 +0,0 @@
--TEST--
Testing error on non-image resource parameter 1 of imagechar() of GD library
--CREDITS--
Rafael Dohms <rdohms [at] gmail [dot] com>
#testfest PHPSP on 2009-06-20
--SKIPIF--
<?php
if (!extension_loaded("gd")) die("skip GD not present");
?>
--FILE--
<?php
try {
$result = imagechar(tmpfile(), 1, 5, 5, 'C', 1);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
imagechar(): supplied resource is not a valid Image resource

View file

@ -1,21 +0,0 @@
--TEST--
Testing error on non-image resource parameter 1 of imagecharup() of GD library
--CREDITS--
Rafael Dohms <rdohms [at] gmail [dot] com>
#testfest PHPSP on 2009-06-20
--SKIPIF--
<?php
if (!extension_loaded("gd")) die("skip GD not present");
?>
--FILE--
<?php
try {
$result = imagecharup(tmpfile(), 1, 5, 5, 'C', 1);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
imagecharup(): supplied resource is not a valid Image resource

View file

@ -1,19 +0,0 @@
--TEST--
Testing imagecolorallocatealpha(): Wrong types for parameter 1
--CREDITS--
Rafael Dohms <rdohms [at] gmail [dot] com>
--SKIPIF--
<?php
if (!extension_loaded("gd")) die("skip GD not present");
?>
--FILE--
<?php
$resource = tmpfile();
try {
imagecolorallocatealpha($resource, 255, 255, 255, 50);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
imagecolorallocatealpha(): supplied resource is not a valid Image resource

View file

@ -1,26 +0,0 @@
--TEST--
Testing imagecolordeallocate() of GD library with invalid resource type
--CREDITS--
Rafael Dohms <rdohms [at] gmail [dot] com>
#testfest PHPSP on 2009-06-20
--SKIPIF--
<?php
if (!extension_loaded("gd")) die("skip GD not present");
?>
--FILE--
<?php
$image = imagecreatetruecolor(180, 30);
$white = imagecolorallocate($image, 255, 255, 255);
$resource = tmpfile();
try {
$result = imagecolordeallocate($resource, $white);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
imagecolordeallocate(): supplied resource is not a valid Image resource

View file

@ -9,14 +9,17 @@ Rafael Dohms <rdohms [at] gmail [dot] com>
?>
--FILE--
<?php
require_once __DIR__ . '/func.inc';
$image = imagecreate(180, 30);
$white = imagecolorallocate($image, 255, 255, 255);
$totalColors = imagecolorstotal($image);
$result = imagecolordeallocate($image, $totalColors + 100);
var_dump($result);
trycatch_dump(
fn() => imagecolordeallocate($image, $totalColors + 100)
);
?>
--EXPECTF--
Warning: imagecolordeallocate(): Color index 101 out of range in %s on line %d
bool(false)
--EXPECT--
!! [ValueError] Color index 101 out of range

View file

@ -9,14 +9,17 @@ Rafael Dohms <rdohms [at] gmail [dot] com>
?>
--FILE--
<?php
require_once __DIR__ . '/func.inc';
$image = imagecreate(180, 30);
$white = imagecolorallocate($image, 255, 255, 255);
$totalColors = imagecolorstotal($image);
$result = imagecolordeallocate($image, -1.0);
var_dump($result);
trycatch_dump(
fn() => imagecolordeallocate($image, -1.0)
);
?>
--EXPECTF--
Warning: imagecolordeallocate(): Color index -1 out of range in %s on line %d
bool(false)
--EXPECT--
!! [ValueError] Color index -1 out of range

View file

@ -1,39 +0,0 @@
--TEST--
Test imagecolorstotal() function : error conditions - Pass invalid resource type
--SKIPIF--
<?php
if(!extension_loaded('gd')) {
die('skip gd extension is not loaded');
}
if(!function_exists('imagecolorstotal')) {
die('skip imagecolorstotal function is not available');
}
?>
--FILE--
<?php
/* Prototype : int imagecolorstotal ( resource $image )
* Description: Find out the number of colors in an image's palette
* Source code: ext/gd/gd.c
*/
echo "*** Testing imagecolorstotal() : error conditions ***\n";
// Get a resource
$im = fopen(__FILE__, 'r');
echo "\n-- Testing imagecolorstotal() function with a invalid resource\n";
try {
var_dump( imagecolorstotal($im) );
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
fclose($im);
?>
===DONE===
--EXPECT--
*** Testing imagecolorstotal() : error conditions ***
-- Testing imagecolorstotal() function with a invalid resource
imagecolorstotal(): supplied resource is not a valid Image resource
===DONE===

View file

@ -1,24 +0,0 @@
--TEST--
Testing wrong param passing imageellipse() of GD library
--CREDITS--
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
#testfest PHPSP on 2009-06-20
--SKIPIF--
<?php
if (!extension_loaded("gd")) die("skip GD not present");
?>
--FILE--
<?php
// Create a resource
$image = tmpfile();
// try to draw a white ellipse
try {
imageellipse($image, 200, 150, 300, 200, 16777215);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
imageellipse(): supplied resource is not a valid Image resource

View file

@ -1,31 +0,0 @@
--TEST--
Testing wrong param passing imagefilltoborder() of GD library
--CREDITS--
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
#testfest PHPSP on 2009-06-30
--SKIPIF--
<?php
if (!extension_loaded("gd")) die("skip GD not present");
?>
--FILE--
<?php
// Create a image
$image = imagecreatetruecolor( 100, 100 );
// Draw a rectangle
imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
// Draw an ellipse to fill with a black border
imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
// Try to fill border
$image_foo = tmpfile();
try {
imagefilltoborder( $image_foo, 50, 50, imagecolorallocate( $image, 0, 0, 0 ), imagecolorallocate( $image, 255, 0, 0 ) );
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
imagefilltoborder(): supplied resource is not a valid Image resource

View file

@ -1,21 +0,0 @@
--TEST--
Testing wrong parameter resource of EMBOSS in imagefilter() of GD library
--CREDITS--
Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
#testfest PHPSP on 2009-06-20
--SKIPIF--
<?php
if (!extension_loaded("gd")) die("skip GD not present");
?>
--FILE--
<?php
$image = tmpfile();
try {
var_dump(imagefilter($image, IMG_FILTER_EMBOSS));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
imagefilter(): supplied resource is not a valid Image resource

View file

@ -1,21 +0,0 @@
--TEST--
Testing error with non-Image resource paramenter of imagegammacorrect() of GD library,
--CREDITS--
Rafael Dohms <rdohms [at] gmail [dot] com>
#testfest PHPSP on 2009-06-20
--SKIPIF--
<?php
if (!extension_loaded("gd")) die("skip GD not present");
?>
--FILE--
<?php
$image = tmpfile();
try {
$gamma = imagegammacorrect($image, 1, 5);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
imagegammacorrect(): supplied resource is not a valid Image resource

View file

@ -1,20 +0,0 @@
--TEST--
Testing resource that is not a image to imageinterlace() of GD library
--CREDITS--
Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
#testfest PHPSP on 2009-06-20
--SKIPIF--
<?php
if (!extension_loaded("gd")) die("skip GD not present");
?>
--FILE--
<?php
$image = fopen('php://stdin', 'r');
try {
var_dump(imageinterlace($image));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
imageinterlace(): supplied resource is not a valid Image resource

View file

@ -1,20 +0,0 @@
--TEST--
Testing imageistruecolor(): wrong parameters
--CREDITS--
Rafael Dohms <rdohms [at] gmail [dot] com>
--SKIPIF--
<?php
if (!extension_loaded("gd")) die("skip GD not present");
if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
?>
--FILE--
<?php
$resource = tmpfile();
try {
imageistruecolor($resource);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
imageistruecolor(): supplied resource is not a valid Image resource

View file

@ -1,21 +0,0 @@
--TEST--
Testing imagelayereffect() with invalid resource of GD library
--CREDITS--
Rafael Dohms <rdohms [at] gmail [dot] com>
#testfest PHPSP on 2009-06-20
--SKIPIF--
<?php
if (!extension_loaded("gd")) die("skip GD not present");
if (!GD_BUNDLED) die('skip function only available in bundled, external GD detected');
?>
--FILE--
<?php
$resource = tmpfile();
try {
$layer = imagelayereffect($resource, IMG_EFFECT_REPLACE);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
imagelayereffect(): supplied resource is not a valid Image resource

View file

@ -9,7 +9,7 @@ Carlos André Ferrari <caferrari [at] gmail [dot] com>
--FILE--
<?php
$im = imagecreate(100, 100);
var_dump(is_resource($im));
var_dump($im instanceof GdImage);
var_dump(imageistruecolor($im));
var_dump(imagepalettetotruecolor($im));
var_dump(imageistruecolor($im));

View file

@ -1,19 +0,0 @@
--TEST--
imagepalettetotruecollor must return an error if not an image resource is given
--CREDITS--
Carlos André Ferrari <caferrari [at] gmail [dot] com>
--SKIPIF--
<?php
if (!extension_loaded('gd')) die("skip gd extension not available.");
?>
--FILE--
<?php
$im = fopen('php://memory', 'w');
try {
imagepalettetotruecolor($im);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
imagepalettetotruecolor(): supplied resource is not a valid Image resource

View file

@ -1,23 +0,0 @@
--TEST--
Testing wrong param passing imagerectangle() of GD library
--CREDITS--
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
#testfest PHPSP on 2009-06-30
--SKIPIF--
<?php
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
?>
--FILE--
<?php
// Create a resource
$image = tmpfile();
// Draw a rectangle
try {
imagerectangle( $image, 0, 0, 50, 50, 2 );
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
imagerectangle(): supplied resource is not a valid Image resource

View file

@ -1,19 +0,0 @@
--TEST--
Testing imagetruecolortopalette(): wrong types for first parameter
--CREDITS--
Rafael Dohms <rdohms [at] gmail [dot] com>
--SKIPIF--
<?php
if (!extension_loaded("gd")) die("skip GD not present");
?>
--FILE--
<?php
$resource = tmpfile();
try {
imagesetthickness($resource, 5);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
imagesetthickness(): supplied resource is not a valid Image resource

View file

@ -1,21 +0,0 @@
--TEST--
Testing error on non-image resource parameter 1 of imagestring() of GD library
--CREDITS--
Rafael Dohms <rdohms [at] gmail [dot] com>
#testfest PHPSP on 2009-06-20
--SKIPIF--
<?php
if (!extension_loaded("gd")) die("skip GD not present");
?>
--FILE--
<?php
try {
$result = imagestring(tmpfile(), 1, 5, 5, 'String', 1);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
imagestring(): supplied resource is not a valid Image resource

View file

@ -1,21 +0,0 @@
--TEST--
Testing error on non-image resource parameter 1 of imagestringup() of GD library
--CREDITS--
Rafael Dohms <rdohms [at] gmail [dot] com>
#testfest PHPSP on 2009-06-20
--SKIPIF--
<?php
if (!extension_loaded("gd")) die("skip GD not present");
?>
--FILE--
<?php
try {
$result = imagestringup(tmpfile(), 1, 5, 5, 'String', 1);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
imagestringup(): supplied resource is not a valid Image resource

View file

@ -1,20 +0,0 @@
--TEST--
Testing imagetruecolortopalette(): wrong parameters for parameter 1
--CREDITS--
Rafael Dohms <rdohms [at] gmail [dot] com>
--SKIPIF--
<?php
if (!extension_loaded("gd")) die("skip GD not present");
if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
?>
--FILE--
<?php
$resource = tmpfile();
try {
imagetruecolortopalette($resource, true, 2);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
imagetruecolortopalette(): supplied resource is not a valid Image resource

View file

@ -3,6 +3,7 @@ Test posix_ttyname() with wrong parameters
--DESCRIPTION--
Gets the absolute path to the current terminal device that is open on a given file descriptor.
Source code: ext/posix/posix.c
--CREDITS--
Falko Menge, mail at falko-menge dot de
PHP Testfest Berlin 2009-05-10
@ -11,18 +12,16 @@ PHP Testfest Berlin 2009-05-10
if (!extension_loaded('posix')) {
die('SKIP - POSIX extension not available');
}
if (!extension_loaded('gd')) {
die('SKIP - GD extension not available');
}
if (!function_exists('imagecreate')) {
die('SKIP - Function imagecreate() not available');
if (!function_exists('curl_init')) {
die('SKIP - Function curl_init() not available');
}
?>
--FILE--
<?php
var_dump(posix_ttyname(0)); // param not a ressource
try {
var_dump(posix_ttyname(imagecreate(1, 1))); // wrong resource type
var_dump(posix_ttyname(curl_init())); // wrong resource type
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}