diff options
Diffstat (limited to 'ext/gd')
173 files changed, 491 insertions, 3110 deletions
diff --git a/ext/gd/config.m4 b/ext/gd/config.m4 index 498d870785..c1b96fa812 100644 --- a/ext/gd/config.m4 +++ b/ext/gd/config.m4 @@ -4,213 +4,122 @@ dnl dnl Configure options dnl -PHP_ARG_WITH(gd, for GD support, -[ --with-gd[=DIR] Include GD support. DIR is the GD library base - install directory [BUNDLED]]) -if test -z "$PHP_WEBP_DIR"; then - PHP_ARG_WITH(webp-dir, for the location of libwebp, - [ --with-webp-dir[=DIR] GD: Set the path to libwebp install prefix], no, no) +PHP_ARG_ENABLE([gd], + [for GD support], + [AS_HELP_STRING([--enable-gd], + [Include GD support])]) + +PHP_ARG_WITH([external-gd], + [for external libgd], + [AS_HELP_STRING([--with-external-gd], + [Use external libgd])], + [no], + [no]) + +if test -z "$PHP_WEBP"; then + PHP_ARG_WITH([webp], + [for libwebp], + [AS_HELP_STRING([--with-webp], + [GD: Enable WEBP support])], + [no], + [no]) fi -if test -z "$PHP_JPEG_DIR"; then - PHP_ARG_WITH(jpeg-dir, for the location of libjpeg, - [ --with-jpeg-dir[=DIR] GD: Set the path to libjpeg install prefix], no, no) +if test -z "$PHP_JPEG"; then + PHP_ARG_WITH([jpeg], + [for libjpeg], + [AS_HELP_STRING([--with-jpeg], + [GD: Enable JPEG support])], + [no], + [no]) fi -if test -z "$PHP_PNG_DIR"; then - PHP_ARG_WITH(png-dir, for the location of libpng, - [ --with-png-dir[=DIR] GD: Set the path to libpng install prefix], no, no) -fi - -if test -z "$PHP_ZLIB_DIR"; then - PHP_ARG_WITH(zlib-dir, for the location of libz, - [ --with-zlib-dir[=DIR] GD: Set the path to libz install prefix], no, no) -fi - -PHP_ARG_WITH(xpm-dir, for the location of libXpm, -[ --with-xpm-dir[=DIR] GD: Set the path to libXpm install prefix], no, no) - -PHP_ARG_WITH(freetype-dir, for FreeType 2, -[ --with-freetype-dir[=DIR] GD: Set the path to FreeType 2 install prefix], no, no) - -PHP_ARG_ENABLE(gd-jis-conv, whether to enable JIS-mapped Japanese font support in GD, -[ --enable-gd-jis-conv GD: Enable JIS-mapped Japanese font support], no, no) +PHP_ARG_WITH([xpm], + [for libXpm], + [AS_HELP_STRING([--with-xpm], + [GD: Enable XPM support])], + [no], + [no]) + +PHP_ARG_WITH([freetype], + [for FreeType 2], + [AS_HELP_STRING([--with-freetype], + [GD: Enable FreeType 2 support])], + [no], + [no]) + +PHP_ARG_ENABLE([gd-jis-conv], + [whether to enable JIS-mapped Japanese font support in GD], + [AS_HELP_STRING([--enable-gd-jis-conv], + [GD: Enable JIS-mapped Japanese font support])], + [no], + [no]) dnl dnl Checks for the configure options dnl +dnl zlib is always required AC_DEFUN([PHP_GD_ZLIB],[ - if test "$PHP_ZLIB_DIR" != "no" && test "$PHP_ZLIB_DIR" != "yes"; then - if test -f "$PHP_ZLIB_DIR/include/zlib/zlib.h"; then - PHP_ZLIB_DIR="$PHP_ZLIB_DIR" - PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include/zlib" - elif test -f "$PHP_ZLIB_DIR/include/zlib.h"; then - PHP_ZLIB_DIR="$PHP_ZLIB_DIR" - PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include" - else - AC_MSG_ERROR([Can't find zlib headers under "$PHP_ZLIB_DIR"]) - fi - else - for i in /usr/local /usr; do - if test -f "$i/include/zlib/zlib.h"; then - PHP_ZLIB_DIR="$i" - PHP_ZLIB_INCDIR="$i/include/zlib" - elif test -f "$i/include/zlib.h"; then - PHP_ZLIB_DIR="$i" - PHP_ZLIB_INCDIR="$i/include" - fi - done - fi + PKG_CHECK_MODULES([ZLIB], [zlib]) + PHP_EVAL_LIBLINE($ZLIB_LIBS, GD_SHARED_LIBADD) + PHP_EVAL_INCLINE($ZLIB_CFLAGS) ]) -AC_DEFUN([PHP_GD_WEBP],[ - if test "$PHP_WEBP_DIR" != "no"; then - - for i in $PHP_WEBP_DIR /usr/local /usr; do - test -f $i/include/webp/decode.h && GD_WEBP_DIR=$i && break - done - - if test -z "$GD_WEBP_DIR"; then - AC_MSG_ERROR([webp/decode.h not found.]) - fi - - for i in $PHP_WEBP_DIR /usr/local /usr; do - test -f $i/include/webp/encode.h && GD_WEBP_DIR=$i && break - done - - if test -z "$GD_WEBP_DIR"; then - AC_MSG_ERROR([webp/encode.h not found.]) - fi - - PHP_CHECK_LIBRARY(webp,WebPGetInfo, - [ - PHP_ADD_INCLUDE($GD_WEBP_DIR/include) - PHP_ADD_LIBRARY(pthread) - PHP_ADD_LIBRARY_WITH_PATH(webp, $GD_WEBP_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD) - ],[ - AC_MSG_ERROR([Problem with libwebp.(a|so). Please check config.log for more information.]) - ],[ - -L$GD_WEBP_DIR/$PHP_LIBDIR - ]) - else - AC_MSG_RESULT([If configure fails try --with-webp-dir=<DIR>]) - fi +dnl libpng is always required +AC_DEFUN([PHP_GD_PNG],[ + PKG_CHECK_MODULES([PNG], [libpng]) + PHP_EVAL_LIBLINE($PNG_LIBS, GD_SHARED_LIBADD) + PHP_EVAL_INCLINE($PNG_CFLAGS) + AC_DEFINE(HAVE_LIBPNG, 1, [ ]) ]) -AC_DEFUN([PHP_GD_JPEG],[ - if test "$PHP_JPEG_DIR" != "no"; then - - for i in $PHP_JPEG_DIR /usr/local /usr; do - test -f $i/include/jpeglib.h && GD_JPEG_DIR=$i && break - done - - if test -z "$GD_JPEG_DIR"; then - AC_MSG_ERROR([jpeglib.h not found.]) - fi - - PHP_CHECK_LIBRARY(jpeg,jpeg_read_header, - [ - PHP_ADD_INCLUDE($GD_JPEG_DIR/include) - PHP_ADD_LIBRARY_WITH_PATH(jpeg, $GD_JPEG_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD) - ],[ - AC_MSG_ERROR([Problem with libjpeg.(a|so). Please check config.log for more information.]) - ],[ - -L$GD_JPEG_DIR/$PHP_LIBDIR - ]) - else - AC_MSG_RESULT([If configure fails try --with-jpeg-dir=<DIR>]) +AC_DEFUN([PHP_GD_WEBP],[ + if test "$PHP_WEBP" != "no"; then + PKG_CHECK_MODULES([WEBP], [libwebp]) + PHP_EVAL_LIBLINE($WEBP_LIBS, GD_SHARED_LIBADD) + PHP_EVAL_INCLINE($WEBP_CFLAGS) + AC_DEFINE(HAVE_LIBWEBP, 1, [ ]) + AC_DEFINE(HAVE_GD_WEBP, 1, [ ]) fi ]) -AC_DEFUN([PHP_GD_PNG],[ - if test "$PHP_PNG_DIR" != "no"; then - - for i in $PHP_PNG_DIR /usr/local /usr; do - test -f $i/include/png.h && GD_PNG_DIR=$i && break - done - - if test -z "$GD_PNG_DIR"; then - AC_MSG_ERROR([png.h not found.]) - fi - - if test "$PHP_ZLIB_DIR" = "no"; then - AC_MSG_ERROR([PNG support requires ZLIB. Use --with-zlib-dir=<DIR>]) - fi - - PHP_CHECK_LIBRARY(png,png_write_image, - [ - PHP_ADD_INCLUDE($GD_PNG_DIR/include) - PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD) - PHP_ADD_LIBRARY_WITH_PATH(png, $GD_PNG_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD) - ],[ - AC_MSG_ERROR([Problem with libpng.(a|so) or libz.(a|so). Please check config.log for more information.]) - ],[ - -L$PHP_ZLIB_DIR/$PHP_LIBDIR -lz -L$GD_PNG_DIR/$PHP_LIBDIR - ]) - - else - AC_MSG_RESULT([If configure fails try --with-png-dir=<DIR> and --with-zlib-dir=<DIR>]) +AC_DEFUN([PHP_GD_JPEG],[ + if test "$PHP_JPEG" != "no"; then + PKG_CHECK_MODULES([JPEG], [libjpeg]) + PHP_EVAL_LIBLINE($JPEG_LIBS, GD_SHARED_LIBADD) + PHP_EVAL_INCLINE($JPEG_CFLAGS) + AC_DEFINE(HAVE_LIBJPEG, 1, [ ]) + AC_DEFINE(HAVE_GD_JPG, 1, [ ]) fi ]) AC_DEFUN([PHP_GD_XPM],[ - if test "$PHP_XPM_DIR" != "no"; then - - for i in $PHP_XPM_DIR /usr/local /usr/X11R6 /usr; do - test -f $i/include/xpm.h && GD_XPM_DIR=$i && GD_XPM_INC=$i && break - test -f $i/include/X11/xpm.h && GD_XPM_DIR=$i && GD_XPM_INC=$i/X11 && break - done - - if test -z "$GD_XPM_DIR"; then - AC_MSG_ERROR([xpm.h not found.]) - fi - - PHP_CHECK_LIBRARY(Xpm,XpmFreeXpmImage, - [ - PHP_ADD_INCLUDE($GD_XPM_INC) - PHP_ADD_LIBRARY_WITH_PATH(Xpm, $GD_XPM_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD) - PHP_ADD_LIBRARY_WITH_PATH(X11, $GD_XPM_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD) - ],[ - AC_MSG_ERROR([Problem with libXpm.(a|so) or libX11.(a|so). Please check config.log for more information.]) - ],[ - -L$GD_XPM_DIR/$PHP_LIBDIR -lX11 - ]) - else - AC_MSG_RESULT(If configure fails try --with-xpm-dir=<DIR>) + if test "$PHP_XPM" != "no"; then + PKG_CHECK_MODULES([XPM], [xpm]) + PHP_EVAL_LIBLINE($XPM_LIBS, GD_SHARED_LIBADD) + PHP_EVAL_INCLINE($XPM_CFLAGS) + AC_DEFINE(HAVE_XPM, 1, [ ]) + AC_DEFINE(HAVE_GD_XPM, 1, [ ]) fi ]) AC_DEFUN([PHP_GD_FREETYPE2],[ - if test "$PHP_FREETYPE_DIR" != "no"; then - - for i in $PHP_FREETYPE_DIR /usr/local /usr; do - if test -f "$i/bin/freetype-config"; then - FREETYPE2_DIR=$i - FREETYPE2_CONFIG="$i/bin/freetype-config" - break - fi - done - - if test -z "$FREETYPE2_DIR"; then - AC_MSG_ERROR([freetype-config not found.]) - fi - - FREETYPE2_CFLAGS=`$FREETYPE2_CONFIG --cflags` - FREETYPE2_LIBS=`$FREETYPE2_CONFIG --libs` + if test "$PHP_FREETYPE" != "no"; then + PKG_CHECK_MODULES([FREETYPE2], [freetype2], [FREETYPE2_FOUND=true]) PHP_EVAL_INCLINE($FREETYPE2_CFLAGS) PHP_EVAL_LIBLINE($FREETYPE2_LIBS, GD_SHARED_LIBADD) - AC_DEFINE(HAVE_LIBFREETYPE,1,[ ]) - AC_DEFINE(ENABLE_GD_TTF,1,[ ]) - else - AC_MSG_RESULT([If configure fails try --with-freetype-dir=<DIR>]) + AC_DEFINE(HAVE_LIBFREETYPE, 1, [ ]) + AC_DEFINE(HAVE_GD_FREETYPE, 1, [ ]) + AC_DEFINE(ENABLE_GD_TTF, 1, [ ]) fi ]) AC_DEFUN([PHP_GD_JISX0208],[ if test "$PHP_GD_JIS_CONV" = "yes"; then - USE_GD_JIS_CONV=1 + AC_DEFINE(USE_GD_JISX0208, 1, [ ]) + AC_DEFINE(JISX0208, 1, [ ]) fi ]) @@ -228,141 +137,64 @@ dnl dnl Main GD configure dnl -dnl -dnl Common for both builtin and external GD -dnl if test "$PHP_GD" != "no"; then -dnl PNG is required by GD library - test "$PHP_PNG_DIR" = "no" && PHP_PNG_DIR=yes - -dnl Various checks for GD features - PHP_GD_ZLIB - PHP_GD_WEBP - PHP_GD_JPEG - PHP_GD_PNG - PHP_GD_XPM - PHP_GD_FREETYPE2 - PHP_GD_JISX0208 -fi - -if test "$PHP_GD" = "yes"; then - GD_MODULE_TYPE=builtin - extra_sources="libgd/gd.c libgd/gd_gd.c libgd/gd_gd2.c libgd/gd_io.c libgd/gd_io_dp.c \ - libgd/gd_io_file.c libgd/gd_ss.c libgd/gd_io_ss.c libgd/gd_webp.c \ - libgd/gd_png.c libgd/gd_jpeg.c libgd/gdxpm.c libgd/gdfontt.c libgd/gdfonts.c \ - libgd/gdfontmb.c libgd/gdfontl.c libgd/gdfontg.c libgd/gdtables.c libgd/gdft.c \ - libgd/gdcache.c libgd/gdkanji.c libgd/wbmp.c libgd/gd_wbmp.c libgd/gdhelpers.c \ - libgd/gd_topal.c libgd/gd_gif_in.c libgd/gd_xbm.c libgd/gd_gif_out.c libgd/gd_security.c \ - libgd/gd_filter.c libgd/gd_pixelate.c libgd/gd_rotate.c libgd/gd_color_match.c \ - libgd/gd_transform.c libgd/gd_crop.c libgd/gd_interpolation.c libgd/gd_matrix.c \ - libgd/gd_bmp.c" + if test "$PHP_EXTERNAL_GD" = "no"; then + GD_CFLAGS="" + extra_sources="libgd/gd.c libgd/gd_gd.c libgd/gd_gd2.c libgd/gd_io.c libgd/gd_io_dp.c \ + libgd/gd_io_file.c libgd/gd_ss.c libgd/gd_io_ss.c libgd/gd_webp.c \ + libgd/gd_png.c libgd/gd_jpeg.c libgd/gdxpm.c libgd/gdfontt.c libgd/gdfonts.c \ + libgd/gdfontmb.c libgd/gdfontl.c libgd/gdfontg.c libgd/gdtables.c libgd/gdft.c \ + libgd/gdcache.c libgd/gdkanji.c libgd/wbmp.c libgd/gd_wbmp.c libgd/gdhelpers.c \ + libgd/gd_topal.c libgd/gd_gif_in.c libgd/gd_xbm.c libgd/gd_gif_out.c libgd/gd_security.c \ + libgd/gd_filter.c libgd/gd_pixelate.c libgd/gd_rotate.c libgd/gd_color_match.c \ + libgd/gd_transform.c libgd/gd_crop.c libgd/gd_interpolation.c libgd/gd_matrix.c \ + libgd/gd_bmp.c" dnl check for fabsf and floorf which are available since C99 - AC_CHECK_FUNCS(fabsf floorf) + AC_CHECK_FUNCS(fabsf floorf) dnl These are always available with bundled library - AC_DEFINE(HAVE_GD_BUNDLED, 1, [ ]) - AC_DEFINE(HAVE_GD_PNG, 1, [ ]) - AC_DEFINE(HAVE_GD_BMP, 1, [ ]) - AC_DEFINE(HAVE_GD_CACHE_CREATE, 1, [ ]) - -dnl Make sure the libgd/ is first in the include path - GDLIB_CFLAGS="-DHAVE_LIBPNG" - -dnl Depending which libraries were included to PHP configure, -dnl enable the support in bundled GD library - - if test -n "$GD_WEBP_DIR"; then - AC_DEFINE(HAVE_GD_WEBP, 1, [ ]) - GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBWEBP" - fi - - if test -n "$GD_JPEG_DIR"; then - AC_DEFINE(HAVE_GD_JPG, 1, [ ]) - GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBJPEG" - fi - - if test -n "$GD_XPM_DIR"; then - AC_DEFINE(HAVE_GD_XPM, 1, [ ]) - GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_XPM" - fi - - if test -n "$FREETYPE2_DIR"; then - AC_DEFINE(HAVE_GD_FREETYPE, 1, [ ]) - AC_DEFINE(ENABLE_GD_TTF, 1, [ ]) - GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBFREETYPE -DENABLE_GD_TTF" - fi - - if test -n "$USE_GD_JIS_CONV"; then - AC_DEFINE(USE_GD_JISX0208, 1, [ ]) - GDLIB_CFLAGS="$GDLIB_CFLAGS -DJISX0208" - fi - -else - - if test "$PHP_GD" != "no"; then - GD_MODULE_TYPE=external - extra_sources="gd_compat.c" + AC_DEFINE(HAVE_GD_BUNDLED, 1, [ ]) + AC_DEFINE(HAVE_GD_PNG, 1, [ ]) + AC_DEFINE(HAVE_GD_BMP, 1, [ ]) dnl Various checks for GD features - PHP_GD_ZLIB - PHP_GD_WEBP - PHP_GD_JPEG - PHP_GD_PNG - PHP_GD_XPM - PHP_GD_FREETYPE2 - -dnl Header path - for i in include/gd include/gd2 include gd ""; do - test -f "$PHP_GD/$i/gd.h" && GD_INCLUDE="$PHP_GD/$i" - done - - if test -z "$GD_INCLUDE"; then - AC_MSG_ERROR([Unable to find gd.h anywhere under $PHP_GD]) - fi - -dnl Library path - - PHP_CHECK_LIBRARY(gd, gdSetErrorMethod, - [ - PHP_ADD_LIBRARY_WITH_PATH(gd, $PHP_GD/$PHP_LIBDIR, GD_SHARED_LIBADD) - AC_DEFINE(HAVE_LIBGD, 1, [ ]) - ],[ - AC_MSG_ERROR([Unable to find libgd.(a|so) >= 2.1.0 anywhere under $PHP_GD]) - ],[ - -L$PHP_GD/$PHP_LIBDIR - ]) - PHP_GD_CHECK_VERSION - - PHP_EXPAND_PATH($GD_INCLUDE, GD_INCLUDE) - fi -fi - -dnl -dnl Common for both builtin and external GD -dnl -if test "$PHP_GD" != "no"; then - PHP_NEW_EXTENSION(gd, gd.c $extra_sources, $ext_shared,, \\$(GDLIB_CFLAGS)) - - if test "$GD_MODULE_TYPE" = "builtin"; then + PHP_GD_ZLIB + PHP_GD_PNG + PHP_GD_WEBP + PHP_GD_JPEG + PHP_GD_XPM + PHP_GD_FREETYPE2 + PHP_GD_JISX0208 + + PHP_NEW_EXTENSION(gd, gd.c $extra_sources, $ext_shared,, \\$(GD_CFLAGS)) PHP_ADD_BUILD_DIR($ext_builddir/libgd) - GDLIB_CFLAGS="-I$ext_srcdir/libgd $GDLIB_CFLAGS" + GD_CFLAGS="-I$ext_srcdir/libgd $GD_CFLAGS" GD_HEADER_DIRS="ext/gd/ ext/gd/libgd/" PHP_TEST_BUILD(foobar, [], [ AC_MSG_ERROR([GD build test failed. Please check the config.log for details.]) ], [ $GD_SHARED_LIBADD ], [char foobar () {}]) + else + extra_sources="gd_compat.c" + PKG_CHECK_MODULES([GDLIB], [gdlib >= 2.1.0]) + PHP_EVAL_LIBLINE($GDLIB_LIBS, GD_SHARED_LIBADD) + PHP_EVAL_INCLINE($GDLIB_CFLAGS) + AC_DEFINE(HAVE_LIBGD, 1, [ ]) + PHP_GD_CHECK_VERSION + + PHP_NEW_EXTENSION(gd, gd.c $extra_sources, $ext_shared) GD_HEADER_DIRS="ext/gd/" - GDLIB_CFLAGS="-I$GD_INCLUDE $GDLIB_CFLAGS" - PHP_ADD_INCLUDE($GD_INCLUDE) PHP_CHECK_LIBRARY(gd, gdImageCreate, [], [ AC_MSG_ERROR([GD build test failed. Please check the config.log for details.]) ], [ $GD_SHARED_LIBADD ]) fi PHP_INSTALL_HEADERS([$GD_HEADER_DIRS]) + PHP_SUBST(GD_CFLAGS) PHP_SUBST(GDLIB_CFLAGS) + PHP_SUBST(GDLIB_LIBS) PHP_SUBST(GD_SHARED_LIBADD) fi diff --git a/ext/gd/gd.c b/ext/gd/gd.c index ca9fdf51a7..f9319cf830 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2018 The PHP Group | + | 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 | @@ -2592,10 +2592,9 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char FILE *fp; size_t file_len = 0; int argc = ZEND_NUM_ARGS(); - int q = -1, i, t = 1; + int q = -1, t = 1; /* The quality parameter for Wbmp stands for the foreground when called from image2wbmp() */ - /* When called from imagewbmp() the quality parameter stands for the foreground color. Default: black. */ /* The quality parameter for gd2 stands for chunk size */ if (zend_parse_parameters(argc, "r|pll", &imgind, &file, &file_len, &quality, &type) == FAILURE) { @@ -2635,15 +2634,6 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char } gdImageWBMP(im, q, fp); break; - case PHP_GDIMG_TYPE_JPG: - (*func_p)(im, fp, q); - break; - case PHP_GDIMG_TYPE_WBM: - for (i = 0; i < gdImageColorsTotal(im); i++) { - if (gdImageRed(im, i) == 0) break; - } - (*func_p)(im, i, fp); - break; case PHP_GDIMG_TYPE_GD: (*func_p)(im, fp); break; @@ -2654,11 +2644,7 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char (*func_p)(im, fp, q, t); break; default: - if (q == -1) { - q = 128; - } - (*func_p)(im, fp, q, t); - break; + ZEND_ASSERT(0); } fflush(fp); fclose(fp); @@ -2684,17 +2670,6 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char } gdImageWBMP(im, q, tmp); break; - case PHP_GDIMG_TYPE_JPG: - (*func_p)(im, tmp, q); - break; - case PHP_GDIMG_TYPE_WBM: - for (i = 0; i < gdImageColorsTotal(im); i++) { - if (gdImageRed(im, i) == 0) { - break; - } - } - (*func_p)(im, q, tmp); - break; case PHP_GDIMG_TYPE_GD: (*func_p)(im, tmp); break; @@ -2705,8 +2680,7 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char (*func_p)(im, tmp, q, t); break; default: - (*func_p)(im, tmp); - break; + ZEND_ASSERT(0); } fseek(tmp, 0, SEEK_SET); @@ -4689,12 +4663,12 @@ PHP_FUNCTION(imagecrop) } /* }}} */ -/* {{{ proto resource imagecropauto(resource im [, int mode [, float threshold [, int color]]]) +/* {{{ proto resource imagecropauto(resource im [, int mode = GD_CROP_DEFAULT [, float threshold [, int color]]]) Crop an image automatically using one of the available modes. */ PHP_FUNCTION(imagecropauto) { zval *IM; - zend_long mode = -1; + zend_long mode = GD_CROP_DEFAULT; zend_long color = -1; double threshold = 0.5f; gdImagePtr im; @@ -4710,7 +4684,9 @@ PHP_FUNCTION(imagecropauto) switch (mode) { case -1: + php_error_docref(NULL, E_DEPRECATED, "Crop mode -1 is deprecated. Use IMG_CROP_DEFAULT instead."); mode = GD_CROP_DEFAULT; + /* FALLTHRU */ case GD_CROP_DEFAULT: case GD_CROP_TRANSPARENT: case GD_CROP_BLACK: @@ -4759,15 +4735,19 @@ PHP_FUNCTION(imagescale) RETURN_FALSE; } - if (tmp_h < 0) { + if (tmp_h < 0 || tmp_w < 0) { /* preserve ratio */ long src_x, src_y; src_x = gdImageSX(im); src_y = gdImageSY(im); - if (src_x) { + + if (src_x && tmp_h < 0) { tmp_h = tmp_w * src_y / src_x; } + if (src_y && tmp_w < 0) { + tmp_w = tmp_h * src_x / src_y; + } } if (tmp_h <= 0 || tmp_h > INT_MAX || tmp_w <= 0 || tmp_w > INT_MAX) { @@ -5090,12 +5070,3 @@ PHP_FUNCTION(imageresolution) } } /* }}} */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c index d1c3771f23..03700ebca8 100644 --- a/ext/gd/gd_ctx.c +++ b/ext/gd/gd_ctx.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2018 The PHP Group | + | 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 | @@ -93,9 +93,8 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, php_stream *stream; int close_stream = 1; - /* The third (quality) parameter for Wbmp stands for the foreground when called from image2wbmp(). - * The third (quality) parameter for Wbmp and Xbm stands for the foreground color index when called - * from imagey<type>(). + /* The third (quality) parameter for Wbmp and Xbm stands for the foreground color index when called + * from image<type>(). */ switch (image_type) { case PHP_GDIMG_TYPE_XBM: @@ -177,10 +176,6 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, } switch(image_type) { - case PHP_GDIMG_CONVERT_WBM: - if(q<0||q>255) { - php_error_docref(NULL, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q); - } case PHP_GDIMG_TYPE_JPG: (*func_p)(im, ctx, q); break; @@ -220,12 +215,3 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, RETURN_TRUE; } /* }}} */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c index 3e3b359666..2013e8ef42 100644 --- a/ext/gd/libgd/gd.c +++ b/ext/gd/libgd/gd.c @@ -1593,7 +1593,7 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e int i, pti; int lx = 0, ly = 0; int fx = 0, fy = 0; - int startx, starty, endx, endy; + int startx = -1, starty = -1, endx = -1, endy = -1; if ((s % 360) == (e % 360)) { s = 0; e = 360; @@ -1990,7 +1990,8 @@ void gdImageFill(gdImagePtr im, int x, int y, int nc) if (x>x2+1) { FILL_PUSH(y, x2+1, x-1, -dy); } -skip: for (x++; x<=x2 && (gdImageGetPixel(im, x, y)!=oc); x++); +skip: + for (x++; x<=x2 && (gdImageGetPixel(im, x, y)!=oc); x++); l = x; } while (x<=x2); @@ -2062,7 +2063,8 @@ static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc) if (x>x2+1) { FILL_PUSH(y, x2+1, x-1, -dy); } -skip: for(x++; x<=x2 && (pts[y][x] || gdImageGetPixel(im,x, y)!=oc); x++); +skip: + for(x++; x<=x2 && (pts[y][x] || gdImageGetPixel(im,x, y)!=oc); x++); l = x; } while (x<=x2); } diff --git a/ext/gd/libgd/gd.h b/ext/gd/libgd/gd.h index c8c6d29c18..89a64041a0 100644 --- a/ext/gd/libgd/gd.h +++ b/ext/gd/libgd/gd.h @@ -47,17 +47,7 @@ extern "C" { #include "gd_io.h" /* va_list needed in gdErrorMethod */ -#ifdef PHP_WIN32 -# include <stdarg.h> -#else -# if HAVE_STDARG_H -# include <stdarg.h> -# else -# if HAVE_SYS_VARARGS_H -# include <sys/varargs.h> -# endif -# endif -#endif +#include <stdarg.h> /* The maximum number of palette entries in palette-based images. In the wonderful new world of gd 2.0, you can of course have diff --git a/ext/gd/libgd/gd_crop.c b/ext/gd/libgd/gd_crop.c index 4221e88519..b4bff27006 100644 --- a/ext/gd/libgd/gd_crop.c +++ b/ext/gd/libgd/gd_crop.c @@ -109,9 +109,6 @@ gdImagePtr gdImageCropAuto(gdImagePtr im, const unsigned int mode) case GD_CROP_DEFAULT: default: color = gdImageGetTransparent(im); - if (color == -1) { - gdGuessBackgroundColorFromCorners(im, &color); - } break; } @@ -158,9 +155,6 @@ gdImagePtr gdImageCropAuto(gdImagePtr im, const unsigned int mode) } crop.width = x - crop.x + 2; - if (crop.x < 0 || crop.y < 0 || crop.width <= 0 || crop.height <= 0) { - return NULL; - } return gdImageCrop(im, &crop); } /*TODOs: Implement DeltaE instead, way better perceptual differences */ @@ -198,7 +192,7 @@ gdImagePtr gdImageCropThreshold(gdImagePtr im, const unsigned int color, const f crop.height = 0; /* Pierre: crop everything sounds bad */ - if (threshold > 1.0) { + if (threshold > 100.0) { return NULL; } @@ -303,10 +297,9 @@ static int gdColorMatch(gdImagePtr im, int col1, int col2, float threshold) const int dg = gdImageGreen(im, col1) - gdImageGreen(im, col2); const int db = gdImageBlue(im, col1) - gdImageBlue(im, col2); const int da = gdImageAlpha(im, col1) - gdImageAlpha(im, col2); - const double dist = sqrt(dr * dr + dg * dg + db * db + da * da); - const double dist_perc = sqrt(dist / (255^2 + 255^2 + 255^2)); - return (dist_perc <= threshold); - //return (100.0 * dist / 195075) < threshold; + const int dist = dr * dr + dg * dg + db * db + da * da; + + return (100.0 * dist / 195075) < threshold; } /* diff --git a/ext/gd/libgd/gd_gif_in.c b/ext/gd/libgd/gd_gif_in.c index 8b2a1b42fa..ee987e8199 100644 --- a/ext/gd/libgd/gd_gif_in.c +++ b/ext/gd/libgd/gd_gif_in.c @@ -139,7 +139,7 @@ gdImagePtr gdImageCreateFromGifCtx(gdIOCtxPtr fd) /* {{{ */ unsigned char ColorMap[3][MAXCOLORMAPSIZE]; unsigned char localColorMap[3][MAXCOLORMAPSIZE]; int imw, imh, screen_width, screen_height; - int gif87a, useGlobalColormap; + int useGlobalColormap; int bitPixel; int i; /*1.4//int imageCount = 0; */ @@ -160,9 +160,9 @@ gdImagePtr gdImageCreateFromGifCtx(gdIOCtxPtr fd) /* {{{ */ } if (memcmp((char *)buf+3, "87a", 3) == 0) { - gif87a = 1; + /* GIF87a */ } else if (memcmp((char *)buf+3, "89a", 3) == 0) { - gif87a = 0; + /* GIF89a */ } else { return 0; } @@ -467,7 +467,7 @@ LWZReadByte_(gdIOCtx *fd, LZW_STATIC_DATA *sd, char flag, int input_code_size, i if (sd->sp > sd->stack) return *--sd->sp; - while ((code = GetCode(fd, &sd->scd, sd->code_size, FALSE, ZeroDataBlockP)) >= 0) { + while ((code = GetCode(fd, &sd->scd, sd->code_size, FALSE, ZeroDataBlockP)) >= 0) { if (code == sd->clear_code) { for (i = 0; i < sd->clear_code; ++i) { sd->table[0][i] = 0; diff --git a/ext/gd/libgd/gd_gif_out.c b/ext/gd/libgd/gd_gif_out.c index cd4ea1529b..60f34ddc27 100644 --- a/ext/gd/libgd/gd_gif_out.c +++ b/ext/gd/libgd/gd_gif_out.c @@ -97,12 +97,18 @@ static void cl_hash (register count_int chsize, GifCtx *ctx); static void char_init (GifCtx *ctx); static void char_out (int c, GifCtx *ctx); static void flush_char (GifCtx *ctx); + +static int _gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out); + void * gdImageGifPtr (gdImagePtr im, int *size) { void *rv; gdIOCtx *out = gdNewDynamicCtx (2048, NULL); - gdImageGifCtx (im, out); - rv = gdDPExtractData (out, size); + if (!_gdImageGifCtx(im, out)) { + rv = gdDPExtractData(out, size); + } else { + rv = NULL; + } out->gd_free (out); return rv; } @@ -116,6 +122,12 @@ void gdImageGif (gdImagePtr im, FILE * outFile) void gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out) { + _gdImageGifCtx(im, out); +} + +/* returns 0 on success, 1 on failure */ +static int _gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out) +{ gdImagePtr pim = 0, tim = im; int interlace, BitsPerPixel; interlace = im->interlace; @@ -125,7 +137,7 @@ void gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out) based temporary image. */ pim = gdImageCreatePaletteFromTrueColor(im, 1, 256); if (!pim) { - return; + return 1; } tim = pim; } @@ -138,6 +150,8 @@ void gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out) /* Destroy palette based temporary image. */ gdImageDestroy( pim); } + + return 0; } static int diff --git a/ext/gd/libgd/gd_interpolation.c b/ext/gd/libgd/gd_interpolation.c index 86549a279d..ba5db679b0 100644 --- a/ext/gd/libgd/gd_interpolation.c +++ b/ext/gd/libgd/gd_interpolation.c @@ -366,6 +366,7 @@ static double filter_generalized_cubic(const double t) return 0; } +#ifdef FUNCTION_NOT_USED_YET /* CubicSpline filter, default radius 2 */ static double filter_cubic_spline(const double x1) { @@ -381,7 +382,9 @@ static double filter_cubic_spline(const double x1) } return 0; } +#endif +#ifdef FUNCTION_NOT_USED_YET /* CubicConvolution filter, default radius 3 */ static double filter_cubic_convolution(const double x1) { @@ -394,6 +397,7 @@ static double filter_cubic_convolution(const double x1) if (x <= 3.0) return ( (1.0/12.0) * x2_x - (2.0 / 3.0) * x2 + 1.75 * x - 1.5); return 0; } +#endif static double filter_box(double x) { if (x < - DEFAULT_FILTER_BOX) @@ -418,6 +422,7 @@ static double filter_catmullrom(const double x) return(0.0f); } +#ifdef FUNCTION_NOT_USED_YET static double filter_filter(double t) { /* f(t) = 2|t|^3 - 3|t|^2 + 1, -1 <= t <= 1 */ @@ -425,8 +430,9 @@ static double filter_filter(double t) if(t < 1.0) return((2.0 * t - 3.0) * t * t + 1.0); return(0.0); } +#endif - +#ifdef FUNCTION_NOT_USED_YET /* Lanczos8 filter, default radius 8 */ static double filter_lanczos8(const double x1) { @@ -441,8 +447,9 @@ static double filter_lanczos8(const double x1) return 0.0; #undef R } +#endif - +#ifdef FUNCTION_NOT_USED_YET /* Lanczos3 filter, default radius 3 */ static double filter_lanczos3(const double x1) { @@ -458,6 +465,7 @@ static double filter_lanczos3(const double x1) return 0.0; #undef R } +#endif /* Hermite filter, default radius 1 */ static double filter_hermite(const double x1) @@ -515,6 +523,7 @@ static double filter_mitchell(const double x) +#ifdef FUNCTION_NOT_USED_YET /* Cosine filter, default radius 1 */ static double filter_cosine(const double x) { @@ -522,6 +531,7 @@ static double filter_cosine(const double x) return 0; } +#endif /* Quadratic filter, default radius 1.5 */ static double filter_quadratic(const double x1) @@ -553,6 +563,7 @@ static double filter_bspline(const double x) } } +#ifdef FUNCTION_NOT_USED_YET /* QuadraticBSpline filter, default radius 1.5 */ static double filter_quadratic_bspline(const double x1) { @@ -562,6 +573,7 @@ static double filter_quadratic_bspline(const double x1) if (x <= 1.5) return (0.5 * x * x - 1.5 * x + 1.125); return 0.0; } +#endif static double filter_gaussian(const double x) { @@ -603,6 +615,7 @@ static double filter_sinc(const double x) return (sin(M_PI * (double) x) / (M_PI * (double) x)); } +#ifdef FUNCTION_NOT_USED_YET static double filter_welsh(const double x) { /* Welsh parabolic windowing filter */ @@ -610,7 +623,7 @@ static double filter_welsh(const double x) return(1 - x*x); return(0.0); } - +#endif /* Copied from upstream's libgd */ static inline int _color_blend (const int dst, const int src) @@ -1287,7 +1300,6 @@ static gdImagePtr gdImageScaleBilinearTC(gdImagePtr im, const unsigned int new_w int dst_offset_h; int dst_offset_v = 0; - int dwSrcTotalOffset; long i; gdImagePtr new_img; @@ -1309,8 +1321,8 @@ static gdImagePtr gdImageScaleBilinearTC(gdImagePtr im, const unsigned int new_w gdFixed f_j = gd_itofx(j); gdFixed f_a = gd_mulfx(f_i, f_dy); gdFixed f_b = gd_mulfx(f_j, f_dx); - const gdFixed m = gd_fxtoi(f_a); - const gdFixed n = gd_fxtoi(f_b); + const long m = gd_fxtoi(f_a); + const long n = gd_fxtoi(f_b); gdFixed f_f = f_a - gd_itofx(m); gdFixed f_g = f_b - gd_itofx(n); @@ -1326,7 +1338,6 @@ static gdImagePtr gdImageScaleBilinearTC(gdImagePtr im, const unsigned int new_w f_g1, f_g2, f_g3, f_g4, f_b1, f_b2, f_b3, f_b4, f_a1, f_a2, f_a3, f_a4; - dwSrcTotalOffset = m + n; /* 0 for bgColor; (n,m) is supposed to be valid anyway */ pixel1 = getPixelOverflowTC(im, n, m, 0); pixel2 = getPixelOverflowTC(im, n + 1, m, pixel1); @@ -2352,12 +2363,10 @@ int gdTransformAffineCopy(gdImagePtr dst, gdRect bbox; int end_x, end_y; gdInterpolationMethod interpolation_id_bak = GD_DEFAULT; - interpolation_method interpolation_bak; /* These methods use special implementations */ if (src->interpolation_id == GD_BILINEAR_FIXED || src->interpolation_id == GD_BICUBIC_FIXED || src->interpolation_id == GD_NEAREST_NEIGHBOUR) { interpolation_id_bak = src->interpolation_id; - interpolation_bak = src->interpolation; gdImageSetInterpolationMethod(src, GD_BICUBIC); } diff --git a/ext/gd/libgd/gd_jpeg.c b/ext/gd/libgd/gd_jpeg.c index 8cf71fcbc9..ef46c4a22c 100644 --- a/ext/gd/libgd/gd_jpeg.c +++ b/ext/gd/libgd/gd_jpeg.c @@ -132,6 +132,7 @@ const char * gdJpegGetVersionString() } } +static int _gdImageJpegCtx(gdImagePtr im, gdIOCtx *outfile, int quality); /* * Write IM to OUTFILE as a JFIF-formatted JPEG image, using quality @@ -153,8 +154,11 @@ void *gdImageJpegPtr (gdImagePtr im, int *size, int quality) { void *rv; gdIOCtx *out = gdNewDynamicCtx (2048, NULL); - gdImageJpegCtx (im, out, quality); - rv = gdDPExtractData (out, size); + if (!_gdImageJpegCtx(im, out, quality)) { + rv = gdDPExtractData(out, size); + } else { + rv = NULL; + } out->gd_free (out); return rv; @@ -164,6 +168,12 @@ void jpeg_gdIOCtx_dest (j_compress_ptr cinfo, gdIOCtx * outfile); void gdImageJpegCtx (gdImagePtr im, gdIOCtx * outfile, int quality) { + _gdImageJpegCtx(im, outfile, quality); +} + +/* returns 0 on success, 1 on failure */ +static int _gdImageJpegCtx(gdImagePtr im, gdIOCtx *outfile, int quality) +{ struct jpeg_compress_struct cinfo; struct jpeg_error_mgr jerr; int i, j, jidx; @@ -184,7 +194,7 @@ void gdImageJpegCtx (gdImagePtr im, gdIOCtx * outfile, int quality) if (row) { gdFree (row); } - return; + return 1; } cinfo.err->error_exit = fatal_jpeg_error; @@ -277,6 +287,7 @@ void gdImageJpegCtx (gdImagePtr im, gdIOCtx * outfile, int quality) jpeg_finish_compress (&cinfo); jpeg_destroy_compress (&cinfo); gdFree (row); + return 0; } gdImagePtr gdImageCreateFromJpeg (FILE * inFile) diff --git a/ext/gd/libgd/gd_wbmp.c b/ext/gd/libgd/gd_wbmp.c index 55ced3443d..13dc9e38d6 100644 --- a/ext/gd/libgd/gd_wbmp.c +++ b/ext/gd/libgd/gd_wbmp.c @@ -82,6 +82,7 @@ int gd_getin (void *in) return (gdGetC((gdIOCtx *) in)); } +static int _gdImageWBMPCtx(gdImagePtr image, int fg, gdIOCtx *out); /* gdImageWBMPCtx ** -------------- @@ -94,13 +95,19 @@ int gd_getin (void *in) */ void gdImageWBMPCtx (gdImagePtr image, int fg, gdIOCtx * out) { + _gdImageWBMPCtx(image, fg, out); +} + +/* returns 0 on success, 1 on failure */ +static int _gdImageWBMPCtx(gdImagePtr image, int fg, gdIOCtx *out) +{ int x, y, pos; Wbmp *wbmp; /* create the WBMP */ if ((wbmp = createwbmp (gdImageSX (image), gdImageSY (image), WBMP_WHITE)) == NULL) { gd_error("Could not create WBMP"); - return; + return 1; } /* fill up the WBMP structure */ @@ -116,10 +123,15 @@ void gdImageWBMPCtx (gdImagePtr image, int fg, gdIOCtx * out) /* write the WBMP to a gd file descriptor */ if (writewbmp (wbmp, &gd_putout, out)) { + freewbmp(wbmp); gd_error("Could not save WBMP"); + return 1; } + /* des submitted this bugfix: gdFree the memory. */ freewbmp(wbmp); + + return 0; } /* gdImageCreateFromWBMPCtx @@ -204,8 +216,11 @@ void * gdImageWBMPPtr (gdImagePtr im, int *size, int fg) { void *rv; gdIOCtx *out = gdNewDynamicCtx(2048, NULL); - gdImageWBMPCtx(im, fg, out); - rv = gdDPExtractData(out, size); + if (!_gdImageWBMPCtx(im, fg, out)) { + rv = gdDPExtractData(out, size); + } else { + rv = NULL; + } out->gd_free(out); return rv; diff --git a/ext/gd/libgd/gd_webp.c b/ext/gd/libgd/gd_webp.c index 51295797f5..bcd8008eab 100644 --- a/ext/gd/libgd/gd_webp.c +++ b/ext/gd/libgd/gd_webp.c @@ -1,10 +1,11 @@ -#ifdef HAVE_LIBWEBP #include <stdio.h> #include <math.h> #include <string.h> #include <stdlib.h> #include "gd.h" #include "gdhelpers.h" + +#ifdef HAVE_LIBWEBP #include "webp/decode.h" #include "webp/encode.h" diff --git a/ext/gd/libgd/gd_xbm.c b/ext/gd/libgd/gd_xbm.c index 1ed0d48981..a37d833d3b 100644 --- a/ext/gd/libgd/gd_xbm.c +++ b/ext/gd/libgd/gd_xbm.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2018 The PHP Group | + | 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 | @@ -231,12 +231,3 @@ void gdImageXbmCtx(gdImagePtr image, char* file_name, int fg, gdIOCtx * out) gdCtxPrintf(out, "};\n"); } /* }}} */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/ext/gd/libgd/gdhelpers.c b/ext/gd/libgd/gdhelpers.c index ae2428dfcd..44b79ac77f 100644 --- a/ext/gd/libgd/gdhelpers.c +++ b/ext/gd/libgd/gdhelpers.c @@ -15,7 +15,6 @@ char * gd_strtok_r (char *s, char *sep, char **state) { char separators[256]; - char *start; char *result = 0; memset (separators, 0, sizeof (separators)); while (*sep) @@ -28,7 +27,6 @@ gd_strtok_r (char *s, char *sep, char **state) /* Pick up where we left off */ s = *state; } - start = s; /* 1. EOS */ if (!(*s)) { diff --git a/ext/gd/php_gd.h b/ext/gd/php_gd.h index 171c71191d..982decd064 100644 --- a/ext/gd/php_gd.h +++ b/ext/gd/php_gd.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2018 The PHP Group | + | 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 | diff --git a/ext/gd/tests/001-mb.phpt b/ext/gd/tests/001-mb.phpt index 9307450f5b..8ee2e9a415 100644 --- a/ext/gd/tests/001-mb.phpt +++ b/ext/gd/tests/001-mb.phpt @@ -5,7 +5,7 @@ imagecreatefrompng() and empty/missing file --FILE-- <?php -$file = dirname(__FILE__)."/001私はガラスを食べられます.test"; +$file = __DIR__."/001私はガラスを食べられます.test"; @unlink($file); var_dump(imagecreatefrompng($file)); diff --git a/ext/gd/tests/001.phpt b/ext/gd/tests/001.phpt index 039511a558..b820ac1cc0 100644 --- a/ext/gd/tests/001.phpt +++ b/ext/gd/tests/001.phpt @@ -5,7 +5,7 @@ imagecreatefrompng() and empty/missing file --FILE-- <?php -$file = dirname(__FILE__)."/001.test"; +$file = __DIR__."/001.test"; @unlink($file); var_dump(imagecreatefrompng($file)); diff --git a/ext/gd/tests/Tuffy.ttf b/ext/gd/tests/Tuffy.ttf Binary files differindex 8ea647090f..8ea647090f 100755..100644 --- a/ext/gd/tests/Tuffy.ttf +++ b/ext/gd/tests/Tuffy.ttf diff --git a/ext/gd/tests/bug36697-mb.phpt b/ext/gd/tests/bug36697-mb.phpt index b0b69a394f..371c8e48be 100644 --- a/ext/gd/tests/bug36697-mb.phpt +++ b/ext/gd/tests/bug36697-mb.phpt @@ -8,7 +8,7 @@ Bug #36697 (TrueColor transparency with GIF palette output). ?> --FILE-- <?php -$dest = dirname(__FILE__) . "/36697私はガラスを食べられます.gif"; +$dest = __DIR__ . "/36697私はガラスを食べられます.gif"; $im = imagecreatetruecolor(192, 36); $trans_color = imagecolorallocate($im, 255, 0, 0); diff --git a/ext/gd/tests/bug36697.phpt b/ext/gd/tests/bug36697.phpt index 9335e5f58d..262b881ca0 100644 --- a/ext/gd/tests/bug36697.phpt +++ b/ext/gd/tests/bug36697.phpt @@ -8,7 +8,7 @@ Bug #36697 (TrueColor transparency with GIF palette output). ?> --FILE-- <?php -$dest = dirname(__FILE__) . "/36697.gif"; +$dest = __DIR__ . "/36697.gif"; $im = imagecreatetruecolor(192, 36); $trans_color = imagecolorallocate($im, 255, 0, 0); diff --git a/ext/gd/tests/bug37346-mb.phpt b/ext/gd/tests/bug37346-mb.phpt index 90efc6391b..4ec5734fc7 100644 --- a/ext/gd/tests/bug37346-mb.phpt +++ b/ext/gd/tests/bug37346-mb.phpt @@ -6,7 +6,7 @@ Bug #37346 (gdimagecreatefromgif, bad colormap) ?> --FILE-- <?php -$im = imagecreatefromgif(dirname(__FILE__) . '/bug37346私はガラスを食べられます.gif'); +$im = imagecreatefromgif(__DIR__ . '/bug37346私はガラスを食べられます.gif'); ?> --EXPECTF-- Warning: imagecreatefromgif(): '%sbug37346私はガラスを食べられます.gif' is not a valid GIF file in %sbug37346-mb.php on line %d diff --git a/ext/gd/tests/bug37346.phpt b/ext/gd/tests/bug37346.phpt index 36d9c0a04a..57701a7ad7 100644 --- a/ext/gd/tests/bug37346.phpt +++ b/ext/gd/tests/bug37346.phpt @@ -6,7 +6,7 @@ Bug #37346 (gdimagecreatefromgif, bad colormap) ?> --FILE-- <?php -$im = imagecreatefromgif(dirname(__FILE__) . '/bug37346.gif'); +$im = imagecreatefromgif(__DIR__ . '/bug37346.gif'); ?> --EXPECTF-- Warning: imagecreatefromgif(): '%sbug37346.gif' is not a valid GIF file in %sbug37346.php on line %d diff --git a/ext/gd/tests/bug37360.phpt b/ext/gd/tests/bug37360.phpt index 44bbd96b88..c2b8b9592d 100644 --- a/ext/gd/tests/bug37360.phpt +++ b/ext/gd/tests/bug37360.phpt @@ -6,7 +6,7 @@ Bug #37360 (gdimagecreatefromgif, bad image sizes) ?> --FILE-- <?php -$im = imagecreatefromgif(dirname(__FILE__) . '/bug37360.gif'); +$im = imagecreatefromgif(__DIR__ . '/bug37360.gif'); var_dump($im); ?> --EXPECTF-- diff --git a/ext/gd/tests/bug38112.phpt b/ext/gd/tests/bug38112.phpt index 0e4b8afd3f..8a6911ad9d 100644 --- a/ext/gd/tests/bug38112.phpt +++ b/ext/gd/tests/bug38112.phpt @@ -8,7 +8,7 @@ Bug #38112 (GIF Invalid Code size ). ?> --FILE-- <?php -$im = imagecreatefromgif(dirname(__FILE__) . '/bug38112.gif'); +$im = imagecreatefromgif(__DIR__ . '/bug38112.gif'); ?> --EXPECTF-- Warning: imagecreatefromgif(): '%sbug38112.gif' is not a valid GIF file in %sbug38112.php on line %d diff --git a/ext/gd/tests/bug38212-mb.phpt b/ext/gd/tests/bug38212-mb.phpt index 266e470de0..a7a3d65f13 100644 --- a/ext/gd/tests/bug38212-mb.phpt +++ b/ext/gd/tests/bug38212-mb.phpt @@ -6,7 +6,7 @@ Bug #38212 (Seg Fault on invalid imagecreatefromgd2part() parameters) ?> --FILE-- <?php -$file = dirname(__FILE__) . '/bug38212私はガラスを食べられます.gd2'; +$file = __DIR__ . '/bug38212私はガラスを食べられます.gd2'; $im1 = imagecreatetruecolor(10,100); imagefill($im1, 0,0, 0xffffff); imagegd2($im1, $file); diff --git a/ext/gd/tests/bug38212.phpt b/ext/gd/tests/bug38212.phpt index 1459bb000d..039c6f971b 100644 --- a/ext/gd/tests/bug38212.phpt +++ b/ext/gd/tests/bug38212.phpt @@ -6,7 +6,7 @@ Bug #38212 (Seg Fault on invalid imagecreatefromgd2part() parameters) ?> --FILE-- <?php -$file = dirname(__FILE__) . '/bug38212.gd2'; +$file = __DIR__ . '/bug38212.gd2'; $im1 = imagecreatetruecolor(10,100); imagefill($im1, 0,0, 0xffffff); imagegd2($im1, $file); diff --git a/ext/gd/tests/bug39780.phpt b/ext/gd/tests/bug39780.phpt index 7bf9f56cb0..2a7af3e0f4 100644 --- a/ext/gd/tests/bug39780.phpt +++ b/ext/gd/tests/bug39780.phpt @@ -8,7 +8,7 @@ Bug #39780 (PNG image with CRC/data error raises a fatal error) --FILE-- <?php -$im = imagecreatefrompng(dirname(__FILE__) . '/bug39780.png'); +$im = imagecreatefrompng(__DIR__ . '/bug39780.png'); var_dump($im); ?> --EXPECTF-- diff --git a/ext/gd/tests/bug39780_extern.phpt b/ext/gd/tests/bug39780_extern.phpt index 65c3859c6a..0656e52fc7 100644 --- a/ext/gd/tests/bug39780_extern.phpt +++ b/ext/gd/tests/bug39780_extern.phpt @@ -8,7 +8,7 @@ Bug #39780 (PNG image with CRC/data error raises a fatal error) --FILE-- <?php -$im = imagecreatefrompng(dirname(__FILE__) . '/bug39780.png'); +$im = imagecreatefrompng(__DIR__ . '/bug39780.png'); var_dump($im); ?> --EXPECTF-- diff --git a/ext/gd/tests/bug41442.phpt b/ext/gd/tests/bug41442.phpt index ba5950dd15..5c590deb77 100644 --- a/ext/gd/tests/bug41442.phpt +++ b/ext/gd/tests/bug41442.phpt @@ -12,7 +12,7 @@ Bug #41442 (imagegd2() under output control) --FILE-- <?php -$str = file_get_contents(dirname(__FILE__).'/src.gd2'); +$str = file_get_contents(__DIR__.'/src.gd2'); $res = imagecreatefromstring($str); /* string */ @@ -22,7 +22,7 @@ $str2 = ob_get_clean(); var_dump(imagecreatefromstring($str2)); /* file */ -$file = dirname(__FILE__)."/bug41442.gd2"; +$file = __DIR__."/bug41442.gd2"; imagegd2($res, $file); $str2 = file_get_contents($file); var_dump(imagecreatefromstring($str2)); diff --git a/ext/gd/tests/bug43073.phpt b/ext/gd/tests/bug43073.phpt index 8b58e511cc..a8027338ef 100644 --- a/ext/gd/tests/bug43073.phpt +++ b/ext/gd/tests/bug43073.phpt @@ -25,7 +25,7 @@ $exp = [ [470,470, 548,549, 566,532, 488,453], [492,439, 595,481, 604,458, 502,416] ]; -$cwd = dirname(__FILE__); +$cwd = __DIR__; $font = "$cwd/Tuffy.ttf"; $delta_t = 360.0 / 16; # Make 16 steps around $g = imagecreate(800, 800); @@ -55,7 +55,7 @@ for ($angle = 0.0, $i = 0; $angle < 360.0; $angle += $delta_t, $i++) { imagepng($g, "$cwd/bug43073.png"); ?> --CLEAN-- -<?php @unlink(dirname(__FILE__) . '/bug43073.png'); ?> +<?php @unlink(__DIR__ . '/bug43073.png'); ?> --EXPECT-- 0: ........ 1: ........ diff --git a/ext/gd/tests/bug43121.phpt b/ext/gd/tests/bug43121.phpt index 08348d0012..1c3a7e5bc7 100644 --- a/ext/gd/tests/bug43121.phpt +++ b/ext/gd/tests/bug43121.phpt @@ -12,7 +12,7 @@ Bug #43121 (gdImageFill with IMG_COLOR_TILED crashes httpd) $im = ImageCreate( 200, 100 ); $black = ImageColorAllocate( $im, 0, 0, 0 ); -$im_tile = ImageCreateFromGif(dirname(__FILE__) . "/bug43121.gif" ); +$im_tile = ImageCreateFromGif(__DIR__ . "/bug43121.gif" ); ImageSetTile( $im, $im_tile ); ImageFill( $im, 0, 0, IMG_COLOR_TILED ); diff --git a/ext/gd/tests/bug48555.phpt b/ext/gd/tests/bug48555.phpt index 43e14db05f..03ee5a2b94 100644 --- a/ext/gd/tests/bug48555.phpt +++ b/ext/gd/tests/bug48555.phpt @@ -7,7 +7,7 @@ Bug #48555 (ImageFTBBox() differs from previous versions for texts with new line ?> --FILE-- <?php -$cwd = dirname(__FILE__); +$cwd = __DIR__; $font = "$cwd/Tuffy.ttf"; $box = ImageFTBBox(14, 0, $font, "Text without line-break"); //echo 'Top without line-break: ' . $box[7] . "\n"; diff --git a/ext/gd/tests/bug48732-mb.phpt b/ext/gd/tests/bug48732-mb.phpt index 8e937bfe8e..437731bb4b 100644 --- a/ext/gd/tests/bug48732-mb.phpt +++ b/ext/gd/tests/bug48732-mb.phpt @@ -8,7 +8,7 @@ Bug #48732 (TTF Bounding box wrong for letters below baseline) ?> --FILE-- <?php -$cwd = dirname(__FILE__); +$cwd = __DIR__; $font = "$cwd/Tuffy私はガラスを食べられます.ttf"; $g = imagecreate(100, 50); $bgnd = imagecolorallocate($g, 255, 255, 255); @@ -18,6 +18,6 @@ imagepng($g, "$cwd/bug48732私はガラスを食べられます.png"); echo 'Left Bottom: (' . $bbox[0] . ', ' . $bbox[1] . ')'; ?> --CLEAN-- -<?php @unlink(dirname(__FILE__) . '/bug48732私はガラスを食べられます.png'); ?> +<?php @unlink(__DIR__ . '/bug48732私はガラスを食べられます.png'); ?> --EXPECT-- Left Bottom: (0, 46) diff --git a/ext/gd/tests/bug48732.phpt b/ext/gd/tests/bug48732.phpt index 5e77e06103..b2be6a47f1 100644 --- a/ext/gd/tests/bug48732.phpt +++ b/ext/gd/tests/bug48732.phpt @@ -7,7 +7,7 @@ Bug #48732 (TTF Bounding box wrong for letters below baseline) ?> --FILE-- <?php -$cwd = dirname(__FILE__); +$cwd = __DIR__; $font = "$cwd/Tuffy.ttf"; $g = imagecreate(100, 50); $bgnd = imagecolorallocate($g, 255, 255, 255); @@ -17,6 +17,6 @@ imagepng($g, "$cwd/bug48732.png"); echo 'Left Bottom: (' . $bbox[0] . ', ' . $bbox[1] . ')'; ?> --CLEAN-- -<?php @unlink(dirname(__FILE__) . '/bug48732.png'); ?> +<?php @unlink(__DIR__ . '/bug48732.png'); ?> --EXPECT-- Left Bottom: (0, 46) diff --git a/ext/gd/tests/bug48801-mb.phpt b/ext/gd/tests/bug48801-mb.phpt index a2f6d28a82..1793ac3386 100644 --- a/ext/gd/tests/bug48801-mb.phpt +++ b/ext/gd/tests/bug48801-mb.phpt @@ -8,7 +8,7 @@ Bug #48801 (Problem with imagettfbbox) ?> --FILE-- <?php -$cwd = dirname(__FILE__); +$cwd = __DIR__; $font = "$cwd/Tuffy私はガラスを食べられます.ttf"; $bbox = imageftbbox(50, 0, $font, "image"); echo '(' . $bbox[0] . ', ' . $bbox[1] . ")\n"; diff --git a/ext/gd/tests/bug48801.phpt b/ext/gd/tests/bug48801.phpt index f55ed55844..b5e32af480 100644 --- a/ext/gd/tests/bug48801.phpt +++ b/ext/gd/tests/bug48801.phpt @@ -7,7 +7,7 @@ Bug #48801 (Problem with imagettfbbox) ?> --FILE-- <?php -$cwd = dirname(__FILE__); +$cwd = __DIR__; $font = "$cwd/Tuffy.ttf"; $bbox = imageftbbox(50, 0, $font, "image"); echo '(' . $bbox[0] . ', ' . $bbox[1] . ")\n"; diff --git a/ext/gd/tests/bug49600.phpt b/ext/gd/tests/bug49600.phpt index 1fb84f28bd..25fae3ca37 100644 --- a/ext/gd/tests/bug49600.phpt +++ b/ext/gd/tests/bug49600.phpt @@ -8,7 +8,7 @@ Bug #49600 (imageTTFText text shifted right) ?> --FILE-- <?php -$cwd = dirname(__FILE__); +$cwd = __DIR__; $font = "$cwd/Tuffy.ttf"; $image = imagecreatetruecolor(50, 50); $color = imagecolorallocate($image, 255, 255, 255); diff --git a/ext/gd/tests/bug51263.phpt b/ext/gd/tests/bug51263.phpt index 69496e011b..6f14cd3c98 100644 --- a/ext/gd/tests/bug51263.phpt +++ b/ext/gd/tests/bug51263.phpt @@ -7,7 +7,7 @@ Bug #51263 (imagettftext and rotated text uses wrong baseline) ?> --FILE-- <?php -$cwd = dirname(__FILE__); +$cwd = __DIR__; $ttf = "$cwd/Tuffy.ttf"; $w = 23; $h = 70; diff --git a/ext/gd/tests/bug53504.phpt b/ext/gd/tests/bug53504.phpt index bb6cc7a93f..3b2ce4c7eb 100644 --- a/ext/gd/tests/bug53504.phpt +++ b/ext/gd/tests/bug53504.phpt @@ -7,7 +7,7 @@ Bug #53504 imagettfbbox/imageftbbox gives incorrect values for bounding box ?> --FILE-- <?php -$cwd = dirname(__FILE__); +$cwd = __DIR__; $font = "$cwd/Tuffy.ttf"; $g = imagecreate(800, 800); @@ -84,7 +84,7 @@ foreach ($tests as $testnum => $test) { imagepng($g, "$cwd/bug53504.png"); ?> --CLEAN-- -<?php @unlink(dirname(__FILE__) . '/bug53504.png'); ?> +<?php @unlink(__DIR__ . '/bug53504.png'); ?> --EXPECT-- 0: ........ 1: ........ diff --git a/ext/gd/tests/bug72339.phpt b/ext/gd/tests/bug72339.phpt index eac5b630b2..d63ce67c55 100644 --- a/ext/gd/tests/bug72339.phpt +++ b/ext/gd/tests/bug72339.phpt @@ -9,7 +9,7 @@ if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.2', '<')) { ?> --FILE-- <?php -$fname = dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug72339.gd"; +$fname = __DIR__ . DIRECTORY_SEPARATOR . "bug72339.gd"; $fh = fopen($fname, "w"); fwrite($fh, "gd2\x00"); diff --git a/ext/gd/tests/bug73291.phpt b/ext/gd/tests/bug73291.phpt new file mode 100644 index 0000000000..ffa2fe7e4c --- /dev/null +++ b/ext/gd/tests/bug73291.phpt @@ -0,0 +1,35 @@ +--TEST-- +Bug #73291 (imagecropauto() $threshold differs from external libgd) +--SKIPIF-- +<?php +if (!extension_loaded('gd')) die('skip gd extension not available'); +?> +--FILE-- +<?php + +$src = imagecreatetruecolor(255, 255); +$white = imagecolorallocate($src, 255, 255, 255); +imagefilledrectangle($src, 0, 0, 254, 254, $white); + +for ($i = 254; $i > 0; $i--) { + $color = imagecolorallocate($src, $i, $i, $i); + imagefilledellipse($src, 127, 127, $i, $i, $color); +} + +foreach ([0.1, 0.5, 1.0, 10.0] as $threshold) { + $dst = imagecropauto($src, IMG_CROP_THRESHOLD, $threshold, $white); + if ($dst !== false) { + printf("size: %d*%d\n", imagesx($dst), imagesy($dst)); + } else { + echo "cropped to zero size\n"; + } +} + +?> +===DONE=== +--EXPECT-- +size: 247*247 +size: 237*237 +size: 229*229 +size: 175*175 +===DONE=== diff --git a/ext/gd/tests/colorat.phpt b/ext/gd/tests/colorat.phpt index be14873886..e8c1a5fb46 100644 --- a/ext/gd/tests/colorat.phpt +++ b/ext/gd/tests/colorat.phpt @@ -6,7 +6,7 @@ imagecolorat ?> --FILE-- <?php -$file = dirname(__FILE__) . '/im.wbmp'; +$file = __DIR__ . '/im.wbmp'; $im = imagecreatetruecolor(6,6); imagefill($im, 0,0, 0xffffff); diff --git a/ext/gd/tests/crafted_gd2.phpt b/ext/gd/tests/crafted_gd2.phpt index 3fb7c2e004..60687dfa3c 100644 --- a/ext/gd/tests/crafted_gd2.phpt +++ b/ext/gd/tests/crafted_gd2.phpt @@ -8,7 +8,7 @@ Test max colors for a gd image. ?> --FILE-- <?php -imagecreatefromgd(dirname(__FILE__) . '/crafted.gd2'); +imagecreatefromgd(__DIR__ . '/crafted.gd2'); ?> --EXPECTF-- Warning: imagecreatefromgd(): '%scrafted.gd2' is not a valid GD file in %s on line %d diff --git a/ext/gd/tests/createfromgd2.phpt b/ext/gd/tests/createfromgd2.phpt index e43d1b865b..d6229d4f7e 100644 --- a/ext/gd/tests/createfromgd2.phpt +++ b/ext/gd/tests/createfromgd2.phpt @@ -6,7 +6,7 @@ imagecreatefromgd2 ?> --FILE-- <?php -$file = dirname(__FILE__) . '/src.gd2'; +$file = __DIR__ . '/src.gd2'; $im2 = imagecreatefromgd2($file); echo 'test create from gd2: '; diff --git a/ext/gd/tests/createfromstring.phpt b/ext/gd/tests/createfromstring.phpt index 7828725db5..6a4b1a7e11 100644 --- a/ext/gd/tests/createfromstring.phpt +++ b/ext/gd/tests/createfromstring.phpt @@ -7,14 +7,14 @@ imagecreatefromstring ?> --FILE-- <?php -$dir = dirname(__FILE__); +$dir = __DIR__; $im = imagecreatetruecolor(5,5); imagefill($im, 0,0, 0xffffff); imagesetpixel($im, 3,3, 0x0); imagepng($im, $dir . '/tc.png'); -$im_string = file_get_contents(dirname(__FILE__) . '/tc.png'); +$im_string = file_get_contents(__DIR__ . '/tc.png'); $im = imagecreatefromstring($im_string); echo 'createfromstring truecolor png: '; if (imagecolorat($im, 3,3) != 0x0) { @@ -34,7 +34,7 @@ imagefill($im, 0,0, $c1); imagesetpixel($im, 3,3, $c2); imagepng($im, $dir . '/p.png'); -$im_string = file_get_contents(dirname(__FILE__) . '/p.png'); +$im_string = file_get_contents(__DIR__ . '/p.png'); $im = imagecreatefromstring($im_string); echo'createfromstring palette png: '; diff --git a/ext/gd/tests/createfromwbmp-mb.phpt b/ext/gd/tests/createfromwbmp-mb.phpt index 50e8a18780..f9dc9fe8bf 100644 --- a/ext/gd/tests/createfromwbmp-mb.phpt +++ b/ext/gd/tests/createfromwbmp-mb.phpt @@ -6,7 +6,7 @@ imagecreatefromwbmp ?> --FILE-- <?php -$file = dirname(__FILE__) . '/src私はガラスを食べられます.wbmp'; +$file = __DIR__ . '/src私はガラスを食べられます.wbmp'; $im2 = imagecreatefromwbmp($file); echo 'test create from wbmp: '; diff --git a/ext/gd/tests/createfromwbmp.phpt b/ext/gd/tests/createfromwbmp.phpt index 589bbaf855..d58188b801 100644 --- a/ext/gd/tests/createfromwbmp.phpt +++ b/ext/gd/tests/createfromwbmp.phpt @@ -6,7 +6,7 @@ imagecreatefromwbmp ?> --FILE-- <?php -$file = dirname(__FILE__) . '/src.wbmp'; +$file = __DIR__ . '/src.wbmp'; $im2 = imagecreatefromwbmp($file); echo 'test create from wbmp: '; diff --git a/ext/gd/tests/createfromwbmp2.phpt b/ext/gd/tests/createfromwbmp2.phpt index bbb475c423..e083b74c19 100644 --- a/ext/gd/tests/createfromwbmp2.phpt +++ b/ext/gd/tests/createfromwbmp2.phpt @@ -7,7 +7,7 @@ imagecreatefromwbmp with invalid wbmp ?> --FILE-- <?php -$filename = dirname(__FILE__) . '/_tmp.wbmp'; +$filename = __DIR__ . '/_tmp.wbmp'; $fp = fopen($filename,"wb"); if (!$fp) { exit("Failed to create <$filename>"); diff --git a/ext/gd/tests/createfromwbmp2_extern.phpt b/ext/gd/tests/createfromwbmp2_extern.phpt index 7be46f78f1..ed739461c4 100644 --- a/ext/gd/tests/createfromwbmp2_extern.phpt +++ b/ext/gd/tests/createfromwbmp2_extern.phpt @@ -7,7 +7,7 @@ imagecreatefromwbmp with invalid wbmp ?> --FILE-- <?php -$filename = dirname(__FILE__) . '/_tmp.wbmp'; +$filename = __DIR__ . '/_tmp.wbmp'; $fp = fopen($filename,"wb"); if (!$fp) { exit("Failed to create <$filename>"); diff --git a/ext/gd/tests/gd_info_error.phpt b/ext/gd/tests/gd_info_error.phpt deleted file mode 100644 index edc18fac0f..0000000000 --- a/ext/gd/tests/gd_info_error.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -Test gd_info() function : error conditions - with more than expected number of arguments ---SKIPIF-- -<?php -if(!extension_loaded('gd')) { - die('skip gd extension is not loaded'); -} -if(!function_exists('gd_info')) { - die('skip gd_info function is not available'); -} -?> ---FILE-- -<?php -/* Prototype : array gd_info() - * Description: Retrieve information about the currently installed GD library - * Source code: ext/gd/gd.c - */ -$extra_arg_number = 10; -$extra_arg_string = "Hello"; - -echo "*** Testing gd_info() : error conditions ***\n"; - -echo "\n-- Testing gd_info() function with more than expected number of arguments --\n"; -var_dump(gd_info($extra_arg_number)); -var_dump(gd_info($extra_arg_string, $extra_arg_number)); -?> -===DONE=== ---EXPECTF-- -*** Testing gd_info() : error conditions *** - --- Testing gd_info() function with more than expected number of arguments -- - -Warning: gd_info() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: gd_info() expects exactly 0 parameters, 2 given in %s on line %d -NULL -===DONE=== diff --git a/ext/gd/tests/gif.phpt b/ext/gd/tests/gif.phpt index a28fadf9a8..218ef50fa4 100644 --- a/ext/gd/tests/gif.phpt +++ b/ext/gd/tests/gif.phpt @@ -13,7 +13,7 @@ gif in/out <?php function check_box($r,$g,$b, $error=0) { - $cwd = dirname(__FILE__); + $cwd = __DIR__; $im2 = imagecreatefromgif($cwd . '/test_gif.gif'); $c = imagecolorsforindex($im2, imagecolorat($im2, 8,8)); @@ -42,7 +42,7 @@ function check_box($r,$g,$b, $error=0) { } } } -$cwd = dirname(__FILE__); +$cwd = __DIR__; $im = imagecreate(10,10); $c = imagecolorallocate($im, 255,255,255); diff --git a/ext/gd/tests/gif2gd.phpt b/ext/gd/tests/gif2gd.phpt index 17ec158cb3..3fe9397fb6 100644 --- a/ext/gd/tests/gif2gd.phpt +++ b/ext/gd/tests/gif2gd.phpt @@ -12,18 +12,18 @@ gif --> gd1/gd2 conversion test ?> --FILE-- <?php - $cwd = dirname(__FILE__); + $cwd = __DIR__; echo "GIF to GD1 conversion: "; - echo imagegd(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test.gd1") ? 'ok' : 'failed'; + echo imagegd(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test_gif.gd1") ? 'ok' : 'failed'; echo "\n"; echo "GIF to GD2 conversion: "; - echo imagegd2(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test.gd2") ? 'ok' : 'failed'; + echo imagegd2(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test_gif.gd2") ? 'ok' : 'failed'; echo "\n"; - @unlink($cwd . "/test.gd1"); - @unlink($cwd . "/test.gd2"); + @unlink($cwd . "/test_gif.gd1"); + @unlink($cwd . "/test_gif.gd2"); ?> --EXPECT-- GIF to GD1 conversion: ok diff --git a/ext/gd/tests/gif2jpg.phpt b/ext/gd/tests/gif2jpg.phpt index 5f32c35960..38d8963271 100644 --- a/ext/gd/tests/gif2jpg.phpt +++ b/ext/gd/tests/gif2jpg.phpt @@ -15,7 +15,7 @@ gif --> jpeg conversion test ?> --FILE-- <?php - $cwd = dirname(__FILE__); + $cwd = __DIR__; echo "GIF to JPEG conversion: "; echo imagejpeg(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test_gif.jpeg") ? 'ok' : 'failed'; diff --git a/ext/gd/tests/gif2png.phpt b/ext/gd/tests/gif2png.phpt index 3b8beca249..27aac9cdd8 100644 --- a/ext/gd/tests/gif2png.phpt +++ b/ext/gd/tests/gif2png.phpt @@ -15,7 +15,7 @@ gif --> png conversion test ?> --FILE-- <?php - $cwd = dirname(__FILE__); + $cwd = __DIR__; echo "GIF to PNG conversion: "; echo imagepng(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test_gif.png") ? 'ok' : 'failed'; diff --git a/ext/gd/tests/imagealphablending_error1.phpt b/ext/gd/tests/imagealphablending_error1.phpt deleted file mode 100644 index 4f7607b5dd..0000000000 --- a/ext/gd/tests/imagealphablending_error1.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -test imagealphablending without arguments ---CREDITS-- -Marcelo Diniz <marcelo.leo27 [at] gmail [dot] com -#phpspMaisTestFest PHPSP on 2014-07-05 ---SKIPIF-- -<?php - if (!extension_loaded('gd')) die("skip gd extension not available."); -?> ---FILE-- -<?php -imagealphablending(); -?> ---EXPECTF-- -Warning: imagealphablending() expects exactly 2 parameters, 0 given in %s on line %d diff --git a/ext/gd/tests/imagearc_error1.phpt b/ext/gd/tests/imagearc_error1.phpt deleted file mode 100644 index 65c582b255..0000000000 --- a/ext/gd/tests/imagearc_error1.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -Testing wrong param passing imagearc() 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 = imagecreatetruecolor(100, 100); - -$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); - -//create an arc with white color -imagearc($image, 50, 50, 30, 30, 0, 180); - -include_once __DIR__ . '/func.inc'; -test_image_equals_file(__DIR__ . '/imagearc_error1.png', $image); -?> ---EXPECTF-- -Warning: imagearc() expects exactly 8 parameters, 7 given in %s on line %d -The images are equal. diff --git a/ext/gd/tests/imagechar_error1.phpt b/ext/gd/tests/imagechar_error1.phpt deleted file mode 100644 index c91a3ec55b..0000000000 --- a/ext/gd/tests/imagechar_error1.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error on non-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 - -$result = imagechar('string', 1, 5, 5, 'C', 1); - -?> ---EXPECTF-- -Warning: imagechar() expects parameter 1 to be resource, %s given in %s on line %d diff --git a/ext/gd/tests/imagechar_error3.phpt b/ext/gd/tests/imagechar_error3.phpt deleted file mode 100644 index 4db74c6198..0000000000 --- a/ext/gd/tests/imagechar_error3.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error on non-long parameter 2 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 -$image = imagecreatetruecolor(180, 30); -$result = imagechar($image, 'string', 5, 5, 'C', 1); - -?> ---EXPECTF-- -Warning: imagechar() expects parameter 2 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagechar_error4.phpt b/ext/gd/tests/imagechar_error4.phpt deleted file mode 100644 index 469a732759..0000000000 --- a/ext/gd/tests/imagechar_error4.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error on non-long parameter 3 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 -$image = imagecreatetruecolor(180, 30); -$result = imagechar($image, 1, 'string', 5, 'C', 1); - -?> ---EXPECTF-- -Warning: imagechar() expects parameter 3 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagechar_error5.phpt b/ext/gd/tests/imagechar_error5.phpt deleted file mode 100644 index b01736eadd..0000000000 --- a/ext/gd/tests/imagechar_error5.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error on non-long parameter 4 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 -$image = imagecreatetruecolor(180, 30); -$result = imagechar($image, 1, 5, 'string', 'C', 1); - -?> ---EXPECTF-- -Warning: imagechar() expects parameter 4 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagechar_error6.phpt b/ext/gd/tests/imagechar_error6.phpt deleted file mode 100644 index 4ec608a60c..0000000000 --- a/ext/gd/tests/imagechar_error6.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error on non-string parameter 5 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 -$image = imagecreatetruecolor(180, 30); -$result = imagechar($image, 1, 5, 5, $image, 1); - -?> ---EXPECTF-- -Warning: imagechar() expects parameter 5 to be string%S, %s given in %s on line %d diff --git a/ext/gd/tests/imagechar_error7.phpt b/ext/gd/tests/imagechar_error7.phpt deleted file mode 100644 index b2c7d80b70..0000000000 --- a/ext/gd/tests/imagechar_error7.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error on non-long parameter 6 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 -$image = imagecreatetruecolor(180, 30); -$result = imagechar($image, 1, 5, 5, 'C', 'font'); - -?> ---EXPECTF-- -Warning: imagechar() expects parameter 6 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagecharup_error1.phpt b/ext/gd/tests/imagecharup_error1.phpt deleted file mode 100644 index aaa2a2a68f..0000000000 --- a/ext/gd/tests/imagecharup_error1.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error on non-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 - -$result = imagecharup('string', 1, 5, 5, 'C', 1); - -?> ---EXPECTF-- -Warning: imagecharup() expects parameter 1 to be resource, %s given in %s on line %d diff --git a/ext/gd/tests/imagecharup_error3.phpt b/ext/gd/tests/imagecharup_error3.phpt deleted file mode 100644 index 8c614520bb..0000000000 --- a/ext/gd/tests/imagecharup_error3.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error on non-long parameter 2 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 -$image = imagecreatetruecolor(180, 30); -$result = imagecharup($image, 'string', 5, 5, 'C', 1); - -?> ---EXPECTF-- -Warning: imagecharup() expects parameter 2 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagecharup_error4.phpt b/ext/gd/tests/imagecharup_error4.phpt deleted file mode 100644 index 62de44f842..0000000000 --- a/ext/gd/tests/imagecharup_error4.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error on non-long parameter 3 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 -$image = imagecreatetruecolor(180, 30); -$result = imagecharup($image, 1, 'string', 5, 'C', 1); - -?> ---EXPECTF-- -Warning: imagecharup() expects parameter 3 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagecharup_error5.phpt b/ext/gd/tests/imagecharup_error5.phpt deleted file mode 100644 index 42661263d0..0000000000 --- a/ext/gd/tests/imagecharup_error5.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error on non-long parameter 4 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 -$image = imagecreatetruecolor(180, 30); -$result = imagecharup($image, 1, 5, 'string', 'C', 1); - -?> ---EXPECTF-- -Warning: imagecharup() expects parameter 4 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagecharup_error6.phpt b/ext/gd/tests/imagecharup_error6.phpt deleted file mode 100644 index c7f40d576c..0000000000 --- a/ext/gd/tests/imagecharup_error6.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error on non-string parameter 5 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 -$image = imagecreatetruecolor(180, 30); -$result = imagecharup($image, 1, 5, 5, $image, 1); - -?> ---EXPECTF-- -Warning: imagecharup() expects parameter 5 to be string%S, %s given in %s on line %d diff --git a/ext/gd/tests/imagecharup_error7.phpt b/ext/gd/tests/imagecharup_error7.phpt deleted file mode 100644 index 207154f11c..0000000000 --- a/ext/gd/tests/imagecharup_error7.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error on non-long parameter 6 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 -$image = imagecreatetruecolor(180, 30); -$result = imagecharup($image, 1, 5, 5, 'C', 'font'); - -?> ---EXPECTF-- -Warning: imagecharup() expects parameter 6 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagecolorallocate_error.phpt b/ext/gd/tests/imagecolorallocate_error.phpt deleted file mode 100644 index c2ed9446d6..0000000000 --- a/ext/gd/tests/imagecolorallocate_error.phpt +++ /dev/null @@ -1,49 +0,0 @@ ---TEST-- -Test imagecolorallocate() function : error conditions ---SKIPIF-- -<?php -if(!extension_loaded('gd')) { - die('skip gd extension is not loaded'); -} -?> ---FILE-- -<?php -/* Prototype : int imagecolorallocate(resource im, int red, int green, int blue) - * Description: Allocate a color for an image - * Source code: ext/gd/gd.c - */ - -$red = 10; -$green = 10; -$blue = 10; -$extra_arg = 10; -$im = imagecreate(200, 200); - -echo "*** Testing imagecolorallocate() : error conditions ***\n"; - -//Test imagecolorallocate with one more than the expected number of arguments -echo "\n-- Testing imagecolorallocate() function with more than expected no. of arguments --\n"; -var_dump( imagecolorallocate($im, $red, $green, $blue, $extra_arg) ); - -// Testing imagecolorallocate with one less than the expected number of arguments -echo "\n-- Testing imagecolorallocate() function with less than expected no. of arguments --\n"; -var_dump( imagecolorallocate() ); -var_dump( imagecolorallocate($im, $red, $green) ); -?> -===DONE=== ---EXPECTF-- -*** Testing imagecolorallocate() : error conditions *** - --- Testing imagecolorallocate() function with more than expected no. of arguments -- - -Warning: imagecolorallocate() expects exactly 4 parameters, 5 given in %s on line %d -NULL - --- Testing imagecolorallocate() function with less than expected no. of arguments -- - -Warning: imagecolorallocate() expects exactly 4 parameters, 0 given in %s on line %d -NULL - -Warning: imagecolorallocate() expects exactly 4 parameters, 3 given in %s on line %d -NULL -===DONE=== diff --git a/ext/gd/tests/imagecolorallocate_variation1.phpt b/ext/gd/tests/imagecolorallocate_variation1.phpt deleted file mode 100644 index 37d9f95a89..0000000000 --- a/ext/gd/tests/imagecolorallocate_variation1.phpt +++ /dev/null @@ -1,267 +0,0 @@ ---TEST-- -Test imagecolorallocate() function : usage variations - passing different data types to first argument ---SKIPIF-- -<?php -if(!extension_loaded('gd')) { - die('skip gd extension is not loaded'); -} -?> ---FILE-- -<?php -/* Prototype : int imagecolorallocate(resource im, int red, int green, int blue) - * Description: Allocate a color for an image - * Source code: ext/gd/gd.c - */ - -echo "*** Testing imagecolorallocate() : usage variations ***\n"; - -// Initialise function arguments not being substituted (if any) -$red = 10; -$green = 10; -$blue = 10; - -$fp = tmpfile(); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$values = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 10.1234567e10' => 10.1234567e10, - 'float 10.7654321E-10' => 10.7654321E-10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - //resource - "file resource" => $fp -); - -// loop through each element of the array for im -foreach($values as $key => $value) { - echo "\n-- $key --\n"; - var_dump( imagecolorallocate($value, $red, $green, $blue) ); -}; -?> -===DONE=== ---EXPECTF-- -*** Testing imagecolorallocate() : usage variations *** - --- int 0 -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, int given in %s on line %d -NULL - --- int 1 -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, int given in %s on line %d -NULL - --- int 12345 -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, int given in %s on line %d -NULL - --- int -12345 -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, int given in %s on line %d -NULL - --- float 10.5 -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, float given in %s on line %d -NULL - --- float -10.5 -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, float given in %s on line %d -NULL - --- float 10.1234567e10 -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, float given in %s on line %d -NULL - --- float 10.7654321E-10 -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, float given in %s on line %d -NULL - --- float .5 -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, float given in %s on line %d -NULL - --- empty array -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, array given in %s on line %d -NULL - --- int indexed array -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, array given in %s on line %d -NULL - --- associative array -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, array given in %s on line %d -NULL - --- nested arrays -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, array given in %s on line %d -NULL - --- uppercase NULL -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, null given in %s on line %d -NULL - --- lowercase null -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, null given in %s on line %d -NULL - --- lowercase true -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, bool given in %s on line %d -NULL - --- lowercase false -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, bool given in %s on line %d -NULL - --- uppercase TRUE -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, bool given in %s on line %d -NULL - --- uppercase FALSE -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, bool given in %s on line %d -NULL - --- empty string DQ -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, string given in %s on line %d -NULL - --- empty string SQ -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, string given in %s on line %d -NULL - --- string DQ -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, string given in %s on line %d -NULL - --- string SQ -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, string given in %s on line %d -NULL - --- mixed case string -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, string given in %s on line %d -NULL - --- heredoc -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, string given in %s on line %d -NULL - --- instance of classWithToString -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, object given in %s on line %d -NULL - --- instance of classWithoutToString -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, object given in %s on line %d -NULL - --- undefined var -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, null given in %s on line %d -NULL - --- unset var -- - -Warning: imagecolorallocate() expects parameter 1 to be resource, null given in %s on line %d -NULL - --- file resource -- - -Warning: imagecolorallocate(): supplied resource is not a valid Image resource in %s on line %d -bool(false) -===DONE=== diff --git a/ext/gd/tests/imagecolorallocate_variation2.phpt b/ext/gd/tests/imagecolorallocate_variation2.phpt deleted file mode 100644 index e46e0da960..0000000000 --- a/ext/gd/tests/imagecolorallocate_variation2.phpt +++ /dev/null @@ -1,215 +0,0 @@ ---TEST-- -Test imagecolorallocate() function : usage variations - passing different data types to second argument ---SKIPIF-- -<?php -if(!extension_loaded('gd')) { - die('skip gd extension is not loaded'); -} -if(!function_exists('imagecreatetruecolor')) { - die('skip imagecreatetruecolor function is not available'); -} -if (PHP_INT_SIZE != 8) die('skip 64-bit only'); -?> ---FILE-- -<?php -/* Prototype : int imagecolorallocate(resource im, int red, int green, int blue) - * Description: Allocate a color for an image - * Source code: ext/gd/gd.c - */ - -echo "*** Testing imagecolorallocate() : usage variations ***\n"; - -$im = imagecreatetruecolor(200, 200); -$green = 10; -$blue = 10; - -$fp = tmpfile(); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$values = array( - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 10.1234567e10' => 10.1234567e10, - 'float 10.7654321E-10' => 10.7654321E-10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - //resource - "file resource" => $fp -); -// loop through each element of the array for red -foreach($values as $key => $value) { - echo "\n--$key--\n"; - var_dump( imagecolorallocate($im, $value, $green, $blue) ); -}; -?> -===DONE=== ---EXPECTF-- -*** Testing imagecolorallocate() : usage variations *** - ---float 10.5-- -int(657930) - ---float -10.5-- -bool(false) - ---float 10.1234567e10-- -bool(false) - ---float 10.7654321E-10-- -int(2570) - ---float .5-- -int(2570) - ---empty array-- - -Warning: imagecolorallocate() expects parameter 2 to be int, array given in %s on line %d -NULL - ---int indexed array-- - -Warning: imagecolorallocate() expects parameter 2 to be int, array given in %s on line %d -NULL - ---associative array-- - -Warning: imagecolorallocate() expects parameter 2 to be int, array given in %s on line %d -NULL - ---nested arrays-- - -Warning: imagecolorallocate() expects parameter 2 to be int, array given in %s on line %d -NULL - ---uppercase NULL-- -int(2570) - ---lowercase null-- -int(2570) - ---lowercase true-- -int(68106) - ---lowercase false-- -int(2570) - ---uppercase TRUE-- -int(68106) - ---uppercase FALSE-- -int(2570) - ---empty string DQ-- - -Warning: imagecolorallocate() expects parameter 2 to be int, string given in %s on line %d -NULL - ---empty string SQ-- - -Warning: imagecolorallocate() expects parameter 2 to be int, string given in %s on line %d -NULL - ---string DQ-- - -Warning: imagecolorallocate() expects parameter 2 to be int, string given in %s on line %d -NULL - ---string SQ-- - -Warning: imagecolorallocate() expects parameter 2 to be int, string given in %s on line %d -NULL - ---mixed case string-- - -Warning: imagecolorallocate() expects parameter 2 to be int, string given in %s on line %d -NULL - ---heredoc-- - -Warning: imagecolorallocate() expects parameter 2 to be int, string given in %s on line %d -NULL - ---instance of classWithToString-- - -Warning: imagecolorallocate() expects parameter 2 to be int, object given in %s on line %d -NULL - ---instance of classWithoutToString-- - -Warning: imagecolorallocate() expects parameter 2 to be int, object given in %s on line %d -NULL - ---undefined var-- -int(2570) - ---unset var-- -int(2570) - ---file resource-- - -Warning: imagecolorallocate() expects parameter 2 to be int, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/gd/tests/imagecolorallocate_variation3.phpt b/ext/gd/tests/imagecolorallocate_variation3.phpt deleted file mode 100644 index 8552f976c7..0000000000 --- a/ext/gd/tests/imagecolorallocate_variation3.phpt +++ /dev/null @@ -1,214 +0,0 @@ ---TEST-- -Test imagecolorallocate() function : usage variations - passing different data types to third argument ---SKIPIF-- -<?php -if(!extension_loaded('gd')) { - die('skip gd extension is not loaded'); -} -if(!function_exists('imagecreatetruecolor')) { - die('skip imagecreatetruecolor function is not available'); -} -?> ---FILE-- -<?php -/* Prototype : imagecolorallocate(resource im, int red, int green, int blue) - * Description: Allocate a color for an image - * Source code: ext/gd/gd.c - */ - -echo "*** Testing imagecolorallocate() : usage variations ***\n"; - -$im = imagecreatetruecolor(200, 200); -$red = 10; -$blue = 10; - -$fp = tmpfile(); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$values = array( - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 10.1234567e5' => 10.1234567e5, - 'float 10.7654321E-5' => 10.7654321E-5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - //resource - "file resource" => $fp -); -// loop through each element of the array for red -foreach($values as $key => $value) { - echo "\n--$key--\n"; - var_dump( imagecolorallocate($im, $red, $value, $blue) ); -}; -?> -===DONE=== ---EXPECTF-- -*** Testing imagecolorallocate() : usage variations *** - ---float 10.5-- -int(657930) - ---float -10.5-- -int(652810) - ---float 10.1234567e5-- -int(259815690) - ---float 10.7654321E-5-- -int(655370) - ---float .5-- -int(655370) - ---empty array-- - -Warning: imagecolorallocate() expects parameter 3 to be int, array given in %s on line %d -NULL - ---int indexed array-- - -Warning: imagecolorallocate() expects parameter 3 to be int, array given in %s on line %d -NULL - ---associative array-- - -Warning: imagecolorallocate() expects parameter 3 to be int, array given in %s on line %d -NULL - ---nested arrays-- - -Warning: imagecolorallocate() expects parameter 3 to be int, array given in %s on line %d -NULL - ---uppercase NULL-- -int(655370) - ---lowercase null-- -int(655370) - ---lowercase true-- -int(655626) - ---lowercase false-- -int(655370) - ---uppercase TRUE-- -int(655626) - ---uppercase FALSE-- -int(655370) - ---empty string DQ-- - -Warning: imagecolorallocate() expects parameter 3 to be int, string given in %s on line %d -NULL - ---empty string SQ-- - -Warning: imagecolorallocate() expects parameter 3 to be int, string given in %s on line %d -NULL - ---string DQ-- - -Warning: imagecolorallocate() expects parameter 3 to be int, string given in %s on line %d -NULL - ---string SQ-- - -Warning: imagecolorallocate() expects parameter 3 to be int, string given in %s on line %d -NULL - ---mixed case string-- - -Warning: imagecolorallocate() expects parameter 3 to be int, string given in %s on line %d -NULL - ---heredoc-- - -Warning: imagecolorallocate() expects parameter 3 to be int, string given in %s on line %d -NULL - ---instance of classWithToString-- - -Warning: imagecolorallocate() expects parameter 3 to be int, object given in %s on line %d -NULL - ---instance of classWithoutToString-- - -Warning: imagecolorallocate() expects parameter 3 to be int, object given in %s on line %d -NULL - ---undefined var-- -int(655370) - ---unset var-- -int(655370) - ---file resource-- - -Warning: imagecolorallocate() expects parameter 3 to be int, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/gd/tests/imagecolorallocate_variation4.phpt b/ext/gd/tests/imagecolorallocate_variation4.phpt deleted file mode 100644 index ad8908eeea..0000000000 --- a/ext/gd/tests/imagecolorallocate_variation4.phpt +++ /dev/null @@ -1,214 +0,0 @@ ---TEST-- -Test imagecolorallocate() function : usage variations - passing different data types to fourth argument ---SKIPIF-- -<?php -if(!extension_loaded('gd')) { - die('skip gd extension is not loaded'); -} -if(!function_exists('imagecreatetruecolor')) { - die('skip imagecreatetruecolor function is not available'); -} -if (PHP_INT_SIZE != 8) die('skip 64-bit only'); -?> ---FILE-- -<?php -/* Prototype : int imagecolorallocate(resource im, int red, int green, int blue) - * Description: Allocate a color for an image - * Source code: ext/gd/gd.c - */ -echo "*** Testing imagecolorallocate() : usage variations ***\n"; - -$im = imagecreatetruecolor(200, 200); -$red = 10; -$green = 10; - -$fp = tmpfile(); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$values = array( - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 10.1234567e10' => 10.1234567e10, - 'float 10.7654321E-10' => 10.7654321E-10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - //resource - "file resource" => $fp -); -// loop through each element of the array for red -foreach($values as $key => $value) { - echo "\n--$key--\n"; - var_dump( imagecolorallocate($im, $red, $green, $value) ); -}; -?> -===DONE=== ---EXPECTF-- -*** Testing imagecolorallocate() : usage variations *** - ---float 10.5-- -int(657930) - ---float -10.5-- -int(657910) - ---float 10.1234567e10-- -bool(false) - ---float 10.7654321E-10-- -int(657920) - ---float .5-- -int(657920) - ---empty array-- - -Warning: imagecolorallocate() expects parameter 4 to be int, array given in %s on line %d -NULL - ---int indexed array-- - -Warning: imagecolorallocate() expects parameter 4 to be int, array given in %s on line %d -NULL - ---associative array-- - -Warning: imagecolorallocate() expects parameter 4 to be int, array given in %s on line %d -NULL - ---nested arrays-- - -Warning: imagecolorallocate() expects parameter 4 to be int, array given in %s on line %d -NULL - ---uppercase NULL-- -int(657920) - ---lowercase null-- -int(657920) - ---lowercase true-- -int(657921) - ---lowercase false-- -int(657920) - ---uppercase TRUE-- -int(657921) - ---uppercase FALSE-- -int(657920) - ---empty string DQ-- - -Warning: imagecolorallocate() expects parameter 4 to be int, string given in %s on line %d -NULL - ---empty string SQ-- - -Warning: imagecolorallocate() expects parameter 4 to be int, string given in %s on line %d -NULL - ---string DQ-- - -Warning: imagecolorallocate() expects parameter 4 to be int, string given in %s on line %d -NULL - ---string SQ-- - -Warning: imagecolorallocate() expects parameter 4 to be int, string given in %s on line %d -NULL - ---mixed case string-- - -Warning: imagecolorallocate() expects parameter 4 to be int, string given in %s on line %d -NULL - ---heredoc-- - -Warning: imagecolorallocate() expects parameter 4 to be int, string given in %s on line %d -NULL - ---instance of classWithToString-- - -Warning: imagecolorallocate() expects parameter 4 to be int, object given in %s on line %d -NULL - ---instance of classWithoutToString-- - -Warning: imagecolorallocate() expects parameter 4 to be int, object given in %s on line %d -NULL - ---undefined var-- -int(657920) - ---unset var-- -int(657920) - ---file resource-- - -Warning: imagecolorallocate() expects parameter 4 to be int, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/gd/tests/imagecolorallocatealpha_error2.phpt b/ext/gd/tests/imagecolorallocatealpha_error2.phpt deleted file mode 100644 index fffd0557c6..0000000000 --- a/ext/gd/tests/imagecolorallocatealpha_error2.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Testing imagecolorallocatealpha(): Wrong types for parameter 2 ---CREDITS-- -Rafael Dohms <rdohms [at] gmail [dot] com> ---SKIPIF-- -<?php - if (!extension_loaded("gd")) die("skip GD not present"); -?> ---FILE-- -<?php -$img = imagecreatetruecolor(200, 200); - -imagecolorallocatealpha($img, 'string-non-numeric', 255, 255, 50); -imagecolorallocatealpha($img, array(), 255, 255, 50); -imagecolorallocatealpha($img, tmpfile(), 255, 255, 50); -?> ---EXPECTF-- -Warning: imagecolorallocatealpha() expects parameter 2 to be int, %s given in %s on line %d - -Warning: imagecolorallocatealpha() expects parameter 2 to be int, array given in %s on line %d - -Warning: imagecolorallocatealpha() expects parameter 2 to be int, resource given in %s on line %d diff --git a/ext/gd/tests/imagecolorallocatealpha_error3.phpt b/ext/gd/tests/imagecolorallocatealpha_error3.phpt deleted file mode 100644 index 11d483db95..0000000000 --- a/ext/gd/tests/imagecolorallocatealpha_error3.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Testing imagecolorallocatealpha(): Wrong types for parameter 3 ---CREDITS-- -Rafael Dohms <rdohms [at] gmail [dot] com> ---SKIPIF-- -<?php - if (!extension_loaded("gd")) die("skip GD not present"); -?> ---FILE-- -<?php -$img = imagecreatetruecolor(200, 200); - -imagecolorallocatealpha($img, 255, 'string-non-numeric', 255, 50); -imagecolorallocatealpha($img, 255, array(), 255, 50); -imagecolorallocatealpha($img, 255, tmpfile(), 255, 50); -?> ---EXPECTF-- -Warning: imagecolorallocatealpha() expects parameter 3 to be int, %s given in %s on line %d - -Warning: imagecolorallocatealpha() expects parameter 3 to be int, array given in %s on line %d - -Warning: imagecolorallocatealpha() expects parameter 3 to be int, resource given in %s on line %d diff --git a/ext/gd/tests/imagecolorallocatealpha_error4.phpt b/ext/gd/tests/imagecolorallocatealpha_error4.phpt deleted file mode 100644 index 093d9cda55..0000000000 --- a/ext/gd/tests/imagecolorallocatealpha_error4.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Testing imagecolorallocatealpha(): Wrong types for parameter 4 ---CREDITS-- -Rafael Dohms <rdohms [at] gmail [dot] com> ---SKIPIF-- -<?php - if (!extension_loaded("gd")) die("skip GD not present"); -?> ---FILE-- -<?php -$img = imagecreatetruecolor(200, 200); - -imagecolorallocatealpha($img, 255, 255, 'string-non-numeric', 50); -imagecolorallocatealpha($img, 255, 255, array(), 50); -imagecolorallocatealpha($img, 255, 255, tmpfile(), 50); -?> ---EXPECTF-- -Warning: imagecolorallocatealpha() expects parameter 4 to be int, %s given in %s on line %d - -Warning: imagecolorallocatealpha() expects parameter 4 to be int, array given in %s on line %d - -Warning: imagecolorallocatealpha() expects parameter 4 to be int, resource given in %s on line %d diff --git a/ext/gd/tests/imagecolorallocatealpha_error5.phpt b/ext/gd/tests/imagecolorallocatealpha_error5.phpt deleted file mode 100644 index 2cf5054a0e..0000000000 --- a/ext/gd/tests/imagecolorallocatealpha_error5.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Testing imagecolorallocatealpha(): Wrong types for parameter 5 ---CREDITS-- -Rafael Dohms <rdohms [at] gmail [dot] com> ---SKIPIF-- -<?php - if (!extension_loaded("gd")) die("skip GD not present"); -?> ---FILE-- -<?php -$img = imagecreatetruecolor(200, 200); - -imagecolorallocatealpha($img, 255, 255, 255, 'string-non-numeric'); -imagecolorallocatealpha($img, 255, 255, 255, array()); -imagecolorallocatealpha($img, 255, 255, 255, tmpfile()); -?> ---EXPECTF-- -Warning: imagecolorallocatealpha() expects parameter 5 to be int, %s given in %s on line %d - -Warning: imagecolorallocatealpha() expects parameter 5 to be int, array given in %s on line %d - -Warning: imagecolorallocatealpha() expects parameter 5 to be int, resource given in %s on line %d diff --git a/ext/gd/tests/imagecolorclosesthwb.phpt b/ext/gd/tests/imagecolorclosesthwb.phpt deleted file mode 100644 index efe9c5035e..0000000000 --- a/ext/gd/tests/imagecolorclosesthwb.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -imagecolorclosesthwb() test ---SKIPIF-- -<?php - if(!extension_loaded('gd')){ die('skip: gd extension not available'); } - if(!function_exists('imagecolorclosesthwb')){ die('skip: imagecolorclosesthwb() not available'); } -?> ---FILE-- -<?php - $im = imagecreatefrompng(dirname(__FILE__).'/test.png'); - - var_dump(imagecolorclosesthwb($im, 255, 50, 0)); - - var_dump(imagecolorclosesthwb(NULL)); - var_dump(imagecolorclosesthwb(NULL, NULL, NULL, NULL)); - var_dump(imagecolorclosesthwb($im, "hello", "from", "gd")); - - imagedestroy($im); -?> ---EXPECTF-- -int(16724480) - -Warning: imagecolorclosesthwb() expects exactly 4 parameters, 1 given in %s on line %d -NULL - -Warning: imagecolorclosesthwb() expects parameter 1 to be resource, null given in %s on line %d -NULL - -Warning: imagecolorclosesthwb() expects parameter 2 to be int, string given in %s on line %d -NULL diff --git a/ext/gd/tests/imagecolorclosesthwb_basic_001.phpt b/ext/gd/tests/imagecolorclosesthwb_basic_001.phpt new file mode 100644 index 0000000000..09113bcda7 --- /dev/null +++ b/ext/gd/tests/imagecolorclosesthwb_basic_001.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test imagecolorclosesthwb() basic functionality +--SKIPIF-- +<?php + if (!extension_loaded('gd')) { + die("skip gd extension not available."); + } +?> +--FILE-- +<?php + // Create the size of image or blank image + $image = imagecreate(500, 200); + + // Set the background color of image + $background_color = imagecolorallocate($image, 0, 24, 200); + + // Set the text color of image + $text_color = imagecolorallocate($image, 255, 255, 255); + + // Function to create image which contains string. + imagestring($image, 5, 180, 100, "PHP is awesome", $text_color); + imagestring($image, 3, 120, 120, "A test for PHP imagecolorclosesthwb function", $text_color); + + var_dump(imagecolorclosesthwb($image, 0, 115, 152)); // 0 + var_dump(imagecolorclosesthwb($image, 0, 24, 200)); // 0 + var_dump(imagecolorclosesthwb($image, 116, 120, 115)); // 1 + var_dump(imagecolorclosesthwb($image, 50, 0, 90)); // 0 + + imagedestroy($image); +?> +--EXPECT-- +int(0) +int(0) +int(1) +int(0) diff --git a/ext/gd/tests/imagecolordeallocate_error2.phpt b/ext/gd/tests/imagecolordeallocate_error2.phpt deleted file mode 100644 index ca880529b8..0000000000 --- a/ext/gd/tests/imagecolordeallocate_error2.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -Testing imagecolordeallocate() of GD library with no resource ---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); -$result = imagecolordeallocate('image', $white); - -?> ---EXPECTF-- -Warning: imagecolordeallocate() expects parameter 1 to be resource, %s given %s on line %d diff --git a/ext/gd/tests/imagecolormatch_error1.phpt b/ext/gd/tests/imagecolormatch_error1.phpt deleted file mode 100644 index 5e8d82cc39..0000000000 --- a/ext/gd/tests/imagecolormatch_error1.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Send only 1 parameter imagecolormatch() of GD library ---CREDITS-- -Paulo Alves de Sousa Filho <pspalves [at] gmail [dot] com> -#testfest PHPSP on 2009-06-20 ---SKIPIF-- -<?php -if (!extension_loaded("gd")) die("skip GD not present"); -?> ---FILE-- -<?php -$ima = imagecreatetruecolor(110, 20); -$background_color = imagecolorallocate($ima, 0, 0, 0); -var_dump(imagecolormatch($ima)); -?> ---EXPECTF-- -Warning: imagecolormatch() expects exactly 2 parameters, %d given in %s on line %d -NULL diff --git a/ext/gd/tests/imagecolorresolvealpha_error3.phpt b/ext/gd/tests/imagecolorresolvealpha_error3.phpt deleted file mode 100644 index 586e1f8461..0000000000 --- a/ext/gd/tests/imagecolorresolvealpha_error3.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -test imagecolorresolvealpha without arguments ---CREDITS-- -Marcelo Diniz <marcelo.leo27 [at] gmail [dot] com -#phpspMaisTestFest PHPSP on 2014-07-05 ---SKIPIF-- -<?php - if (!extension_loaded('gd')) die("skip gd extension not available."); -?> ---FILE-- -<?php -imagecolorresolvealpha(); -?> ---EXPECTF-- -Warning: imagecolorresolvealpha() expects exactly 5 parameters, 0 given in %s on line %d diff --git a/ext/gd/tests/imagecolorstotal_basic.phpt b/ext/gd/tests/imagecolorstotal_basic.phpt index 9ae79d2224..22eb022fc2 100644 --- a/ext/gd/tests/imagecolorstotal_basic.phpt +++ b/ext/gd/tests/imagecolorstotal_basic.phpt @@ -20,7 +20,7 @@ if(!function_exists('imagecolorstotal') || !function_exists('imagecreatefromgif' echo "*** Testing imagecolorstotal() : basic functionality ***\n"; // Get an image -$gif = dirname(__FILE__)."/php.gif"; +$gif = __DIR__."/php.gif"; $im = imagecreatefromgif($gif); echo 'Total colors in image: ' . imagecolorstotal($im); diff --git a/ext/gd/tests/imageconvolution_error1.phpt b/ext/gd/tests/imageconvolution_error1.phpt deleted file mode 100644 index 7090bf4a57..0000000000 --- a/ext/gd/tests/imageconvolution_error1.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -Testing wrong param passing imageconvolution() 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 = imagecreatetruecolor(180, 30); - -// Writes the text and apply a gaussian blur on the image -imagestring($image, 5, 10, 8, 'Gaussian Blur Text', 0x00ff00); - -$gaussian = array( - array(1.0, 2.0, 1.0), - array(2.0, 4.0, 2.0), - array(1.0, 2.0, 1.0) -); - -var_dump(imageconvolution($image, $gaussian, 16)); -?> ---EXPECTF-- -Warning: imageconvolution() expects exactly 4 parameters, 3 given in %s on line %d -bool(false) diff --git a/ext/gd/tests/imagecopymerge_error.phpt b/ext/gd/tests/imagecopymerge_error.phpt deleted file mode 100644 index 90d9c55871..0000000000 --- a/ext/gd/tests/imagecopymerge_error.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing wrong parameter passing imagecopymerge() of GD library ---CREDITS-- -Cleston Viel Vieira de Sousa <cleston [dot] vs [at] gmail [dot] com> -#testfest PHPSP on 2009-06-20 ---SKIPIF-- -<?php -if (!extension_loaded("gd")) die("skip GD not present"); -?> ---FILE-- -<?php - -imagecopymerge(); - -?> ---EXPECTF-- -Warning: imagecopymerge() expects exactly 9 parameters, 0 given in %s on line %d diff --git a/ext/gd/tests/imagecreatetruecolor_error1.phpt b/ext/gd/tests/imagecreatetruecolor_error1.phpt deleted file mode 100644 index 349ed8cad0..0000000000 --- a/ext/gd/tests/imagecreatetruecolor_error1.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Testing imagecreatetruecolor(): error on non-long 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 -$image = imagecreatetruecolor('s', 30); -$image = imagecreatetruecolor(30, 's'); -?> ---EXPECTF-- -Warning: imagecreatetruecolor() expects parameter 1 to be int, %s given in %s on line %d - -Warning: imagecreatetruecolor() expects parameter 2 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagecreatetruecolor_error3.phpt b/ext/gd/tests/imagecreatetruecolor_error3.phpt deleted file mode 100644 index 932cad5ea2..0000000000 --- a/ext/gd/tests/imagecreatetruecolor_error3.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Testing imagecreatetruecolor(): error on wrong parameter count ---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 -$image = imagecreatetruecolor(); -$image = imagecreatetruecolor(30); -$image = imagecreatetruecolor(1,1,1); -?> ---EXPECTF-- -Warning: imagecreatetruecolor() expects exactly 2 parameters, 0 given in %s on line %d - -Warning: imagecreatetruecolor() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: imagecreatetruecolor() expects exactly 2 parameters, 3 given in %s on line %d diff --git a/ext/gd/tests/imagecrop_auto-ext.phpt b/ext/gd/tests/imagecrop_auto-ext.phpt deleted file mode 100644 index cc88e5d657..0000000000 --- a/ext/gd/tests/imagecrop_auto-ext.phpt +++ /dev/null @@ -1,85 +0,0 @@ ---TEST-- -Testing imagecropauto() ---SKIPIF-- -<?php -if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' ); -if (GD_BUNDLED) die('skip requires external libgd'); -?> ---FILE-- -<?php - -echo "TC IMG_CROP_DEFAULT\n"; -$im = imagecreatetruecolor(99, 99); -imagefilledrectangle($im, 20, 20, 30, 30, 0xff); -$im_crop = imagecropauto($im, IMG_CROP_DEFAULT); -var_dump(imagesx($im_crop)); -var_dump(imagesy($im_crop)); - -echo "Palette IMG_CROP_DEFAULT\n"; -$im = imagecreate(99, 99); -imagefilledrectangle($im, 20, 20, 30, 30, 0xff); -$im_crop = imagecropauto($im, IMG_CROP_DEFAULT); -var_dump(imagesx($im_crop)); -var_dump(imagesy($im_crop)); - -echo "TC IMG_CROP_SIDES\n"; -$im = imagecreatetruecolor(99, 99); -imagefilledrectangle($im, 20, 20, 30, 30, 0xff); -$im_crop = imagecropauto($im, IMG_CROP_SIDES); -var_dump(imagesx($im_crop)); -var_dump(imagesy($im_crop)); - -echo "Palette IMG_CROP_SIDES\n"; -$im = imagecreate(99, 99); -imagefilledrectangle($im, 20, 20, 30, 30, 0xff); -$im_crop = imagecropauto($im, IMG_CROP_SIDES); -var_dump(imagesx($im_crop)); -var_dump(imagesy($im_crop)); - -echo "TC IMG_CROP_BLACK\n"; -$im = imagecreatetruecolor(50, 50); -imagefilledrectangle($im, 20, 20, 30, 30, 0xff); -$im_crop = imagecropauto($im, IMG_CROP_BLACK); -var_dump(imagesx($im_crop)); -var_dump(imagesy($im_crop)); - -echo "Palette IMG_CROP_BLACK\n"; -$im = imagecreate(50, 50); -$bgd = imagecolorallocate($im, 0, 0, 0); -$b = imagecolorallocate($im, 0, 0, 255); -imagefilledrectangle($im, 20, 20, 30, 30, 0xff); -$im_crop = imagecropauto($im, IMG_CROP_BLACK); -var_dump(imagesx($im_crop)); -var_dump(imagesy($im_crop)); - -echo "IMG_CROP_THRESHOLD\n"; -$im = imagecreatefrompng(__DIR__ . "/logo_noise.png"); -$im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0); -imagepng($im_crop, __DIR__ . "/crop_threshold.png"); -var_dump(imagesx($im_crop)); -var_dump(imagesy($im_crop)); - -@unlink(__DIR__ . "/crop_threshold.png"); -?> ---EXPECT-- -TC IMG_CROP_DEFAULT -int(99) -int(99) -Palette IMG_CROP_DEFAULT -int(99) -int(99) -TC IMG_CROP_SIDES -int(11) -int(11) -Palette IMG_CROP_SIDES -int(11) -int(11) -TC IMG_CROP_BLACK -int(11) -int(11) -Palette IMG_CROP_BLACK -int(11) -int(11) -IMG_CROP_THRESHOLD -int(240) -int(134) diff --git a/ext/gd/tests/imagecrop_auto.phpt b/ext/gd/tests/imagecrop_auto.phpt index b12cc971ee..97cac3da01 100644 --- a/ext/gd/tests/imagecrop_auto.phpt +++ b/ext/gd/tests/imagecrop_auto.phpt @@ -3,7 +3,6 @@ Testing imagecropauto() --SKIPIF-- <?php if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' ); -if (!GD_BUNDLED) die('skip requires bundled libgd'); ?> --FILE-- <?php @@ -63,11 +62,11 @@ var_dump(imagesy($im_crop)); ?> --EXPECT-- TC IMG_CROP_DEFAULT -int(11) -int(11) +int(99) +int(99) Palette IMG_CROP_DEFAULT -int(11) -int(11) +int(99) +int(99) TC IMG_CROP_SIDES int(11) int(11) diff --git a/ext/gd/tests/imageellipse_error1.phpt b/ext/gd/tests/imageellipse_error1.phpt deleted file mode 100644 index 476b5daa75..0000000000 --- a/ext/gd/tests/imageellipse_error1.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Testing wrong param passing imageellipse() 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(400, 300); - -// try to draw a white ellipse -imageellipse('wrong param', 200, 150, 300, 200, 16777215); - -?> ---EXPECTF-- -Warning: imageellipse() expects parameter 1 to be resource, %s given in %s on line %d diff --git a/ext/gd/tests/imageellipse_error2.phpt b/ext/gd/tests/imageellipse_error2.phpt deleted file mode 100644 index defa52c06f..0000000000 --- a/ext/gd/tests/imageellipse_error2.phpt +++ /dev/null @@ -1,21 +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 image -$image = imagecreatetruecolor(400, 300); - -// try to draw a white ellipse -imageellipse($image, 'wrong param', 150, 300, 200, 16777215); - -?> ---EXPECTF-- -Warning: imageellipse() expects parameter 2 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imageellipse_error3.phpt b/ext/gd/tests/imageellipse_error3.phpt deleted file mode 100644 index b021fdb350..0000000000 --- a/ext/gd/tests/imageellipse_error3.phpt +++ /dev/null @@ -1,21 +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 image -$image = imagecreatetruecolor(400, 300); - -// try to draw a white ellipse -imageellipse($image, 200, 'wrong param', 300, 200, 16777215); - -?> ---EXPECTF-- -Warning: imageellipse() expects parameter 3 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imageellipse_error4.phpt b/ext/gd/tests/imageellipse_error4.phpt deleted file mode 100644 index 3af4398a88..0000000000 --- a/ext/gd/tests/imageellipse_error4.phpt +++ /dev/null @@ -1,21 +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 image -$image = imagecreatetruecolor(400, 300); - -// try to draw a white ellipse -imageellipse($image, 200, 150, 'wrong param', 200, 16777215); - -?> ---EXPECTF-- -Warning: imageellipse() expects parameter 4 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imageellipse_error5.phpt b/ext/gd/tests/imageellipse_error5.phpt deleted file mode 100644 index 62b54145a3..0000000000 --- a/ext/gd/tests/imageellipse_error5.phpt +++ /dev/null @@ -1,21 +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 image -$image = imagecreatetruecolor(400, 300); - -// try to draw a white ellipse -imageellipse($image, 200, 150, 300, 'wrong param', 16777215); - -?> ---EXPECTF-- -Warning: imageellipse() expects parameter 5 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imageellipse_error6.phpt b/ext/gd/tests/imageellipse_error6.phpt deleted file mode 100644 index 74d1ac2f1e..0000000000 --- a/ext/gd/tests/imageellipse_error6.phpt +++ /dev/null @@ -1,21 +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 image -$image = imagecreatetruecolor(400, 300); - -// try to draw a white ellipse -imageellipse($image, 200, 150, 300, 200, 'wrong param'); - -?> ---EXPECTF-- -Warning: imageellipse() expects parameter 6 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imageellipse_error8.phpt b/ext/gd/tests/imageellipse_error8.phpt deleted file mode 100644 index 5be5a12c39..0000000000 --- a/ext/gd/tests/imageellipse_error8.phpt +++ /dev/null @@ -1,21 +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; skipping test' ); -?> ---FILE-- -<?php - -// Create a image -$image = imagecreatetruecolor( 400, 300 ); - -// try to draw a white ellipse -imageellipse( $image, 200, 150, 300, 200 ); - -?> ---EXPECTF-- -Warning: imageellipse() expects exactly 6 parameters, %d given in %s on line %d diff --git a/ext/gd/tests/imagefilledarc_error1.phpt b/ext/gd/tests/imagefilledarc_error1.phpt deleted file mode 100644 index 2ef47150ee..0000000000 --- a/ext/gd/tests/imagefilledarc_error1.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -Testing wrong param passing imagefilledarc() 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 = imagecreatetruecolor(100, 100); - -$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); - -//create an arc and fill it with white color -imagefilledarc($image, 50, 50, 30, 30, 0, 90, $white); - -include_once __DIR__ . '/func.inc'; -test_image_equals_file(__DIR__ . '/imagefilledarc_error1.png', $image); -?> ---EXPECTF-- -Warning: imagefilledarc() expects exactly 9 parameters, 8 given in %s on line %d -The images are equal. diff --git a/ext/gd/tests/imagefilltoborder_error1.phpt b/ext/gd/tests/imagefilltoborder_error1.phpt deleted file mode 100644 index c53d53718d..0000000000 --- a/ext/gd/tests/imagefilltoborder_error1.phpt +++ /dev/null @@ -1,26 +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 -imagefilltoborder( 'wrong param', 50, 50, imagecolorallocate( $image, 0, 0, 0 ), imagecolorallocate( $image, 255, 0, 0 ) ); - -?> ---EXPECTF-- -Warning: imagefilltoborder() expects parameter 1 to be resource, %s given in %s on line %d diff --git a/ext/gd/tests/imagefilltoborder_error2.phpt b/ext/gd/tests/imagefilltoborder_error2.phpt deleted file mode 100644 index c540000f56..0000000000 --- a/ext/gd/tests/imagefilltoborder_error2.phpt +++ /dev/null @@ -1,26 +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 -imagefilltoborder( $image, 'wrong param', 50, imagecolorallocate( $image, 0, 0, 0 ), imagecolorallocate( $image, 255, 0, 0 ) ); - -?> ---EXPECTF-- -Warning: imagefilltoborder() expects parameter 2 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagefilltoborder_error3.phpt b/ext/gd/tests/imagefilltoborder_error3.phpt deleted file mode 100644 index 3d80fcbfa2..0000000000 --- a/ext/gd/tests/imagefilltoborder_error3.phpt +++ /dev/null @@ -1,26 +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 -imagefilltoborder( $image, 50, 'wrong param', imagecolorallocate( $image, 0, 0, 0 ), imagecolorallocate( $image, 255, 0, 0 ) ); - -?> ---EXPECTF-- -Warning: imagefilltoborder() expects parameter 3 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagefilltoborder_error4.phpt b/ext/gd/tests/imagefilltoborder_error4.phpt deleted file mode 100644 index e0b34c8b13..0000000000 --- a/ext/gd/tests/imagefilltoborder_error4.phpt +++ /dev/null @@ -1,26 +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 -imagefilltoborder( $image, 50, 50, 'wrong param', imagecolorallocate( $image, 255, 0, 0 ) ); - -?> ---EXPECTF-- -Warning: imagefilltoborder() expects parameter 4 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagefilltoborder_error5.phpt b/ext/gd/tests/imagefilltoborder_error5.phpt deleted file mode 100644 index 8822cab23a..0000000000 --- a/ext/gd/tests/imagefilltoborder_error5.phpt +++ /dev/null @@ -1,26 +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 -imagefilltoborder( $image, 50, 50, imagecolorallocate( $image, 0, 0, 0 ), 'wrong param' ); - -?> ---EXPECTF-- -Warning: imagefilltoborder() expects parameter 5 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagefilltoborder_error7.phpt b/ext/gd/tests/imagefilltoborder_error7.phpt deleted file mode 100644 index 944fe8e4d4..0000000000 --- a/ext/gd/tests/imagefilltoborder_error7.phpt +++ /dev/null @@ -1,26 +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; skipping test"); -?> ---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 -imagefilltoborder( $image, 50, 50 ); - -?> ---EXPECTF-- -Warning: imagefilltoborder() expects exactly 5 parameters, %d given in %s on line %d diff --git a/ext/gd/tests/imagefilter.phpt b/ext/gd/tests/imagefilter.phpt index 04a2395b8b..87efb1591e 100644 --- a/ext/gd/tests/imagefilter.phpt +++ b/ext/gd/tests/imagefilter.phpt @@ -19,7 +19,7 @@ $no_arg_filters = array( "IMG_FILTER_MEAN_REMOVAL" ); -$SAVE_DIR = dirname(__FILE__); +$SAVE_DIR = __DIR__; $SOURCE_IMG = $SAVE_DIR . "/test.png"; foreach ($no_arg_filters as $filt) { diff --git a/ext/gd/tests/imagefilter_error14.phpt b/ext/gd/tests/imagefilter_error14.phpt deleted file mode 100644 index 310b848671..0000000000 --- a/ext/gd/tests/imagefilter_error14.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Testing wrong parameter type of COLORIZE 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 = imagecreatetruecolor(180, 30); - -var_dump(imagefilter($image, IMG_FILTER_COLORIZE, 'wrong parameter', 255, 255)); -?> ---EXPECTF-- -Warning: imagefilter() expects parameter 3 to be int, string given in %s on line %d -bool(false) diff --git a/ext/gd/tests/imagefilter_error16.phpt b/ext/gd/tests/imagefilter_error16.phpt deleted file mode 100644 index f7173c689e..0000000000 --- a/ext/gd/tests/imagefilter_error16.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Testing wrong parameter type of CONTRAST 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 = imagecreatetruecolor(180, 30); - -var_dump(imagefilter($image, IMG_FILTER_CONTRAST, 'wrong parameter')); -?> ---EXPECTF-- -Warning: imagefilter() expects parameter 3 to be int, string given in %s on line %d -bool(false) diff --git a/ext/gd/tests/imagefilter_error19.phpt b/ext/gd/tests/imagefilter_error19.phpt deleted file mode 100644 index a811044869..0000000000 --- a/ext/gd/tests/imagefilter_error19.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Testing wrong parameter type of BRIGHTNESS 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 = imagecreatetruecolor(180, 30); - -var_dump(imagefilter($image, IMG_FILTER_BRIGHTNESS, 'wrong parameter')); -?> ---EXPECTF-- -Warning: imagefilter() expects parameter 3 to be int, string given in %s on line %d -bool(false) diff --git a/ext/gd/tests/imagefilter_error2.phpt b/ext/gd/tests/imagefilter_error2.phpt deleted file mode 100644 index 17a47f2005..0000000000 --- a/ext/gd/tests/imagefilter_error2.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Testing wrong parameter passing 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 = imagecreatetruecolor(180, 30); - -var_dump(imagefilter($image, 'wrong parameter')); -?> ---EXPECTF-- -Warning: imagefilter() expects parameter 2 to be int, string given in %s on line %d -NULL diff --git a/ext/gd/tests/imagefilter_error3.phpt b/ext/gd/tests/imagefilter_error3.phpt deleted file mode 100644 index e1c2fe7b36..0000000000 --- a/ext/gd/tests/imagefilter_error3.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Testing wrong parameter passing of PIXELATE 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 = imagecreatetruecolor(180, 30); - -var_dump(imagefilter($image, IMG_FILTER_PIXELATE, 'wrong parameter')); -?> ---EXPECTF-- -Warning: imagefilter() expects parameter 3 to be int, string given in %s on line %d -bool(false) diff --git a/ext/gd/tests/imagefilter_error5.phpt b/ext/gd/tests/imagefilter_error5.phpt deleted file mode 100644 index 7965271a54..0000000000 --- a/ext/gd/tests/imagefilter_error5.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Testing wrong parameter passing of SMOOTH 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 = imagecreatetruecolor(180, 30); - -var_dump(imagefilter($image, IMG_FILTER_SMOOTH, 'wrong parameter')); -?> ---EXPECTF-- -Warning: imagefilter() expects parameter 3 to be float, string given in %s on line %d -bool(false) diff --git a/ext/gd/tests/imagefontheight_error1.phpt b/ext/gd/tests/imagefontheight_error1.phpt deleted file mode 100644 index dbe20cece1..0000000000 --- a/ext/gd/tests/imagefontheight_error1.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -Testing error on string parameter for imagefontheight() 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 -imagefontheight('string'); -?> ---EXPECTF-- -Warning: imagefontheight() expects parameter 1 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagefontwidth_error1.phpt b/ext/gd/tests/imagefontwidth_error1.phpt deleted file mode 100644 index 9e1d59fe4e..0000000000 --- a/ext/gd/tests/imagefontwidth_error1.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -Testing error on string parameter for imagefontwidth() 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 -imagefontwidth('string'); -?> ---EXPECTF-- -Warning: imagefontwidth() expects parameter 1 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagefttext.phpt b/ext/gd/tests/imagefttext.phpt index 2a516cb6c5..85bca4d545 100644 --- a/ext/gd/tests/imagefttext.phpt +++ b/ext/gd/tests/imagefttext.phpt @@ -11,7 +11,7 @@ imagefttext() function test ?> --FILE-- <?php - $cwd = dirname(__FILE__); + $cwd = __DIR__; $fontfile_8859 = "$cwd/test8859.ttf"; function testrun($im, $fontfile) { diff --git a/ext/gd/tests/imagegammacorrect_error1.phpt b/ext/gd/tests/imagegammacorrect_error1.phpt deleted file mode 100644 index ab60957579..0000000000 --- a/ext/gd/tests/imagegammacorrect_error1.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error with non-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 - -$gamma = imagegammacorrect('string', 1, 5); - -?> ---EXPECTF-- -Warning: imagegammacorrect() expects parameter 1 to be resource, %s given in %s on line %d diff --git a/ext/gd/tests/imagegammacorrect_error3.phpt b/ext/gd/tests/imagegammacorrect_error3.phpt deleted file mode 100644 index 8bb47ad234..0000000000 --- a/ext/gd/tests/imagegammacorrect_error3.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error with non-double first 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 = imagecreatetruecolor(180, 30); -$gamma = imagegammacorrect($image, 'string', 5); - -?> ---EXPECTF-- -Warning: imagegammacorrect() expects parameter 2 to be float, %s given in %s on line %d diff --git a/ext/gd/tests/imagegammacorrect_error4.phpt b/ext/gd/tests/imagegammacorrect_error4.phpt deleted file mode 100644 index d2546fd41c..0000000000 --- a/ext/gd/tests/imagegammacorrect_error4.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error with non-double second 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 = imagecreatetruecolor(180, 30); -$gamma = imagegammacorrect($image, 1, 'string'); - -?> ---EXPECTF-- -Warning: imagegammacorrect() expects parameter 3 to be float, %s given in %s on line %d diff --git a/ext/gd/tests/imageinterlace_error1.phpt b/ext/gd/tests/imageinterlace_error1.phpt deleted file mode 100644 index 2dd438a5e7..0000000000 --- a/ext/gd/tests/imageinterlace_error1.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -Testing passing no parameters 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 = imagecreatetruecolor(100, 100); - -//calling with no parameters -var_dump(imageinterlace()); -?> ---EXPECTF-- -Warning: imageinterlace() expects at least 1 parameter, 0 given in %s on line %d -NULL diff --git a/ext/gd/tests/imagelayereffect_error1.phpt b/ext/gd/tests/imagelayereffect_error1.phpt deleted file mode 100644 index 1265b84ad1..0000000000 --- a/ext/gd/tests/imagelayereffect_error1.phpt +++ /dev/null @@ -1,16 +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 -$layer = imagelayereffect('invalid_resource', IMG_EFFECT_REPLACE); -?> ---EXPECTF-- -Warning: imagelayereffect() expects parameter 1 to be resource, %s given in %s on line %d diff --git a/ext/gd/tests/imagelayereffect_error2.phpt b/ext/gd/tests/imagelayereffect_error2.phpt deleted file mode 100644 index bf535ffd24..0000000000 --- a/ext/gd/tests/imagelayereffect_error2.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Testing imagelayereffect() wth invalid effect 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 -$image = imagecreatetruecolor(180, 30); - -$layer = imagelayereffect($image, 'IMG_EFFECT_REPLACE'); -?> ---EXPECTF-- -Warning: imagelayereffect() expects parameter 2 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imageloadfont_end_of_file_while_reading_header.phpt b/ext/gd/tests/imageloadfont_end_of_file_while_reading_header.phpt new file mode 100644 index 0000000000..18f806d5b0 --- /dev/null +++ b/ext/gd/tests/imageloadfont_end_of_file_while_reading_header.phpt @@ -0,0 +1,35 @@ +--TEST-- +imageloadfont() "End of file while reading header" +--CREDITS-- +Ike Devolder <ike.devolder@gmail.com> +User Group: PHP-WVL & PHPGent #PHPTestFest +--SKIPIF-- +<?php +if (!extension_loaded('gd')) die("skip gd extension not available\n"); +?> +--FILE-- +<?php +$filename = __DIR__ . '/font.gdf'; + +// End of file while reading header +$bin = "\x41\x41\x41\x41\x00\x00\x00\x00\x00\x00"; +$fp = fopen($filename, 'wb'); +fwrite($fp, $bin); +fclose($fp); +$font = imageloadfont($filename); + +// Error while reading header +$bin = "\xe0\x00\x00\x00\x20\x00\x00\x00\x06\x00\x00\x00\x0a\x00\x00"; +$fp = fopen($filename, 'wb'); +fwrite($fp, $bin); +fclose($fp); +$font = imageloadfont($filename); +?> +--CLEAN-- +<?php +unlink(__DIR__.'/font.gdf'); +?> +--EXPECTF-- +Warning: imageloadfont(): End of file while reading header in %s on line %d + +Warning: imageloadfont(): End of file while reading header in %s on line %d diff --git a/ext/gd/tests/imageloadfont_error1.phpt b/ext/gd/tests/imageloadfont_error1.phpt deleted file mode 100644 index 418bbf3ced..0000000000 --- a/ext/gd/tests/imageloadfont_error1.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -Testing that imageloadfont() breaks on non-string first parameter ---CREDITS-- -Neveo Harrison <neveoo [at] gmail [dot] com> #testfest #tek11 ---SKIPIF-- -<?php - if (!extension_loaded("gd")) die("skip GD not present"); -?> ---FILE-- -<?php -var_dump( imageloadfont(array()) ); -?> ---EXPECTF-- -Warning: imageloadfont() expects parameter 1 to be a valid path, array given in %s on line %d -NULL diff --git a/ext/gd/tests/imageloadfont_invalid.phpt b/ext/gd/tests/imageloadfont_invalid.phpt index 5246a0713d..ed9d9e3a30 100644 --- a/ext/gd/tests/imageloadfont_invalid.phpt +++ b/ext/gd/tests/imageloadfont_invalid.phpt @@ -6,7 +6,7 @@ imageloadfont() function crashes ?> --FILE-- <?php -$filename = dirname(__FILE__) . '/font.gdf'; +$filename = __DIR__ . '/font.gdf'; $bin = "\x41\x41\x41\x41\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x01\x00"; $fp = fopen($filename, 'wb'); fwrite($fp, $bin); diff --git a/ext/gd/tests/imagepalettetotruecolor_error1.phpt b/ext/gd/tests/imagepalettetotruecolor_error1.phpt deleted file mode 100644 index 3c994e59a2..0000000000 --- a/ext/gd/tests/imagepalettetotruecolor_error1.phpt +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -imagepalettetotruecollor must return an error if no 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 -imagepalettetotruecolor(); -?> ---EXPECTF-- -Warning: imagepalettetotruecolor() expects exactly 1 parameter, 0 given in %s on line %d diff --git a/ext/gd/tests/imagepalettetotruecolor_error2.phpt b/ext/gd/tests/imagepalettetotruecolor_error2.phpt deleted file mode 100644 index 7a9a9ce574..0000000000 --- a/ext/gd/tests/imagepalettetotruecolor_error2.phpt +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -imagepalettetotruecollor must return an error if not a 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 -imagepalettetotruecolor("bla"); -?> ---EXPECTF-- -Warning: imagepalettetotruecolor() expects parameter 1 to be resource, string given in %s on line %d diff --git a/ext/gd/tests/imagerectangle_error1.phpt b/ext/gd/tests/imagerectangle_error1.phpt deleted file mode 100644 index 1dd04dab49..0000000000 --- a/ext/gd/tests/imagerectangle_error1.phpt +++ /dev/null @@ -1,19 +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 image -$image = imagecreatetruecolor( 100, 100 ); - -// Draw a rectangle -imagerectangle( 'wrong param', 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) ); -?> ---EXPECTF-- -Warning: imagerectangle() expects parameter 1 to be resource, %s given in %s on line %d diff --git a/ext/gd/tests/imagerectangle_error3.phpt b/ext/gd/tests/imagerectangle_error3.phpt deleted file mode 100644 index 1b31d1c950..0000000000 --- a/ext/gd/tests/imagerectangle_error3.phpt +++ /dev/null @@ -1,19 +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 image -$image = imagecreatetruecolor( 100, 100 ); - -// Draw a rectangle -imagerectangle( $image, 'wrong param', 0, 50, 50, imagecolorallocate($image, 255, 255, 255) ); -?> ---EXPECTF-- -Warning: imagerectangle() expects parameter 2 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagerectangle_error4.phpt b/ext/gd/tests/imagerectangle_error4.phpt deleted file mode 100644 index e158360ffe..0000000000 --- a/ext/gd/tests/imagerectangle_error4.phpt +++ /dev/null @@ -1,19 +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 image -$image = imagecreatetruecolor( 100, 100 ); - -// Draw a rectangle -imagerectangle( $image, 0, 'wrong param', 50, 50, imagecolorallocate($image, 255, 255, 255) ); -?> ---EXPECTF-- -Warning: imagerectangle() expects parameter 3 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagerectangle_error5.phpt b/ext/gd/tests/imagerectangle_error5.phpt deleted file mode 100644 index 5cbdcbf2c7..0000000000 --- a/ext/gd/tests/imagerectangle_error5.phpt +++ /dev/null @@ -1,19 +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 image -$image = imagecreatetruecolor( 100, 100 ); - -// Draw a rectangle -imagerectangle( $image, 0, 0, 'wrong param', 50, imagecolorallocate($image, 255, 255, 255) ); -?> ---EXPECTF-- -Warning: imagerectangle() expects parameter 4 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagerectangle_error6.phpt b/ext/gd/tests/imagerectangle_error6.phpt deleted file mode 100644 index ee09496b47..0000000000 --- a/ext/gd/tests/imagerectangle_error6.phpt +++ /dev/null @@ -1,19 +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 image -$image = imagecreatetruecolor( 100, 100 ); - -// Draw a rectangle -imagerectangle( $image, 0, 0, 50, 'wrong param', imagecolorallocate($image, 255, 255, 255) ); -?> ---EXPECTF-- -Warning: imagerectangle() expects parameter 5 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagerectangle_error7.phpt b/ext/gd/tests/imagerectangle_error7.phpt deleted file mode 100644 index d863849195..0000000000 --- a/ext/gd/tests/imagerectangle_error7.phpt +++ /dev/null @@ -1,19 +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 image -$image = imagecreatetruecolor( 100, 100 ); - -// Draw a rectangle -imagerectangle( $image, 0, 0, 50, 50, 'wrong param' ); -?> ---EXPECTF-- -Warning: imagerectangle() expects parameter 6 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagerectangle_error8.phpt b/ext/gd/tests/imagerectangle_error8.phpt deleted file mode 100644 index 47b4a02176..0000000000 --- a/ext/gd/tests/imagerectangle_error8.phpt +++ /dev/null @@ -1,19 +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 image -$image = imagecreatetruecolor( 100, 100 ); - -// Draw a rectangle -imagerectangle( $image, 0, 0, 50, 50 ); -?> ---EXPECTF-- -Warning: imagerectangle() expects exactly 6 parameters, %d given in %s on line %d diff --git a/ext/gd/tests/imagesavealpha_error2.phpt b/ext/gd/tests/imagesavealpha_error2.phpt deleted file mode 100644 index 356d647469..0000000000 --- a/ext/gd/tests/imagesavealpha_error2.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -test imagesavealpha without arguments ---CREDITS-- -Marcelo Diniz <marcelo.leo27 [at] gmail [dot] com -#phpspMaisTestFest PHPSP on 2014-07-05 ---SKIPIF-- -<?php - if (!extension_loaded('gd')) die("skip gd extension not available."); -?> ---FILE-- -<?php -imagesavealpha(); -?> ---EXPECTF-- -Warning: imagesavealpha() expects exactly 2 parameters, 0 given in %s on line %d diff --git a/ext/gd/tests/imagescale_preserve_ratio.phpt b/ext/gd/tests/imagescale_preserve_ratio.phpt new file mode 100644 index 0000000000..00076e431e --- /dev/null +++ b/ext/gd/tests/imagescale_preserve_ratio.phpt @@ -0,0 +1,55 @@ +--TEST-- +Scale images and preserve aspect ratio +--SKIPIF-- +<?php +if (!extension_loaded('gd')) die("skip gd extension not available\n"); +?> +--FILE-- +<?php + +$img = imagecreatetruecolor ( 256, 384); + +$thumbnail = imagescale($img, 64, -1, IMG_BICUBIC); +var_dump(imagesx($thumbnail)); +var_dump(imagesy($thumbnail)); + +$thumbnail = imagescale($img, -1, 64, IMG_BICUBIC); +var_dump(imagesx($thumbnail)); +var_dump(imagesy($thumbnail)); + +$img = imagecreatetruecolor ( 384, 256); + +$thumbnail = imagescale($img, 64, -1, IMG_BICUBIC); +var_dump(imagesx($thumbnail)); +var_dump(imagesy($thumbnail)); + +$thumbnail = imagescale($img, -1, 64, IMG_BICUBIC); +var_dump(imagesx($thumbnail)); +var_dump(imagesy($thumbnail)); + +$img = imagecreatetruecolor ( 256, 256); + +$thumbnail = imagescale($img, 64, -1, IMG_BICUBIC); +var_dump(imagesx($thumbnail)); +var_dump(imagesy($thumbnail)); + +$thumbnail = imagescale($img, -1, 64, IMG_BICUBIC); +var_dump(imagesx($thumbnail)); +var_dump(imagesy($thumbnail)); + +?> +DONE +--EXPECT-- +int(64) +int(96) +int(42) +int(64) +int(64) +int(42) +int(96) +int(64) +int(64) +int(64) +int(64) +int(64) +DONE diff --git a/ext/gd/tests/imagesetthickness_error2.phpt b/ext/gd/tests/imagesetthickness_error2.phpt deleted file mode 100644 index 7e7d6a7c22..0000000000 --- a/ext/gd/tests/imagesetthickness_error2.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -Testing imagetruecolortopalette(): wrong types for second parameter ---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 -$image = imagecreatetruecolor(200, 100); - -imagesetthickness($image, 's'); -imagesetthickness($image, array()); -imagesetthickness($image, $image); - -?> ---EXPECTF-- -Warning: imagesetthickness() expects parameter 2 to be int, string given in %s on line %d - -Warning: imagesetthickness() expects parameter 2 to be int, array given in %s on line %d - -Warning: imagesetthickness() expects parameter 2 to be int, resource given in %s on line %d diff --git a/ext/gd/tests/imagestring_error1.phpt b/ext/gd/tests/imagestring_error1.phpt deleted file mode 100644 index 96055bd9df..0000000000 --- a/ext/gd/tests/imagestring_error1.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error on non-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 - -$result = imagestring('string', 1, 5, 5, 'String', 1); - -?> ---EXPECTF-- -Warning: imagestring() expects parameter 1 to be resource, %s given in %s on line %d diff --git a/ext/gd/tests/imagestring_error3.phpt b/ext/gd/tests/imagestring_error3.phpt deleted file mode 100644 index 9f5a9ff2cf..0000000000 --- a/ext/gd/tests/imagestring_error3.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error on non-long parameter 2 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 -$image = imagecreatetruecolor(180, 30); -$result = imagestring($image, 'string', 5, 5, 'String', 1); - -?> ---EXPECTF-- -Warning: imagestring() expects parameter 2 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagestring_error4.phpt b/ext/gd/tests/imagestring_error4.phpt deleted file mode 100644 index 443177e588..0000000000 --- a/ext/gd/tests/imagestring_error4.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error on non-long parameter 3 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 -$image = imagecreatetruecolor(180, 30); -$result = imagestring($image, 1, 'string', 5, 'String', 1); - -?> ---EXPECTF-- -Warning: imagestring() expects parameter 3 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagestring_error5.phpt b/ext/gd/tests/imagestring_error5.phpt deleted file mode 100644 index 50c6ff3999..0000000000 --- a/ext/gd/tests/imagestring_error5.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error on non-long parameter 4 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 -$image = imagecreatetruecolor(180, 30); -$result = imagestring($image, 1, 5, 'string', 'String', 1); - -?> ---EXPECTF-- -Warning: imagestring() expects parameter 4 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagestring_error6.phpt b/ext/gd/tests/imagestring_error6.phpt deleted file mode 100644 index 9306e5bf15..0000000000 --- a/ext/gd/tests/imagestring_error6.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error on non-string parameter 5 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 -$image = imagecreatetruecolor(180, 30); -$result = imagestring($image, 1, 5, 5, $image, 1); - -?> ---EXPECTF-- -Warning: imagestring() expects parameter 5 to be string%S, %s given in %s on line %d diff --git a/ext/gd/tests/imagestring_error7.phpt b/ext/gd/tests/imagestring_error7.phpt deleted file mode 100644 index 5a3c126ed0..0000000000 --- a/ext/gd/tests/imagestring_error7.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error on non-long parameter 6 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 -$image = imagecreatetruecolor(180, 30); -$result = imagestring($image, 1, 5, 5, 'String', 'font'); - -?> ---EXPECTF-- -Warning: imagestring() expects parameter 6 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagestringup_error1.phpt b/ext/gd/tests/imagestringup_error1.phpt deleted file mode 100644 index 12f802139b..0000000000 --- a/ext/gd/tests/imagestringup_error1.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error on non-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 - -$result = imagestringup('string', 1, 5, 5, 'String', 1); - -?> ---EXPECTF-- -Warning: imagestringup() expects parameter 1 to be resource, %s given in %s on line %d diff --git a/ext/gd/tests/imagestringup_error3.phpt b/ext/gd/tests/imagestringup_error3.phpt deleted file mode 100644 index dbe2b9aabc..0000000000 --- a/ext/gd/tests/imagestringup_error3.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error on non-long parameter 2 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 -$image = imagecreatetruecolor(180, 30); -$result = imagestringup($image, 'string', 5, 5, 'String', 1); - -?> ---EXPECTF-- -Warning: imagestringup() expects parameter 2 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagestringup_error4.phpt b/ext/gd/tests/imagestringup_error4.phpt deleted file mode 100644 index 9ecd3d236c..0000000000 --- a/ext/gd/tests/imagestringup_error4.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error on non-long parameter 3 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 -$image = imagecreatetruecolor(180, 30); -$result = imagestringup($image, 1, 'string', 5, 'String', 1); - -?> ---EXPECTF-- -Warning: imagestringup() expects parameter 3 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagestringup_error5.phpt b/ext/gd/tests/imagestringup_error5.phpt deleted file mode 100644 index 6b276ca92a..0000000000 --- a/ext/gd/tests/imagestringup_error5.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error on non-long parameter 4 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 -$image = imagecreatetruecolor(180, 30); -$result = imagestringup($image, 1, 5, 'string', 'String', 1); - -?> ---EXPECTF-- -Warning: imagestringup() expects parameter 4 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagestringup_error6.phpt b/ext/gd/tests/imagestringup_error6.phpt deleted file mode 100644 index 8683c0b5b0..0000000000 --- a/ext/gd/tests/imagestringup_error6.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error on non-string parameter 5 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 -$image = imagecreatetruecolor(180, 30); -$result = imagestringup($image, 1, 5, 5, $image, 1); - -?> ---EXPECTF-- -Warning: imagestringup() expects parameter 5 to be string%S, %s given in %s on line %d diff --git a/ext/gd/tests/imagestringup_error7.phpt b/ext/gd/tests/imagestringup_error7.phpt deleted file mode 100644 index 1caef65828..0000000000 --- a/ext/gd/tests/imagestringup_error7.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Testing error on non-long parameter 6 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 -$image = imagecreatetruecolor(180, 30); -$result = imagestringup($image, 1, 5, 5, 'String', 'font'); - -?> ---EXPECTF-- -Warning: imagestringup() expects parameter 6 to be int, %s given in %s on line %d diff --git a/ext/gd/tests/imagetruecolortopalette_error2.phpt b/ext/gd/tests/imagetruecolortopalette_error2.phpt deleted file mode 100644 index f2cddbcb92..0000000000 --- a/ext/gd/tests/imagetruecolortopalette_error2.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Testing imagetruecolortopalette(): wrong parameters for parameter 2 ---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 -$image = imagecreatetruecolor(50, 50); -$resource = tmpfile(); - -imagetruecolortopalette($image, $resource, 2); -imagetruecolortopalette($image, array(), 2); - -?> ---EXPECTF-- -Warning: imagetruecolortopalette() expects parameter 2 to be bool, resource given in %s on line %d - -Warning: imagetruecolortopalette() expects parameter 2 to be bool, array given in %s on line %d diff --git a/ext/gd/tests/imagewbmp-mb.phpt b/ext/gd/tests/imagewbmp-mb.phpt index bb6cfdc655..fefbb066c7 100644 --- a/ext/gd/tests/imagewbmp-mb.phpt +++ b/ext/gd/tests/imagewbmp-mb.phpt @@ -6,7 +6,7 @@ imagewbmp ?> --FILE-- <?php -$file = dirname(__FILE__) . '/im私はガラスを食べられます.wbmp'; +$file = __DIR__ . '/im私はガラスを食べられます.wbmp'; $im = imagecreatetruecolor(6,6); imagefill($im, 0,0, 0xffffff); diff --git a/ext/gd/tests/imagewbmp.phpt b/ext/gd/tests/imagewbmp.phpt index a10dbdb5f7..27491bb42e 100644 --- a/ext/gd/tests/imagewbmp.phpt +++ b/ext/gd/tests/imagewbmp.phpt @@ -6,7 +6,7 @@ imagewbmp ?> --FILE-- <?php -$file = dirname(__FILE__) . '/im.wbmp'; +$file = __DIR__ . '/im.wbmp'; $im = imagecreatetruecolor(6,6); imagefill($im, 0,0, 0xffffff); diff --git a/ext/gd/tests/jpeg2png.phpt b/ext/gd/tests/jpeg2png.phpt index 0a170eeeed..6e136514a8 100644 --- a/ext/gd/tests/jpeg2png.phpt +++ b/ext/gd/tests/jpeg2png.phpt @@ -15,7 +15,7 @@ jpeg <--> png conversion test ?> --FILE-- <?php - $cwd = dirname(__FILE__); + $cwd = __DIR__; echo "PNG to JPEG conversion: "; echo imagejpeg(imagecreatefrompng($cwd . "/conv_test.png"), $cwd . "/test_jpeg.jpeg") ? 'ok' : 'failed'; diff --git a/ext/gd/tests/jpeg2wbmp_error1.phpt b/ext/gd/tests/jpeg2wbmp_error1.phpt index fcdef0bcb1..e8e0a7cf2e 100644 --- a/ext/gd/tests/jpeg2wbmp_error1.phpt +++ b/ext/gd/tests/jpeg2wbmp_error1.phpt @@ -19,8 +19,8 @@ $im = imagecreatetruecolor(120, 20); $text_color = imagecolorallocate($im, 255, 255, 255); imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color); -$file = dirname(__FILE__) .'/simpletext.jpg'; -$file2 = dirname(__FILE__) .'/simpletext.wbmp'; +$file = __DIR__ .'/simpletext.jpg'; +$file2 = __DIR__ .'/simpletext.wbmp'; // Save the image as 'simpletext.jpg' imagejpeg($im, $file); @@ -41,6 +41,6 @@ Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d Warning: jpeg2wbmp(): Invalid threshold value '-1' in %s on line %d --CLEAN-- <?php -unlink(dirname(__FILE__) .'/simpletext.jpg'); -unlink(dirname(__FILE__) .'/simpletext.wbmp'); +unlink(__DIR__ .'/simpletext.jpg'); +unlink(__DIR__ .'/simpletext.wbmp'); ?> diff --git a/ext/gd/tests/jpeg2wbmp_error2-mb.phpt b/ext/gd/tests/jpeg2wbmp_error2-mb.phpt index 4eeac126a4..6c4019a935 100644 --- a/ext/gd/tests/jpeg2wbmp_error2-mb.phpt +++ b/ext/gd/tests/jpeg2wbmp_error2-mb.phpt @@ -14,7 +14,7 @@ if(!function_exists('jpeg2wbmp')) { ?> --FILE-- <?php -$file = dirname(__FILE__) .'/simpletext私はガラスを食べられます.wbmp'; +$file = __DIR__ .'/simpletext私はガラスを食べられます.wbmp'; jpeg2wbmp('', $file, 20, 120, 8); jpeg2wbmp(null, $file, 20, 120, 8); jpeg2wbmp(false, $file, 20, 120, 8); @@ -33,5 +33,5 @@ Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d --CLEAN-- <?php -unlink(dirname(__FILE__) .'/simpletext私はガラスを食べられます.wbmp'); +unlink(__DIR__ .'/simpletext私はガラスを食べられます.wbmp'); ?> diff --git a/ext/gd/tests/jpeg2wbmp_error2.phpt b/ext/gd/tests/jpeg2wbmp_error2.phpt index 405eb83129..7ddc151d78 100644 --- a/ext/gd/tests/jpeg2wbmp_error2.phpt +++ b/ext/gd/tests/jpeg2wbmp_error2.phpt @@ -14,7 +14,7 @@ if(!function_exists('jpeg2wbmp')) { ?> --FILE-- <?php -$file = dirname(__FILE__) .'/simpletext.wbmp'; +$file = __DIR__ .'/simpletext.wbmp'; jpeg2wbmp('', $file, 20, 120, 8); jpeg2wbmp(null, $file, 20, 120, 8); jpeg2wbmp(false, $file, 20, 120, 8); @@ -33,5 +33,5 @@ Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d --CLEAN-- <?php -unlink(dirname(__FILE__) .'/simpletext.wbmp'); +unlink(__DIR__ .'/simpletext.wbmp'); ?> diff --git a/ext/gd/tests/jpeg2wbmp_error3.phpt b/ext/gd/tests/jpeg2wbmp_error3.phpt index 2662b7a86b..1d4c82b06e 100644 --- a/ext/gd/tests/jpeg2wbmp_error3.phpt +++ b/ext/gd/tests/jpeg2wbmp_error3.phpt @@ -19,7 +19,7 @@ $im = imagecreatetruecolor(120, 20); $text_color = imagecolorallocate($im, 255, 255, 255); imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color); -$file = dirname(__FILE__) .'/simpletext.jpg'; +$file = __DIR__ .'/simpletext.jpg'; // Save the image as 'simpletext.jpg' imagejpeg($im, $file); @@ -45,5 +45,5 @@ Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d Warning: jpeg2wbmp(): Unable to open '' for writing in %s on line %d --CLEAN-- <?php -unlink(dirname(__FILE__) .'/simpletext.jpg'); +unlink(__DIR__ .'/simpletext.jpg'); ?> diff --git a/ext/gd/tests/jpg2gd-mb.phpt b/ext/gd/tests/jpg2gd-mb.phpt index 8dee6b3bd5..85959b4271 100644 --- a/ext/gd/tests/jpg2gd-mb.phpt +++ b/ext/gd/tests/jpg2gd-mb.phpt @@ -12,7 +12,7 @@ jpeg <--> gd1/gd2 conversion test ?> --FILE-- <?php - $cwd = dirname(__FILE__); + $cwd = __DIR__; echo "JPEG to GD1 conversion: "; echo imagegd(imagecreatefromjpeg($cwd . "/conv_test私はガラスを食べられます.jpeg"), $cwd . "/test私はガラスを食べられます.gd1") ? 'ok' : 'failed'; diff --git a/ext/gd/tests/jpg2gd.phpt b/ext/gd/tests/jpg2gd.phpt index 805ec79834..672a392df0 100644 --- a/ext/gd/tests/jpg2gd.phpt +++ b/ext/gd/tests/jpg2gd.phpt @@ -12,26 +12,26 @@ jpeg <--> gd1/gd2 conversion test ?> --FILE-- <?php - $cwd = dirname(__FILE__); + $cwd = __DIR__; echo "JPEG to GD1 conversion: "; - echo imagegd(imagecreatefromjpeg($cwd . "/conv_test.jpeg"), $cwd . "/test.gd1") ? 'ok' : 'failed'; + echo imagegd(imagecreatefromjpeg($cwd . "/conv_test.jpeg"), $cwd . "/test_jpeg.gd1") ? 'ok' : 'failed'; echo "\n"; echo "JPEG to GD2 conversion: "; - echo imagegd2(imagecreatefromjpeg($cwd . "/conv_test.jpeg"), $cwd . "/test.gd2") ? 'ok' : 'failed'; + echo imagegd2(imagecreatefromjpeg($cwd . "/conv_test.jpeg"), $cwd . "/test_jpeg.gd2") ? 'ok' : 'failed'; echo "\n"; echo "GD1 to JPEG conversion: "; - echo imagejpeg(imagecreatefromgd($cwd . "/test.gd1"), $cwd . "/test_gd1.jpeg") ? 'ok' : 'failed'; + echo imagejpeg(imagecreatefromgd($cwd . "/test_jpeg.gd1"), $cwd . "/test_gd1.jpeg") ? 'ok' : 'failed'; echo "\n"; echo "GD2 to JPEG conversion: "; - echo imagejpeg(imagecreatefromgd2($cwd . "/test.gd2"), $cwd . "/test_gd2.jpeg") ? 'ok' : 'failed'; + echo imagejpeg(imagecreatefromgd2($cwd . "/test_jpeg.gd2"), $cwd . "/test_gd2.jpeg") ? 'ok' : 'failed'; echo "\n"; - @unlink($cwd . "/test.gd1"); - @unlink($cwd . "/test.gd2"); + @unlink($cwd . "/test_jpeg.gd1"); + @unlink($cwd . "/test_jpeg.gd2"); @unlink($cwd . "/test_gd1.jpeg"); @unlink($cwd . "/test_gd2.jpeg"); ?> diff --git a/ext/gd/tests/libgd00086.phpt b/ext/gd/tests/libgd00086.phpt index 7756b34d5a..c7954a0a00 100644 --- a/ext/gd/tests/libgd00086.phpt +++ b/ext/gd/tests/libgd00086.phpt @@ -8,7 +8,7 @@ libgd #86 (Possible infinite loop in imagecreatefrompng) --FILE-- <?php -$im = imagecreatefrompng(dirname(__FILE__) . '/libgd00086.png'); +$im = imagecreatefrompng(__DIR__ . '/libgd00086.png'); var_dump($im); ?> --EXPECTF-- diff --git a/ext/gd/tests/libgd00086_extern.phpt b/ext/gd/tests/libgd00086_extern.phpt index 0c8d18092e..36b79b4835 100644 --- a/ext/gd/tests/libgd00086_extern.phpt +++ b/ext/gd/tests/libgd00086_extern.phpt @@ -8,7 +8,7 @@ libgd #86 (Possible infinite loop in imagecreatefrompng) --FILE-- <?php -$im = imagecreatefrompng(dirname(__FILE__) . '/libgd00086.png'); +$im = imagecreatefrompng(__DIR__ . '/libgd00086.png'); var_dump($im); ?> --EXPECTF-- diff --git a/ext/gd/tests/libgd00094-mb.phpt b/ext/gd/tests/libgd00094-mb.phpt index 8a14ceba1e..76b6bcd566 100644 --- a/ext/gd/tests/libgd00094-mb.phpt +++ b/ext/gd/tests/libgd00094-mb.phpt @@ -7,7 +7,7 @@ libgd #94 (imagecreatefromxbm can crash if gdImageCreate fails) ?> --FILE-- <?php -$im = imagecreatefromxbm(dirname(__FILE__) . '/libgd00094私はガラスを食べられます.xbm'); +$im = imagecreatefromxbm(__DIR__ . '/libgd00094私はガラスを食べられます.xbm'); var_dump($im); ?> --EXPECTF-- diff --git a/ext/gd/tests/libgd00094.phpt b/ext/gd/tests/libgd00094.phpt index f658fc64cf..17c4df70d5 100644 --- a/ext/gd/tests/libgd00094.phpt +++ b/ext/gd/tests/libgd00094.phpt @@ -7,7 +7,7 @@ libgd #94 (imagecreatefromxbm can crash if gdImageCreate fails) ?> --FILE-- <?php -$im = imagecreatefromxbm(dirname(__FILE__) . '/libgd00094.xbm'); +$im = imagecreatefromxbm(__DIR__ . '/libgd00094.xbm'); var_dump($im); ?> --EXPECTF-- diff --git a/ext/gd/tests/libgd00101.phpt b/ext/gd/tests/libgd00101.phpt index 4154012fbd..dbb1886171 100644 --- a/ext/gd/tests/libgd00101.phpt +++ b/ext/gd/tests/libgd00101.phpt @@ -7,7 +7,7 @@ libgd #101 (imagecreatefromgd can crash if gdImageCreate fails) ?> --FILE-- <?php -$im = imagecreatefromgd(dirname(__FILE__) . '/libgd00101.gd'); +$im = imagecreatefromgd(__DIR__ . '/libgd00101.gd'); var_dump($im); ?> --EXPECTF-- diff --git a/ext/gd/tests/png2gd.phpt b/ext/gd/tests/png2gd.phpt index 65ca505aeb..ea70298292 100644 --- a/ext/gd/tests/png2gd.phpt +++ b/ext/gd/tests/png2gd.phpt @@ -12,26 +12,26 @@ png <--> gd1/gd2 conversion test ?> --FILE-- <?php - $cwd = dirname(__FILE__); + $cwd = __DIR__; echo "PNG to GD1 conversion: "; - echo imagegd(imagecreatefrompng($cwd . "/conv_test.png"), $cwd . "/test.gd1") ? 'ok' : 'failed'; + echo imagegd(imagecreatefrompng($cwd . "/conv_test.png"), $cwd . "/test_png.gd1") ? 'ok' : 'failed'; echo "\n"; echo "PNG to GD2 conversion: "; - echo imagegd2(imagecreatefrompng($cwd . "/conv_test.png"), $cwd . "/test.gd2") ? 'ok' : 'failed'; + echo imagegd2(imagecreatefrompng($cwd . "/conv_test.png"), $cwd . "/test_png.gd2") ? 'ok' : 'failed'; echo "\n"; echo "GD1 to PNG conversion: "; - echo imagepng(imagecreatefromgd($cwd . "/test.gd1"), $cwd . "/test_gd1.png") ? 'ok' : 'failed'; + echo imagepng(imagecreatefromgd($cwd . "/test_png.gd1"), $cwd . "/test_gd1.png") ? 'ok' : 'failed'; echo "\n"; echo "GD2 to PNG conversion: "; - echo imagepng(imagecreatefromgd2($cwd . "/test.gd2"), $cwd . "/test_gd2.png") ? 'ok' : 'failed'; + echo imagepng(imagecreatefromgd2($cwd . "/test_png.gd2"), $cwd . "/test_gd2.png") ? 'ok' : 'failed'; echo "\n"; - @unlink($cwd . "/test.gd1"); - @unlink($cwd . "/test.gd2"); + @unlink($cwd . "/test_png.gd1"); + @unlink($cwd . "/test_png.gd2"); @unlink($cwd . "/test_gd1.png"); @unlink($cwd . "/test_gd2.png"); ?> diff --git a/ext/gd/tests/png2wbmp_error1-mb.phpt b/ext/gd/tests/png2wbmp_error1-mb.phpt index 8c779d36d9..ac0753fb6c 100644 --- a/ext/gd/tests/png2wbmp_error1-mb.phpt +++ b/ext/gd/tests/png2wbmp_error1-mb.phpt @@ -19,8 +19,8 @@ $im = imagecreatetruecolor(120, 20); $text_color = imagecolorallocate($im, 255, 255, 255); imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color); -$file = dirname(__FILE__) .'/simpletext私はガラスを食べられます.png'; -$file2 = dirname(__FILE__) .'/simpletext私はガラスを食べられます.wbmp'; +$file = __DIR__ .'/simpletext私はガラスを食べられます.png'; +$file2 = __DIR__ .'/simpletext私はガラスを食べられます.wbmp'; // Save the image as 'simpletext.png' imagepng($im, $file); @@ -41,6 +41,6 @@ Deprecated: Function png2wbmp() is deprecated in %s on line %d Warning: png2wbmp(): Invalid threshold value '-1' in %s on line %d --CLEAN-- <?php -unlink(dirname(__FILE__) .'/simpletext私はガラスを食べられます.png'); -unlink(dirname(__FILE__) .'/simpletext私はガラスを食べられます.wbmp'); +unlink(__DIR__ .'/simpletext私はガラスを食べられます.png'); +unlink(__DIR__ .'/simpletext私はガラスを食べられます.wbmp'); ?> diff --git a/ext/gd/tests/png2wbmp_error1.phpt b/ext/gd/tests/png2wbmp_error1.phpt index 543013b4bc..5805dfa7a0 100644 --- a/ext/gd/tests/png2wbmp_error1.phpt +++ b/ext/gd/tests/png2wbmp_error1.phpt @@ -19,8 +19,8 @@ $im = imagecreatetruecolor(120, 20); $text_color = imagecolorallocate($im, 255, 255, 255); imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color); -$file = dirname(__FILE__) .'/simpletext.png'; -$file2 = dirname(__FILE__) .'/simpletext.wbmp'; +$file = __DIR__ .'/simpletext.png'; +$file2 = __DIR__ .'/simpletext.wbmp'; // Save the image as 'simpletext.png' imagepng($im, $file); @@ -41,6 +41,6 @@ Deprecated: Function png2wbmp() is deprecated in %s on line %d Warning: png2wbmp(): Invalid threshold value '-1' in %s on line %d --CLEAN-- <?php -unlink(dirname(__FILE__) .'/simpletext.png'); -unlink(dirname(__FILE__) .'/simpletext.wbmp'); +unlink(__DIR__ .'/simpletext.png'); +unlink(__DIR__ .'/simpletext.wbmp'); ?> diff --git a/ext/gd/tests/png2wbmp_error2.phpt b/ext/gd/tests/png2wbmp_error2.phpt index a674e0d6cc..3bfff05891 100644 --- a/ext/gd/tests/png2wbmp_error2.phpt +++ b/ext/gd/tests/png2wbmp_error2.phpt @@ -14,7 +14,7 @@ if(!function_exists('png2wbmp')) { ?> --FILE-- <?php -$file = dirname(__FILE__) .'/simpletext.wbmp'; +$file = __DIR__ .'/simpletext.wbmp'; png2wbmp('', $file, 20, 120, 8); png2wbmp(null, $file, 20, 120, 8); png2wbmp(false, $file, 20, 120, 8); @@ -33,5 +33,5 @@ Deprecated: Function png2wbmp() is deprecated in %s on line %d Warning: png2wbmp(): Unable to open '' for reading in %s on line %d --CLEAN-- <?php -unlink(dirname(__FILE__) .'/simpletext.wbmp'); +unlink(__DIR__ .'/simpletext.wbmp'); ?> diff --git a/ext/gd/tests/png2wbmp_error3.phpt b/ext/gd/tests/png2wbmp_error3.phpt index 3cab3ccb98..8bf0aa25bb 100644 --- a/ext/gd/tests/png2wbmp_error3.phpt +++ b/ext/gd/tests/png2wbmp_error3.phpt @@ -19,7 +19,7 @@ $im = imagecreatetruecolor(120, 20); $text_color = imagecolorallocate($im, 255, 255, 255); imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color); -$file = dirname(__FILE__) .'/simpletext.png'; +$file = __DIR__ .'/simpletext.png'; // Save the image as 'simpletext.png' imagepng($im, $file); @@ -45,5 +45,5 @@ Deprecated: Function png2wbmp() is deprecated in %s on line %d Warning: png2wbmp(): Unable to open '' for writing in %s on line %d --CLEAN-- <?php -unlink(dirname(__FILE__) .'/simpletext.png'); +unlink(__DIR__ .'/simpletext.png'); ?> diff --git a/ext/gd/tests/pngcomp.phpt b/ext/gd/tests/pngcomp.phpt index 3fd7b57055..aa663a6dd2 100644 --- a/ext/gd/tests/pngcomp.phpt +++ b/ext/gd/tests/pngcomp.phpt @@ -12,7 +12,7 @@ png compression test ?> --FILE-- <?php - $cwd = dirname(__FILE__); + $cwd = __DIR__; echo "PNG compression test: "; diff --git a/ext/gd/tests/simpletext私はガラスを食べられます.jpg b/ext/gd/tests/simpletext私はガラスを食べられます.jpg Binary files differdeleted file mode 100644 index c527d7982f..0000000000 --- a/ext/gd/tests/simpletext私はガラスを食べられます.jpg +++ /dev/null diff --git a/ext/gd/tests/src.png b/ext/gd/tests/src.png Binary files differdeleted file mode 100644 index d38c74268a..0000000000 --- a/ext/gd/tests/src.png +++ /dev/null diff --git a/ext/gd/tests/xbm2png.phpt b/ext/gd/tests/xbm2png.phpt index 7eaabc410b..8dcd07bc4a 100644 --- a/ext/gd/tests/xbm2png.phpt +++ b/ext/gd/tests/xbm2png.phpt @@ -14,7 +14,7 @@ xbm --> png conversion test ?> --FILE-- <?php - $cwd = dirname(__FILE__); + $cwd = __DIR__; echo "XBM to PNG conversion: "; echo imagepng(imagecreatefromxbm($cwd . "/conv_test.xbm"), $cwd . "/test_xbm.png") ? 'ok' : 'failed'; diff --git a/ext/gd/tests/xpm2gd.phpt b/ext/gd/tests/xpm2gd.phpt index e70a13f379..f48dcb2b3b 100644 --- a/ext/gd/tests/xpm2gd.phpt +++ b/ext/gd/tests/xpm2gd.phpt @@ -12,18 +12,18 @@ xpm --> gd1/gd2 conversion test ?> --FILE-- <?php - $cwd = dirname(__FILE__); + $cwd = __DIR__; echo "XPM to GD1 conversion: "; - echo imagegd(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test.gd1") ? 'ok' : 'failed'; + echo imagegd(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.gd1") ? 'ok' : 'failed'; echo "\n"; echo "XPM to GD2 conversion: "; - echo imagegd2(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test.gd2") ? 'ok' : 'failed'; + echo imagegd2(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.gd2") ? 'ok' : 'failed'; echo "\n"; - @unlink($cwd . "/test.gd1"); - @unlink($cwd . "/test.gd2"); + @unlink($cwd . "/test_xpm.gd1"); + @unlink($cwd . "/test_xpm.gd2"); ?> --EXPECT-- XPM to GD1 conversion: ok diff --git a/ext/gd/tests/xpm2jpg.phpt b/ext/gd/tests/xpm2jpg.phpt index d412b074a7..92cab3e5fa 100644 --- a/ext/gd/tests/xpm2jpg.phpt +++ b/ext/gd/tests/xpm2jpg.phpt @@ -15,7 +15,7 @@ xpm --> jpeg conversion test ?> --FILE-- <?php - $cwd = dirname(__FILE__); + $cwd = __DIR__; echo "XPM to JPEG conversion: "; echo imagejpeg(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.jpeg") ? 'ok' : 'failed'; diff --git a/ext/gd/tests/xpm2png.phpt b/ext/gd/tests/xpm2png.phpt index a5eadffd81..e473cfb31c 100644 --- a/ext/gd/tests/xpm2png.phpt +++ b/ext/gd/tests/xpm2png.phpt @@ -15,7 +15,7 @@ xpm --> png conversion test ?> --FILE-- <?php - $cwd = dirname(__FILE__); + $cwd = __DIR__; echo "XPM to PNG conversion: "; echo imagepng(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.png") ? 'ok' : 'failed'; |