diff options
| author | Ondřej Surý <ondrej@sury.org> | 2013-05-09 17:32:08 +0200 |
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2013-05-09 17:32:08 +0200 |
| commit | d674441ee1b9e7407f464b2692d9f5a0e2be3b4e (patch) | |
| tree | cc4885524786f143bcc1af7d6c3f86fb571905de | |
| parent | 367111123281ebfd2876d4c8cf33414b394f489a (diff) | |
| download | php-upstream/5.5.0_rc1.tar.gz | |
Imported Upstream version 5.5.0~rc1upstream/5.5.0_rc1
67 files changed, 1013 insertions, 4618 deletions
@@ -1,15 +1,48 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +09 May 2013, PHP 5.5.0 Release Candidate 1 + +- FPM: + . Ignore QUERY_STRING when sent in SCRIPT_FILENAME. (Remi) + . Fixed some possible memory or resource leaks and possible null dereference + detected by code coverity scan. (Remi) + . Log a warning when a syscall fails. (Remi) + +- GD: + . Fix build with system libgd >= 2.1 which is now the minimal + version required (as build with previous version is broken). + No change when bundled libgd is used. (Ondrej Sury, Remi) + +- SNMP: + . Fixed bug #64765 (Some IPv6 addresses get interpreted wrong). + (Boris Lytochkin) + . Fixed bug #64159 (Truncated snmpget). (Boris Lytochkin) + +- Streams: + . Fixed bug #64770 (stream_select() fails with pipes returned by proc_open() + on Windows x64). (Anatol) + 25 Apr 2013, PHP 5.5.0 Beta 4 - Core: . Fixed bug #64677 (execution operator `` stealing surrounding arguments). (Laruence) +- CURL: + . Remove curl stream wrappers. (Pierrick) + +- MySQLi: + . Fixed bug #64726 (Segfault when calling fetch_object on a use_result and DB + pointer has closed). (Laruence) + - Zip: . Fixed bug #64342 (ZipArchive::addFile() has to check for file existence). (Anatol) +- SOAP: + . Added SoapClient constructor option 'ssl_method' to specify ssl method. + (Eric Iversen) + - Streams: . Fixed Windows x64 version of stream_socket_pair() and improved error handling (Anatol Belski) diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 1c76bd403..c6aee57a7 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -672,7 +672,7 @@ static inline unsigned int zend_mm_high_bit(size_t _size) #elif defined(__GNUC__) && defined(__x86_64__) unsigned long n; - __asm__("bsrq %1,%0\n\t" : "=r" (n) : "rm" (_size) : "cc"); + __asm__("bsr %1,%0\n\t" : "=r" (n) : "rm" (_size) : "cc"); return (unsigned int)n; #elif defined(_MSC_VER) && defined(_M_IX86) __asm { @@ -700,12 +700,12 @@ static inline unsigned int zend_mm_low_bit(size_t _size) #elif defined(__GNUC__) && defined(__x86_64__) unsigned long n; - __asm__("bsfq %1,%0\n\t" : "=r" (n) : "rm" (_size) : "cc"); + __asm__("bsf %1,%0\n\t" : "=r" (n) : "rm" (_size) : "cc"); return (unsigned int)n; #elif defined(_MSC_VER) && defined(_M_IX86) __asm { bsf eax, _size - } + } #elif defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__)) return __builtin_ctzl(_size); #else @@ -2485,12 +2485,21 @@ static inline size_t safe_address(size_t nmemb, size_t size, size_t offset) size_t res = nmemb; unsigned long overflow = 0; - __asm__ ("mulq %3\n\taddq %4,%0\n\tadcq %1,%1" +#ifdef __ILP32__ /* x32 */ +# define LP_SUFF "l" +#else /* amd64 */ +# define LP_SUFF "q" +#endif + + __asm__ ("mul" LP_SUFF " %3\n\t" + "add %4,%0\n\t" + "adc %1,%1" : "=&a"(res), "=&d" (overflow) : "%0"(res), "rm"(size), "rm"(offset)); +#undef LP_SUFF if (UNEXPECTED(overflow)) { zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", nmemb, size, offset); return 0; diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index d61aba14b..47fb4d2d9 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -1014,7 +1014,7 @@ ZEND_FUNCTION(get_object_vars) while (zend_hash_get_current_data_ex(properties, (void **) &value, &pos) == SUCCESS) { if (zend_hash_get_current_key_ex(properties, &key, &key_len, &num_index, 0, &pos) == HASH_KEY_IS_STRING) { if (zend_check_property_access(zobj, key, key_len-1 TSRMLS_CC) == SUCCESS) { - zend_unmangle_property_name_ex(key, key_len - 1, &class_name, &prop_name, &prop_len); + zend_unmangle_property_name_ex(key, key_len - 1, &class_name, &prop_name, (int*) &prop_len); /* Not separating references */ Z_ADDREF_PP(value); add_assoc_zval_ex(return_value, prop_name, prop_len + 1, *value); diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 3c0d753b6..862f82da0 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -288,7 +288,7 @@ ZEND_API zend_bool zend_is_compiling(TSRMLS_D) /* {{{ */ static zend_uint get_temporary_variable(zend_op_array *op_array) /* {{{ */ { - return (zend_uint)EX_TMP_VAR_NUM(0, (op_array->T)++); + return (zend_uint)(zend_uintptr_t)EX_TMP_VAR_NUM(0, (op_array->T)++); } /* }}} */ diff --git a/Zend/zend_float.h b/Zend/zend_float.h index a17ad5658..56bdb151a 100644 --- a/Zend/zend_float.h +++ b/Zend/zend_float.h @@ -65,11 +65,13 @@ extern ZEND_API void zend_ensure_fpu_mode(TSRMLS_D); MS Visual C: - Since MSVC users tipically don't use autoconf or CMake, we will detect - MSVC via compile time define. + MSVC via compile time define. Floating point precision change isn't + supported on 64 bit platforms, so it's NOP. See + http://msdn.microsoft.com/en-us/library/c9676k6h(v=vs.110).aspx */ /* MSVC detection (MSVC people usually don't use autoconf) */ -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(_WIN64) # if _MSC_VER >= 1500 /* Visual C++ 2008 or higher, supports _controlfp_s */ # define HAVE__CONTROLFP_S diff --git a/Zend/zend_multiply.h b/Zend/zend_multiply.h index e52956f41..0d8977fde 100644 --- a/Zend/zend_multiply.h +++ b/Zend/zend_multiply.h @@ -35,8 +35,8 @@ #define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \ long __tmpvar; \ - __asm__ ("imulq %3,%0\n" \ - "adcq $0,%1" \ + __asm__ ("imul %3,%0\n" \ + "adc $0,%1" \ : "=r"(__tmpvar),"=r"(usedval) \ : "0"(a), "r"(b), "1"(0)); \ if (usedval) (dval) = (double) (a) * (double) (b); \ diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index a82c14b8c..0b890ff48 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -26,6 +26,10 @@ #include <math.h> #include <assert.h> +#ifdef __GNUC__ +#include <stddef.h> +#endif + #ifdef HAVE_IEEEFP_H #include <ieeefp.h> #endif @@ -497,7 +501,7 @@ ZEND_API void zend_update_current_locale(void); /* The offset in bytes between the value and type fields of a zval */ #define ZVAL_OFFSETOF_TYPE \ - (__builtin_offsetof(zval,type) - __builtin_offsetof(zval,value)) + (offsetof(zval,type) - offsetof(zval,value)) static zend_always_inline int fast_increment_function(zval *op1) { @@ -3684,7 +3684,7 @@ ac_config_headers="$ac_config_headers main/php_config.h" PHP_MAJOR_VERSION=5 PHP_MINOR_VERSION=5 PHP_RELEASE_VERSION=0 -PHP_EXTRA_VERSION="beta4" +PHP_EXTRA_VERSION="RC1" PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION" PHP_VERSION_ID=`expr $PHP_MAJOR_VERSION \* 10000 + $PHP_MINOR_VERSION \* 100 + $PHP_RELEASE_VERSION` @@ -37214,7 +37214,6 @@ $as_echo "$ext_output" >&6; } - if test -z "$PHP_VPX_DIR"; then php_with_vpx_dir=no @@ -37459,29 +37458,7 @@ $as_echo "$ext_output" >&6; } -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/webpimg.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/xbm.c libgd/gd_gif_out.c libgd/gd_security.c \ - libgd/gd_filter.c libgd/gd_pixelate.c libgd/gd_arc.c libgd/gd_rotate.c libgd/gd_color.c \ - libgd/gd_transform.c libgd/gd_crop.c libgd/gd_interpolation.c libgd/gd_matrix.c" - - for ac_func in fabsf floorf -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - +if test "$PHP_GD" != "no"; then test "$PHP_PNG_DIR" = "no" && PHP_PNG_DIR=yes @@ -37516,25 +37493,20 @@ $as_echo "#define USE_GD_IMGSTRTTF 1" >>confdefs.h fi - if test "$PHP_GD_JIS_CONV" = "yes"; then - USE_GD_JIS_CONV=1 - fi - - - if test "$PHP_JPEG_DIR" != "no"; then + if test "$PHP_VPX_DIR" != "no"; then - for i in $PHP_JPEG_DIR /usr/local /usr; do - test -f $i/include/jpeglib.h && GD_JPEG_DIR=$i && break + for i in $PHP_VPX_DIR /usr/local /usr; do + test -f $i/include/vpx_codec.h || test -f $i/include/vpx/vpx_codec.h && GD_VPX_DIR=$i && break done - if test -z "$GD_JPEG_DIR"; then - as_fn_error $? "jpeglib.h not found." "$LINENO" 5 + if test -z "$GD_VPX_DIR"; then + as_fn_error $? "vpx_codec.h not found." "$LINENO" 5 fi save_old_LDFLAGS=$LDFLAGS ac_stuff=" - -L$GD_JPEG_DIR/$PHP_LIBDIR + -L$GD_VPX_DIR/$PHP_LIBDIR " save_ext_shared=$ext_shared @@ -37628,13 +37600,13 @@ $as_echo "#define USE_GD_IMGSTRTTF 1" >>confdefs.h esac done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jpeg_read_header in -ljpeg" >&5 -$as_echo_n "checking for jpeg_read_header in -ljpeg... " >&6; } -if ${ac_cv_lib_jpeg_jpeg_read_header+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for vpx_codec_destroy in -lvpx" >&5 +$as_echo_n "checking for vpx_codec_destroy in -lvpx... " >&6; } +if ${ac_cv_lib_vpx_vpx_codec_destroy+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-ljpeg $LIBS" +LIBS="-lvpx $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -37644,42 +37616,42 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char jpeg_read_header (); +char vpx_codec_destroy (); int main () { -return jpeg_read_header (); +return vpx_codec_destroy (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_jpeg_jpeg_read_header=yes + ac_cv_lib_vpx_vpx_codec_destroy=yes else - ac_cv_lib_jpeg_jpeg_read_header=no + ac_cv_lib_vpx_vpx_codec_destroy=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_jpeg_read_header" >&5 -$as_echo "$ac_cv_lib_jpeg_jpeg_read_header" >&6; } -if test "x$ac_cv_lib_jpeg_jpeg_read_header" = xyes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_vpx_vpx_codec_destroy" >&5 +$as_echo "$ac_cv_lib_vpx_vpx_codec_destroy" >&6; } +if test "x$ac_cv_lib_vpx_vpx_codec_destroy" = xyes; then : LDFLAGS=$save_old_LDFLAGS ext_shared=$save_ext_shared - if test "$GD_JPEG_DIR/include" != "/usr/include"; then + if test "$GD_VPX_DIR/include" != "/usr/include"; then - if test -z "$GD_JPEG_DIR/include" || echo "$GD_JPEG_DIR/include" | grep '^/' >/dev/null ; then - ai_p=$GD_JPEG_DIR/include + if test -z "$GD_VPX_DIR/include" || echo "$GD_VPX_DIR/include" | grep '^/' >/dev/null ; then + ai_p=$GD_VPX_DIR/include else - ep_dir="`echo $GD_JPEG_DIR/include|$SED 's%/*[^/][^/]*/*$%%'`" + ep_dir="`echo $GD_VPX_DIR/include|$SED 's%/*[^/][^/]*/*$%%'`" ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$GD_JPEG_DIR/include\"`" + ai_p="$ep_realdir/`basename \"$GD_VPX_DIR/include\"`" fi @@ -37702,20 +37674,30 @@ if test "x$ac_cv_lib_jpeg_jpeg_read_header" = xyes; then : + case pthread in + c|c_r|pthread*) ;; + *) + LIBS="-lpthread $LIBS" + ;; + esac + + + + if test "$ext_shared" = "yes"; then - GD_SHARED_LIBADD="-ljpeg $GD_SHARED_LIBADD" - if test -n "$GD_JPEG_DIR/$PHP_LIBDIR"; then + GD_SHARED_LIBADD="-lvpx $GD_SHARED_LIBADD" + if test -n "$GD_VPX_DIR/$PHP_LIBDIR"; then - if test "$GD_JPEG_DIR/$PHP_LIBDIR" != "/usr/$PHP_LIBDIR" && test "$GD_JPEG_DIR/$PHP_LIBDIR" != "/usr/lib"; then + if test "$GD_VPX_DIR/$PHP_LIBDIR" != "/usr/$PHP_LIBDIR" && test "$GD_VPX_DIR/$PHP_LIBDIR" != "/usr/lib"; then - if test -z "$GD_JPEG_DIR/$PHP_LIBDIR" || echo "$GD_JPEG_DIR/$PHP_LIBDIR" | grep '^/' >/dev/null ; then - ai_p=$GD_JPEG_DIR/$PHP_LIBDIR + if test -z "$GD_VPX_DIR/$PHP_LIBDIR" || echo "$GD_VPX_DIR/$PHP_LIBDIR" | grep '^/' >/dev/null ; then + ai_p=$GD_VPX_DIR/$PHP_LIBDIR else - ep_dir="`echo $GD_JPEG_DIR/$PHP_LIBDIR|$SED 's%/*[^/][^/]*/*$%%'`" + ep_dir="`echo $GD_VPX_DIR/$PHP_LIBDIR|$SED 's%/*[^/][^/]*/*$%%'`" ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$GD_JPEG_DIR/$PHP_LIBDIR\"`" + ai_p="$ep_realdir/`basename \"$GD_VPX_DIR/$PHP_LIBDIR\"`" fi @@ -37747,18 +37729,18 @@ if test "x$ac_cv_lib_jpeg_jpeg_read_header" = xyes; then : else - if test -n "$GD_JPEG_DIR/$PHP_LIBDIR"; then + if test -n "$GD_VPX_DIR/$PHP_LIBDIR"; then - if test "$GD_JPEG_DIR/$PHP_LIBDIR" != "/usr/$PHP_LIBDIR" && test "$GD_JPEG_DIR/$PHP_LIBDIR" != "/usr/lib"; then + if test "$GD_VPX_DIR/$PHP_LIBDIR" != "/usr/$PHP_LIBDIR" && test "$GD_VPX_DIR/$PHP_LIBDIR" != "/usr/lib"; then - if test -z "$GD_JPEG_DIR/$PHP_LIBDIR" || echo "$GD_JPEG_DIR/$PHP_LIBDIR" | grep '^/' >/dev/null ; then - ai_p=$GD_JPEG_DIR/$PHP_LIBDIR + if test -z "$GD_VPX_DIR/$PHP_LIBDIR" || echo "$GD_VPX_DIR/$PHP_LIBDIR" | grep '^/' >/dev/null ; then + ai_p=$GD_VPX_DIR/$PHP_LIBDIR else - ep_dir="`echo $GD_JPEG_DIR/$PHP_LIBDIR|$SED 's%/*[^/][^/]*/*$%%'`" + ep_dir="`echo $GD_VPX_DIR/$PHP_LIBDIR|$SED 's%/*[^/][^/]*/*$%%'`" ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$GD_JPEG_DIR/$PHP_LIBDIR\"`" + ai_p="$ep_realdir/`basename \"$GD_VPX_DIR/$PHP_LIBDIR\"`" fi @@ -37784,10 +37766,10 @@ if test "x$ac_cv_lib_jpeg_jpeg_read_header" = xyes; then : fi - case jpeg in + case vpx in c|c_r|pthread*) ;; *) - LIBS="-ljpeg $LIBS" + LIBS="-lvpx $LIBS" ;; esac @@ -37803,33 +37785,33 @@ else LDFLAGS=$save_old_LDFLAGS ext_shared=$save_ext_shared - unset ac_cv_lib_jpeg_jpeg_read_header + unset ac_cv_lib_vpx_vpx_codec_destroy - as_fn_error $? "Problem with libjpeg.(a|so). Please check config.log for more information." "$LINENO" 5 + as_fn_error $? "Problem with libvpx.(a|so). Please check config.log for more information." "$LINENO" 5 fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: If configure fails try --with-jpeg-dir=<DIR>" >&5 -$as_echo "If configure fails try --with-jpeg-dir=<DIR>" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: If configure fails try --with-vpx-dir=<DIR>" >&5 +$as_echo "If configure fails try --with-vpx-dir=<DIR>" >&6; } fi - if test "$PHP_VPX_DIR" != "no"; then + if test "$PHP_JPEG_DIR" != "no"; then - for i in $PHP_VPX_DIR /usr/local /usr; do - test -f $i/include/vpx_codec.h || test -f $i/include/vpx/vpx_codec.h && GD_VPX_DIR=$i && break + 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_VPX_DIR"; then - as_fn_error $? "vpx_codec.h not found." "$LINENO" 5 + if test -z "$GD_JPEG_DIR"; then + as_fn_error $? "jpeglib.h not found." "$LINENO" 5 fi save_old_LDFLAGS=$LDFLAGS ac_stuff=" - -L$GD_VPX_DIR/$PHP_LIBDIR + -L$GD_JPEG_DIR/$PHP_LIBDIR " save_ext_shared=$ext_shared @@ -37923,13 +37905,13 @@ $as_echo "If configure fails try --with-jpeg-dir=<DIR>" >&6; } esac done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for vpx_codec_destroy in -lvpx" >&5 -$as_echo_n "checking for vpx_codec_destroy in -lvpx... " >&6; } -if ${ac_cv_lib_vpx_vpx_codec_destroy+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jpeg_read_header in -ljpeg" >&5 +$as_echo_n "checking for jpeg_read_header in -ljpeg... " >&6; } +if ${ac_cv_lib_jpeg_jpeg_read_header+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lvpx $LIBS" +LIBS="-ljpeg $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -37939,42 +37921,42 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char vpx_codec_destroy (); +char jpeg_read_header (); int main () { -return vpx_codec_destroy (); +return jpeg_read_header (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_vpx_vpx_codec_destroy=yes + ac_cv_lib_jpeg_jpeg_read_header=yes else - ac_cv_lib_vpx_vpx_codec_destroy=no + ac_cv_lib_jpeg_jpeg_read_header=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_vpx_vpx_codec_destroy" >&5 -$as_echo "$ac_cv_lib_vpx_vpx_codec_destroy" >&6; } -if test "x$ac_cv_lib_vpx_vpx_codec_destroy" = xyes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_jpeg_read_header" >&5 +$as_echo "$ac_cv_lib_jpeg_jpeg_read_header" >&6; } +if test "x$ac_cv_lib_jpeg_jpeg_read_header" = xyes; then : LDFLAGS=$save_old_LDFLAGS ext_shared=$save_ext_shared - if test "$GD_VPX_DIR/include" != "/usr/include"; then + if test "$GD_JPEG_DIR/include" != "/usr/include"; then - if test -z "$GD_VPX_DIR/include" || echo "$GD_VPX_DIR/include" | grep '^/' >/dev/null ; then - ai_p=$GD_VPX_DIR/include + if test -z "$GD_JPEG_DIR/include" || echo "$GD_JPEG_DIR/include" | grep '^/' >/dev/null ; then + ai_p=$GD_JPEG_DIR/include else - ep_dir="`echo $GD_VPX_DIR/include|$SED 's%/*[^/][^/]*/*$%%'`" + ep_dir="`echo $GD_JPEG_DIR/include|$SED 's%/*[^/][^/]*/*$%%'`" ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$GD_VPX_DIR/include\"`" + ai_p="$ep_realdir/`basename \"$GD_JPEG_DIR/include\"`" fi @@ -37997,30 +37979,20 @@ if test "x$ac_cv_lib_vpx_vpx_codec_destroy" = xyes; then : - case pthread in - c|c_r|pthread*) ;; - *) - LIBS="-lpthread $LIBS" - ;; - esac - - - - if test "$ext_shared" = "yes"; then - GD_SHARED_LIBADD="-lvpx $GD_SHARED_LIBADD" - if test -n "$GD_VPX_DIR/$PHP_LIBDIR"; then + GD_SHARED_LIBADD="-ljpeg $GD_SHARED_LIBADD" + if test -n "$GD_JPEG_DIR/$PHP_LIBDIR"; then - if test "$GD_VPX_DIR/$PHP_LIBDIR" != "/usr/$PHP_LIBDIR" && test "$GD_VPX_DIR/$PHP_LIBDIR" != "/usr/lib"; then + if test "$GD_JPEG_DIR/$PHP_LIBDIR" != "/usr/$PHP_LIBDIR" && test "$GD_JPEG_DIR/$PHP_LIBDIR" != "/usr/lib"; then - if test -z "$GD_VPX_DIR/$PHP_LIBDIR" || echo "$GD_VPX_DIR/$PHP_LIBDIR" | grep '^/' >/dev/null ; then - ai_p=$GD_VPX_DIR/$PHP_LIBDIR + if test -z "$GD_JPEG_DIR/$PHP_LIBDIR" || echo "$GD_JPEG_DIR/$PHP_LIBDIR" | grep '^/' >/dev/null ; then + ai_p=$GD_JPEG_DIR/$PHP_LIBDIR else - ep_dir="`echo $GD_VPX_DIR/$PHP_LIBDIR|$SED 's%/*[^/][^/]*/*$%%'`" + ep_dir="`echo $GD_JPEG_DIR/$PHP_LIBDIR|$SED 's%/*[^/][^/]*/*$%%'`" ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$GD_VPX_DIR/$PHP_LIBDIR\"`" + ai_p="$ep_realdir/`basename \"$GD_JPEG_DIR/$PHP_LIBDIR\"`" fi @@ -38052,18 +38024,18 @@ if test "x$ac_cv_lib_vpx_vpx_codec_destroy" = xyes; then : else - if test -n "$GD_VPX_DIR/$PHP_LIBDIR"; then + if test -n "$GD_JPEG_DIR/$PHP_LIBDIR"; then - if test "$GD_VPX_DIR/$PHP_LIBDIR" != "/usr/$PHP_LIBDIR" && test "$GD_VPX_DIR/$PHP_LIBDIR" != "/usr/lib"; then + if test "$GD_JPEG_DIR/$PHP_LIBDIR" != "/usr/$PHP_LIBDIR" && test "$GD_JPEG_DIR/$PHP_LIBDIR" != "/usr/lib"; then - if test -z "$GD_VPX_DIR/$PHP_LIBDIR" || echo "$GD_VPX_DIR/$PHP_LIBDIR" | grep '^/' >/dev/null ; then - ai_p=$GD_VPX_DIR/$PHP_LIBDIR + if test -z "$GD_JPEG_DIR/$PHP_LIBDIR" || echo "$GD_JPEG_DIR/$PHP_LIBDIR" | grep '^/' >/dev/null ; then + ai_p=$GD_JPEG_DIR/$PHP_LIBDIR else - ep_dir="`echo $GD_VPX_DIR/$PHP_LIBDIR|$SED 's%/*[^/][^/]*/*$%%'`" + ep_dir="`echo $GD_JPEG_DIR/$PHP_LIBDIR|$SED 's%/*[^/][^/]*/*$%%'`" ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$GD_VPX_DIR/$PHP_LIBDIR\"`" + ai_p="$ep_realdir/`basename \"$GD_JPEG_DIR/$PHP_LIBDIR\"`" fi @@ -38089,10 +38061,10 @@ if test "x$ac_cv_lib_vpx_vpx_codec_destroy" = xyes; then : fi - case vpx in + case jpeg in c|c_r|pthread*) ;; *) - LIBS="-lvpx $LIBS" + LIBS="-ljpeg $LIBS" ;; esac @@ -38108,16 +38080,16 @@ else LDFLAGS=$save_old_LDFLAGS ext_shared=$save_ext_shared - unset ac_cv_lib_vpx_vpx_codec_destroy + unset ac_cv_lib_jpeg_jpeg_read_header - as_fn_error $? "Problem with libvpx.(a|so). Please check config.log for more information." "$LINENO" 5 + as_fn_error $? "Problem with libjpeg.(a|so). Please check config.log for more information." "$LINENO" 5 fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: If configure fails try --with-vpx-dir=<DIR>" >&5 -$as_echo "If configure fails try --with-vpx-dir=<DIR>" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: If configure fails try --with-jpeg-dir=<DIR>" >&5 +$as_echo "If configure fails try --with-jpeg-dir=<DIR>" >&6; } fi @@ -38521,18 +38493,11 @@ $as_echo "If configure fails try --with-png-dir=<DIR> and --with-zlib-dir=<DIR>" if test "$PHP_XPM_DIR" != "no"; then for i in $PHP_XPM_DIR /usr/local /usr/X11R6 /usr; do - test -f $i/$PHP_LIBDIR/libXpm.$SHLIB_SUFFIX_NAME || test -f $i/$PHP_LIBDIR/libXpm.a && GD_XPM_DIR=$i && break + 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 - as_fn_error $? "libXpm.(a|so) not found." "$LINENO" 5 - fi - - for i in include include/X11; do - test -f $GD_XPM_DIR/$i/xpm.h && GD_XPM_INC=$GD_XPM_DIR/include - done - - if test -z "$GD_XPM_INC"; then as_fn_error $? "xpm.h not found." "$LINENO" 5 fi @@ -39552,68 +39517,44 @@ fi fi + if test "$PHP_GD_JIS_CONV" = "yes"; then + USE_GD_JIS_CONV=1 + fi -$as_echo "#define HAVE_LIBGD 1" >>confdefs.h - - -$as_echo "#define HAVE_LIBGD13 1" >>confdefs.h - - -$as_echo "#define HAVE_LIBGD15 1" >>confdefs.h - - -$as_echo "#define HAVE_LIBGD20 1" >>confdefs.h - - -$as_echo "#define HAVE_LIBGD204 1" >>confdefs.h - - -$as_echo "#define HAVE_GD_IMAGESETTILE 1" >>confdefs.h - - -$as_echo "#define HAVE_GD_IMAGESETBRUSH 1" >>confdefs.h - - -$as_echo "#define HAVE_GDIMAGECOLORRESOLVE 1" >>confdefs.h - - -$as_echo "#define HAVE_COLORCLOSESTHWB 1" >>confdefs.h - - -$as_echo "#define HAVE_GD_WBMP 1" >>confdefs.h - - -$as_echo "#define HAVE_GD_GD2 1" >>confdefs.h +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/webpimg.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/xbm.c libgd/gd_gif_out.c libgd/gd_security.c \ + libgd/gd_filter.c libgd/gd_pixelate.c libgd/gd_arc.c libgd/gd_rotate.c libgd/gd_color.c \ + libgd/gd_transform.c libgd/gd_crop.c libgd/gd_interpolation.c libgd/gd_matrix.c" -$as_echo "#define HAVE_GD_PNG 1" >>confdefs.h + for ac_func in fabsf floorf +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF +fi +done -$as_echo "#define HAVE_GD_XBM 1" >>confdefs.h $as_echo "#define HAVE_GD_BUNDLED 1" >>confdefs.h -$as_echo "#define HAVE_GD_GIF_READ 1" >>confdefs.h - - -$as_echo "#define HAVE_GD_GIF_CREATE 1" >>confdefs.h - - -$as_echo "#define HAVE_GD_IMAGEELLIPSE 1" >>confdefs.h - - -$as_echo "#define HAVE_GD_FONTCACHESHUTDOWN 1" >>confdefs.h - - -$as_echo "#define HAVE_GD_FONTMUTEX 1" >>confdefs.h - - -$as_echo "#define HAVE_GD_DYNAMIC_CTX_EX 1" >>confdefs.h +$as_echo "#define HAVE_GD_PNG 1" >>confdefs.h -$as_echo "#define HAVE_GD_GIF_CTX 1" >>confdefs.h +$as_echo "#define HAVE_GD_CACHE_CREATE 1" >>confdefs.h GDLIB_CFLAGS="-DHAVE_LIBPNG" @@ -39642,10 +39583,7 @@ $as_echo "#define HAVE_GD_XPM 1" >>confdefs.h if test -n "$FREETYPE2_DIR"; then -$as_echo "#define HAVE_GD_STRINGFT 1" >>confdefs.h - - -$as_echo "#define HAVE_GD_STRINGFTEX 1" >>confdefs.h +$as_echo "#define HAVE_GD_FREETYPE 1" >>confdefs.h $as_echo "#define ENABLE_GD_TTF 1" >>confdefs.h @@ -39664,8 +39602,7 @@ else if test "$PHP_GD" != "no"; then GD_MODULE_TYPE=external - extra_sources="gdcache.c libgd/gd_compat.c libgd/gd_filter.c libgd/gd_pixelate.c libgd/gd_arc.c \ - libgd/gd_rotate.c libgd/gd_color.c" + extra_sources="gd_compat.c" if test "$PHP_ZLIB_DIR" != "no" && test "$PHP_ZLIB_DIR" != "yes"; then @@ -40698,18 +40635,11 @@ $as_echo "If configure fails try --with-png-dir=<DIR> and --with-zlib-dir=<DIR>" if test "$PHP_XPM_DIR" != "no"; then for i in $PHP_XPM_DIR /usr/local /usr/X11R6 /usr; do - test -f $i/$PHP_LIBDIR/libXpm.$SHLIB_SUFFIX_NAME || test -f $i/$PHP_LIBDIR/libXpm.a && GD_XPM_DIR=$i && break + 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 - as_fn_error $? "libXpm.(a|so) not found." "$LINENO" 5 - fi - - for i in include include/X11; do - test -f $GD_XPM_DIR/$i/xpm.h && GD_XPM_INC=$GD_XPM_DIR/include - done - - if test -z "$GD_XPM_INC"; then as_fn_error $? "xpm.h not found." "$LINENO" 5 fi @@ -41729,119 +41659,20 @@ fi fi - for i in include/gd1.3 include/gd include gd1.3 gd ""; do + for i in include/gd include gd ""; do test -f "$PHP_GD/$i/gd.h" && GD_INCLUDE="$PHP_GD/$i" done - for i in $PHP_LIBDIR/gd1.3 $PHP_LIBDIR/gd $PHP_LIBDIR gd1.3 gd ""; do - test -f "$PHP_GD/$i/libgd.$SHLIB_SUFFIX_NAME" || test -f "$PHP_GD/$i/libgd.a" && GD_LIB="$PHP_GD/$i" - done - - if test -n "$GD_INCLUDE" && test -n "$GD_LIB"; then - - - if test "$ext_shared" = "yes"; then - GD_SHARED_LIBADD="-lgd $GD_SHARED_LIBADD" - if test -n "$GD_LIB"; then - - if test "$GD_LIB" != "/usr/$PHP_LIBDIR" && test "$GD_LIB" != "/usr/lib"; then - - if test -z "$GD_LIB" || echo "$GD_LIB" | grep '^/' >/dev/null ; then - ai_p=$GD_LIB - else - - ep_dir="`echo $GD_LIB|$SED 's%/*[^/][^/]*/*$%%'`" - - ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$GD_LIB\"`" - fi - - - if test "$ext_shared" = "yes"; then - GD_SHARED_LIBADD="-L$ai_p $GD_SHARED_LIBADD" - test -n "$ld_runpath_switch" && GD_SHARED_LIBADD="$ld_runpath_switch$ai_p $GD_SHARED_LIBADD" - else - - - - unique=`echo $ai_p|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$LIBPATH$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "LIBPATH$unique=set" - - test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p" - LDFLAGS="$LDFLAGS -L$ai_p" - PHP_RPATHS="$PHP_RPATHS $ai_p" - - fi - - - fi - - fi - - fi - else - - - if test -n "$GD_LIB"; then - - if test "$GD_LIB" != "/usr/$PHP_LIBDIR" && test "$GD_LIB" != "/usr/lib"; then - - if test -z "$GD_LIB" || echo "$GD_LIB" | grep '^/' >/dev/null ; then - ai_p=$GD_LIB - else - - ep_dir="`echo $GD_LIB|$SED 's%/*[^/][^/]*/*$%%'`" - - ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$GD_LIB\"`" - fi - - - - - - unique=`echo $ai_p|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$LIBPATH$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "LIBPATH$unique=set" - - test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p" - LDFLAGS="$LDFLAGS -L$ai_p" - PHP_RPATHS="$PHP_RPATHS $ai_p" - - fi - - - - fi - - fi - - - case gd in - c|c_r|pthread*) ;; - *) - LIBS="-lgd $LIBS" - ;; - esac - - - - + if test -z "$GD_INCLUDE"; then + as_fn_error $? "Unable to find gd.h anywhere under $PHP_GD" "$LINENO" 5 fi -$as_echo "#define HAVE_LIBGD 1" >>confdefs.h - - - save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " + ac_stuff=" + -L$PHP_GD/$PHP_LIBDIR + " save_ext_shared=$ext_shared ext_shared=yes @@ -41934,9 +41765,9 @@ $as_echo "#define HAVE_LIBGD 1" >>confdefs.h esac done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdImageString16 in -lgd" >&5 -$as_echo_n "checking for gdImageString16 in -lgd... " >&6; } -if ${ac_cv_lib_gd_gdImageString16+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdSetErrorMethod in -lgd" >&5 +$as_echo_n "checking for gdSetErrorMethod in -lgd... " >&6; } +if ${ac_cv_lib_gd_gdSetErrorMethod+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -41950,113 +41781,53 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char gdImageString16 (); +char gdSetErrorMethod (); int main () { -return gdImageString16 (); +return gdSetErrorMethod (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gd_gdImageString16=yes + ac_cv_lib_gd_gdSetErrorMethod=yes else - ac_cv_lib_gd_gdImageString16=no + ac_cv_lib_gd_gdSetErrorMethod=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdImageString16" >&5 -$as_echo "$ac_cv_lib_gd_gdImageString16" >&6; } -if test "x$ac_cv_lib_gd_gdImageString16" = xyes; then : - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - -$as_echo "#define HAVE_LIBGD13 1" >>confdefs.h - - -else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdSetErrorMethod" >&5 +$as_echo "$ac_cv_lib_gd_gdSetErrorMethod" >&6; } +if test "x$ac_cv_lib_gd_gdSetErrorMethod" = xyes; then : LDFLAGS=$save_old_LDFLAGS ext_shared=$save_ext_shared - unset ac_cv_lib_gd_gdImageString16 - -fi - - - save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " - - save_ext_shared=$ext_shared - ext_shared=yes - for ac_i in $ac_stuff; do - case $ac_i in - -pthread) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -pthread" - else + if test "$ext_shared" = "yes"; then + GD_SHARED_LIBADD="-lgd $GD_SHARED_LIBADD" + if test -n "$PHP_GD/$PHP_LIBDIR"; then - unique=`echo $ac_i|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$EXTRA_LDFLAGS$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "EXTRA_LDFLAGS$unique=set" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i" - fi - - fi - ;; - -l*) - ac_ii=`echo $ac_i|cut -c 3-` - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -l$ac_ii" - else - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - LIBS="$LIBS -l$ac_ii" - ;; - esac - - - fi - ;; - esac - - - ;; - -L*) - ac_ii=`echo $ac_i|cut -c 3-` - - if test "$ac_ii" != "/usr/$PHP_LIBDIR" && test "$ac_ii" != "/usr/lib"; then + if test "$PHP_GD/$PHP_LIBDIR" != "/usr/$PHP_LIBDIR" && test "$PHP_GD/$PHP_LIBDIR" != "/usr/lib"; then - if test -z "$ac_ii" || echo "$ac_ii" | grep '^/' >/dev/null ; then - ai_p=$ac_ii + if test -z "$PHP_GD/$PHP_LIBDIR" || echo "$PHP_GD/$PHP_LIBDIR" | grep '^/' >/dev/null ; then + ai_p=$PHP_GD/$PHP_LIBDIR else - ep_dir="`echo $ac_ii|$SED 's%/*[^/][^/]*/*$%%'`" + ep_dir="`echo $PHP_GD/$PHP_LIBDIR|$SED 's%/*[^/][^/]*/*$%%'`" ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$ac_ii\"`" + ai_p="$ep_realdir/`basename \"$PHP_GD/$PHP_LIBDIR\"`" fi if test "$ext_shared" = "yes"; then - LDFLAGS="-L$ai_p $LDFLAGS" - test -n "$ld_runpath_switch" && LDFLAGS="$ld_runpath_switch$ai_p $LDFLAGS" + GD_SHARED_LIBADD="-L$ai_p $GD_SHARED_LIBADD" + test -n "$ld_runpath_switch" && GD_SHARED_LIBADD="$ld_runpath_switch$ai_p $GD_SHARED_LIBADD" else @@ -42078,282 +41849,25 @@ fi fi - ;; - esac - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdImagePaletteCopy in -lgd" >&5 -$as_echo_n "checking for gdImagePaletteCopy in -lgd... " >&6; } -if ${ac_cv_lib_gd_gdImagePaletteCopy+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgd $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gdImagePaletteCopy (); -int -main () -{ -return gdImagePaletteCopy (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gd_gdImagePaletteCopy=yes -else - ac_cv_lib_gd_gdImagePaletteCopy=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdImagePaletteCopy" >&5 -$as_echo "$ac_cv_lib_gd_gdImagePaletteCopy" >&6; } -if test "x$ac_cv_lib_gd_gdImagePaletteCopy" = xyes; then : - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - -$as_echo "#define HAVE_LIBGD15 1" >>confdefs.h - - -else - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - unset ac_cv_lib_gd_gdImagePaletteCopy - - -fi - - - save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " - - save_ext_shared=$ext_shared - ext_shared=yes - - for ac_i in $ac_stuff; do - case $ac_i in - -pthread) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -pthread" - else - - - unique=`echo $ac_i|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$EXTRA_LDFLAGS$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "EXTRA_LDFLAGS$unique=set" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i" - fi - - fi - ;; - -l*) - ac_ii=`echo $ac_i|cut -c 3-` - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -l$ac_ii" - else - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - LIBS="$LIBS -l$ac_ii" - ;; - esac - - fi - ;; - esac - - - ;; - -L*) - ac_ii=`echo $ac_i|cut -c 3-` - - if test "$ac_ii" != "/usr/$PHP_LIBDIR" && test "$ac_ii" != "/usr/lib"; then - - if test -z "$ac_ii" || echo "$ac_ii" | grep '^/' >/dev/null ; then - ai_p=$ac_ii else - ep_dir="`echo $ac_ii|$SED 's%/*[^/][^/]*/*$%%'`" - ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$ac_ii\"`" - fi - - - if test "$ext_shared" = "yes"; then - LDFLAGS="-L$ai_p $LDFLAGS" - test -n "$ld_runpath_switch" && LDFLAGS="$ld_runpath_switch$ai_p $LDFLAGS" - else + if test -n "$PHP_GD/$PHP_LIBDIR"; then + if test "$PHP_GD/$PHP_LIBDIR" != "/usr/$PHP_LIBDIR" && test "$PHP_GD/$PHP_LIBDIR" != "/usr/lib"; then - - unique=`echo $ai_p|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$LIBPATH$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "LIBPATH$unique=set" - - test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p" - LDFLAGS="$LDFLAGS -L$ai_p" - PHP_RPATHS="$PHP_RPATHS $ai_p" - - fi - - - fi - - fi - - ;; - esac - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdImageCreateFromPng in -lgd" >&5 -$as_echo_n "checking for gdImageCreateFromPng in -lgd... " >&6; } -if ${ac_cv_lib_gd_gdImageCreateFromPng+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgd $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gdImageCreateFromPng (); -int -main () -{ -return gdImageCreateFromPng (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gd_gdImageCreateFromPng=yes -else - ac_cv_lib_gd_gdImageCreateFromPng=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdImageCreateFromPng" >&5 -$as_echo "$ac_cv_lib_gd_gdImageCreateFromPng" >&6; } -if test "x$ac_cv_lib_gd_gdImageCreateFromPng" = xyes; then : - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - -$as_echo "#define HAVE_GD_PNG 1" >>confdefs.h - - -else - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - unset ac_cv_lib_gd_gdImageCreateFromPng - - -fi - - - save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " - - save_ext_shared=$ext_shared - ext_shared=yes - - for ac_i in $ac_stuff; do - case $ac_i in - -pthread) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -pthread" - else - - - unique=`echo $ac_i|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$EXTRA_LDFLAGS$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "EXTRA_LDFLAGS$unique=set" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i" - fi - - fi - ;; - -l*) - ac_ii=`echo $ac_i|cut -c 3-` - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -l$ac_ii" - else - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - LIBS="$LIBS -l$ac_ii" - ;; - esac - - - fi - ;; - esac - - - ;; - -L*) - ac_ii=`echo $ac_i|cut -c 3-` - - if test "$ac_ii" != "/usr/$PHP_LIBDIR" && test "$ac_ii" != "/usr/lib"; then - - if test -z "$ac_ii" || echo "$ac_ii" | grep '^/' >/dev/null ; then - ai_p=$ac_ii + if test -z "$PHP_GD/$PHP_LIBDIR" || echo "$PHP_GD/$PHP_LIBDIR" | grep '^/' >/dev/null ; then + ai_p=$PHP_GD/$PHP_LIBDIR else - ep_dir="`echo $ac_ii|$SED 's%/*[^/][^/]*/*$%%'`" + ep_dir="`echo $PHP_GD/$PHP_LIBDIR|$SED 's%/*[^/][^/]*/*$%%'`" ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$ac_ii\"`" + ai_p="$ep_realdir/`basename \"$PHP_GD/$PHP_LIBDIR\"`" fi - if test "$ext_shared" = "yes"; then - LDFLAGS="-L$ai_p $LDFLAGS" - test -n "$ld_runpath_switch" && LDFLAGS="$ld_runpath_switch$ai_p $LDFLAGS" - else @@ -42370,218 +41884,45 @@ fi fi - fi fi - ;; - esac - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdImageCreateFromGif in -lgd" >&5 -$as_echo_n "checking for gdImageCreateFromGif in -lgd... " >&6; } -if ${ac_cv_lib_gd_gdImageCreateFromGif+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgd $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gdImageCreateFromGif (); -int -main () -{ -return gdImageCreateFromGif (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gd_gdImageCreateFromGif=yes -else - ac_cv_lib_gd_gdImageCreateFromGif=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdImageCreateFromGif" >&5 -$as_echo "$ac_cv_lib_gd_gdImageCreateFromGif" >&6; } -if test "x$ac_cv_lib_gd_gdImageCreateFromGif" = xyes; then : - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - -$as_echo "#define HAVE_GD_GIF_READ 1" >>confdefs.h - - -else - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - unset ac_cv_lib_gd_gdImageCreateFromGif - - -fi - - - save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " - - save_ext_shared=$ext_shared - ext_shared=yes - - for ac_i in $ac_stuff; do - case $ac_i in - -pthread) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -pthread" - else - - - unique=`echo $ac_i|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$EXTRA_LDFLAGS$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "EXTRA_LDFLAGS$unique=set" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i" fi - fi - ;; - -l*) - ac_ii=`echo $ac_i|cut -c 3-` - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -l$ac_ii" - else - - case $ac_ii in + case gd in c|c_r|pthread*) ;; *) - LIBS="$LIBS -l$ac_ii" - ;; - esac - - - fi + LIBS="-lgd $LIBS" ;; esac - ;; - -L*) - ac_ii=`echo $ac_i|cut -c 3-` - - if test "$ac_ii" != "/usr/$PHP_LIBDIR" && test "$ac_ii" != "/usr/lib"; then - - if test -z "$ac_ii" || echo "$ac_ii" | grep '^/' >/dev/null ; then - ai_p=$ac_ii - else - - ep_dir="`echo $ac_ii|$SED 's%/*[^/][^/]*/*$%%'`" - - ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$ac_ii\"`" - fi - - - if test "$ext_shared" = "yes"; then - LDFLAGS="-L$ai_p $LDFLAGS" - test -n "$ld_runpath_switch" && LDFLAGS="$ld_runpath_switch$ai_p $LDFLAGS" - else - - - - unique=`echo $ai_p|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$LIBPATH$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "LIBPATH$unique=set" - test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p" - LDFLAGS="$LDFLAGS -L$ai_p" - PHP_RPATHS="$PHP_RPATHS $ai_p" fi - fi - fi +$as_echo "#define HAVE_LIBGD 1" >>confdefs.h - ;; - esac - done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdImageGif in -lgd" >&5 -$as_echo_n "checking for gdImageGif in -lgd... " >&6; } -if ${ac_cv_lib_gd_gdImageGif+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgd $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gdImageGif (); -int -main () -{ -return gdImageGif (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gd_gdImageGif=yes else - ac_cv_lib_gd_gdImageGif=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdImageGif" >&5 -$as_echo "$ac_cv_lib_gd_gdImageGif" >&6; } -if test "x$ac_cv_lib_gd_gdImageGif" = xyes; then : LDFLAGS=$save_old_LDFLAGS ext_shared=$save_ext_shared + unset ac_cv_lib_gd_gdSetErrorMethod -$as_echo "#define HAVE_GD_GIF_CREATE 1" >>confdefs.h - - -else - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - unset ac_cv_lib_gd_gdImageGif + as_fn_error $? "Unable to find libgd.(a|so) >= 2.1.0 anywhere under $PHP_GD" "$LINENO" 5 fi + save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " + ac_stuff=" $GD_SHARED_LIBADD " save_ext_shared=$ext_shared ext_shared=yes @@ -42674,9 +42015,9 @@ fi esac done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdImageWBMP in -lgd" >&5 -$as_echo_n "checking for gdImageWBMP in -lgd... " >&6; } -if ${ac_cv_lib_gd_gdImageWBMP+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdImageCreateFromPng in -lgd" >&5 +$as_echo_n "checking for gdImageCreateFromPng in -lgd... " >&6; } +if ${ac_cv_lib_gd_gdImageCreateFromPng+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -42690,46 +42031,46 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char gdImageWBMP (); +char gdImageCreateFromPng (); int main () { -return gdImageWBMP (); +return gdImageCreateFromPng (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gd_gdImageWBMP=yes + ac_cv_lib_gd_gdImageCreateFromPng=yes else - ac_cv_lib_gd_gdImageWBMP=no + ac_cv_lib_gd_gdImageCreateFromPng=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdImageWBMP" >&5 -$as_echo "$ac_cv_lib_gd_gdImageWBMP" >&6; } -if test "x$ac_cv_lib_gd_gdImageWBMP" = xyes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdImageCreateFromPng" >&5 +$as_echo "$ac_cv_lib_gd_gdImageCreateFromPng" >&6; } +if test "x$ac_cv_lib_gd_gdImageCreateFromPng" = xyes; then : LDFLAGS=$save_old_LDFLAGS ext_shared=$save_ext_shared -$as_echo "#define HAVE_GD_WBMP 1" >>confdefs.h +$as_echo "#define HAVE_GD_PNG 1" >>confdefs.h else LDFLAGS=$save_old_LDFLAGS ext_shared=$save_ext_shared - unset ac_cv_lib_gd_gdImageWBMP + unset ac_cv_lib_gd_gdImageCreateFromPng fi save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " + ac_stuff=" $GD_SHARED_LIBADD " save_ext_shared=$ext_shared ext_shared=yes @@ -42877,7 +42218,7 @@ fi save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " + ac_stuff=" $GD_SHARED_LIBADD " save_ext_shared=$ext_shared ext_shared=yes @@ -43025,7 +42366,7 @@ fi save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " + ac_stuff=" $GD_SHARED_LIBADD " save_ext_shared=$ext_shared ext_shared=yes @@ -43173,895 +42514,7 @@ fi save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " - - save_ext_shared=$ext_shared - ext_shared=yes - - for ac_i in $ac_stuff; do - case $ac_i in - -pthread) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -pthread" - else - - - unique=`echo $ac_i|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$EXTRA_LDFLAGS$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "EXTRA_LDFLAGS$unique=set" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i" - fi - - fi - ;; - -l*) - ac_ii=`echo $ac_i|cut -c 3-` - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -l$ac_ii" - else - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - LIBS="$LIBS -l$ac_ii" - ;; - esac - - - fi - ;; - esac - - - ;; - -L*) - ac_ii=`echo $ac_i|cut -c 3-` - - if test "$ac_ii" != "/usr/$PHP_LIBDIR" && test "$ac_ii" != "/usr/lib"; then - - if test -z "$ac_ii" || echo "$ac_ii" | grep '^/' >/dev/null ; then - ai_p=$ac_ii - else - - ep_dir="`echo $ac_ii|$SED 's%/*[^/][^/]*/*$%%'`" - - ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$ac_ii\"`" - fi - - - if test "$ext_shared" = "yes"; then - LDFLAGS="-L$ai_p $LDFLAGS" - test -n "$ld_runpath_switch" && LDFLAGS="$ld_runpath_switch$ai_p $LDFLAGS" - else - - - - unique=`echo $ai_p|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$LIBPATH$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "LIBPATH$unique=set" - - test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p" - LDFLAGS="$LDFLAGS -L$ai_p" - PHP_RPATHS="$PHP_RPATHS $ai_p" - - fi - - - fi - - fi - - ;; - esac - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdImageCreateFromGd2 in -lgd" >&5 -$as_echo_n "checking for gdImageCreateFromGd2 in -lgd... " >&6; } -if ${ac_cv_lib_gd_gdImageCreateFromGd2+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgd $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gdImageCreateFromGd2 (); -int -main () -{ -return gdImageCreateFromGd2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gd_gdImageCreateFromGd2=yes -else - ac_cv_lib_gd_gdImageCreateFromGd2=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdImageCreateFromGd2" >&5 -$as_echo "$ac_cv_lib_gd_gdImageCreateFromGd2" >&6; } -if test "x$ac_cv_lib_gd_gdImageCreateFromGd2" = xyes; then : - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - -$as_echo "#define HAVE_GD_GD2 1" >>confdefs.h - - -else - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - unset ac_cv_lib_gd_gdImageCreateFromGd2 - - -fi - - - save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " - - save_ext_shared=$ext_shared - ext_shared=yes - - for ac_i in $ac_stuff; do - case $ac_i in - -pthread) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -pthread" - else - - - unique=`echo $ac_i|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$EXTRA_LDFLAGS$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "EXTRA_LDFLAGS$unique=set" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i" - fi - - fi - ;; - -l*) - ac_ii=`echo $ac_i|cut -c 3-` - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -l$ac_ii" - else - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - LIBS="$LIBS -l$ac_ii" - ;; - esac - - - fi - ;; - esac - - - ;; - -L*) - ac_ii=`echo $ac_i|cut -c 3-` - - if test "$ac_ii" != "/usr/$PHP_LIBDIR" && test "$ac_ii" != "/usr/lib"; then - - if test -z "$ac_ii" || echo "$ac_ii" | grep '^/' >/dev/null ; then - ai_p=$ac_ii - else - - ep_dir="`echo $ac_ii|$SED 's%/*[^/][^/]*/*$%%'`" - - ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$ac_ii\"`" - fi - - - if test "$ext_shared" = "yes"; then - LDFLAGS="-L$ai_p $LDFLAGS" - test -n "$ld_runpath_switch" && LDFLAGS="$ld_runpath_switch$ai_p $LDFLAGS" - else - - - - unique=`echo $ai_p|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$LIBPATH$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "LIBPATH$unique=set" - - test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p" - LDFLAGS="$LDFLAGS -L$ai_p" - PHP_RPATHS="$PHP_RPATHS $ai_p" - - fi - - - fi - - fi - - ;; - esac - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdImageCreateTrueColor in -lgd" >&5 -$as_echo_n "checking for gdImageCreateTrueColor in -lgd... " >&6; } -if ${ac_cv_lib_gd_gdImageCreateTrueColor+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgd $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gdImageCreateTrueColor (); -int -main () -{ -return gdImageCreateTrueColor (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gd_gdImageCreateTrueColor=yes -else - ac_cv_lib_gd_gdImageCreateTrueColor=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdImageCreateTrueColor" >&5 -$as_echo "$ac_cv_lib_gd_gdImageCreateTrueColor" >&6; } -if test "x$ac_cv_lib_gd_gdImageCreateTrueColor" = xyes; then : - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - -$as_echo "#define HAVE_LIBGD20 1" >>confdefs.h - - -else - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - unset ac_cv_lib_gd_gdImageCreateTrueColor - - -fi - - - save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " - - save_ext_shared=$ext_shared - ext_shared=yes - - for ac_i in $ac_stuff; do - case $ac_i in - -pthread) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -pthread" - else - - - unique=`echo $ac_i|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$EXTRA_LDFLAGS$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "EXTRA_LDFLAGS$unique=set" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i" - fi - - fi - ;; - -l*) - ac_ii=`echo $ac_i|cut -c 3-` - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -l$ac_ii" - else - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - LIBS="$LIBS -l$ac_ii" - ;; - esac - - - fi - ;; - esac - - - ;; - -L*) - ac_ii=`echo $ac_i|cut -c 3-` - - if test "$ac_ii" != "/usr/$PHP_LIBDIR" && test "$ac_ii" != "/usr/lib"; then - - if test -z "$ac_ii" || echo "$ac_ii" | grep '^/' >/dev/null ; then - ai_p=$ac_ii - else - - ep_dir="`echo $ac_ii|$SED 's%/*[^/][^/]*/*$%%'`" - - ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$ac_ii\"`" - fi - - - if test "$ext_shared" = "yes"; then - LDFLAGS="-L$ai_p $LDFLAGS" - test -n "$ld_runpath_switch" && LDFLAGS="$ld_runpath_switch$ai_p $LDFLAGS" - else - - - - unique=`echo $ai_p|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$LIBPATH$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "LIBPATH$unique=set" - - test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p" - LDFLAGS="$LDFLAGS -L$ai_p" - PHP_RPATHS="$PHP_RPATHS $ai_p" - - fi - - - fi - - fi - - ;; - esac - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdImageSetTile in -lgd" >&5 -$as_echo_n "checking for gdImageSetTile in -lgd... " >&6; } -if ${ac_cv_lib_gd_gdImageSetTile+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgd $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gdImageSetTile (); -int -main () -{ -return gdImageSetTile (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gd_gdImageSetTile=yes -else - ac_cv_lib_gd_gdImageSetTile=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdImageSetTile" >&5 -$as_echo "$ac_cv_lib_gd_gdImageSetTile" >&6; } -if test "x$ac_cv_lib_gd_gdImageSetTile" = xyes; then : - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - -$as_echo "#define HAVE_GD_IMAGESETTILE 1" >>confdefs.h - - -else - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - unset ac_cv_lib_gd_gdImageSetTile - - -fi - - - save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " - - save_ext_shared=$ext_shared - ext_shared=yes - - for ac_i in $ac_stuff; do - case $ac_i in - -pthread) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -pthread" - else - - - unique=`echo $ac_i|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$EXTRA_LDFLAGS$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "EXTRA_LDFLAGS$unique=set" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i" - fi - - fi - ;; - -l*) - ac_ii=`echo $ac_i|cut -c 3-` - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -l$ac_ii" - else - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - LIBS="$LIBS -l$ac_ii" - ;; - esac - - - fi - ;; - esac - - - ;; - -L*) - ac_ii=`echo $ac_i|cut -c 3-` - - if test "$ac_ii" != "/usr/$PHP_LIBDIR" && test "$ac_ii" != "/usr/lib"; then - - if test -z "$ac_ii" || echo "$ac_ii" | grep '^/' >/dev/null ; then - ai_p=$ac_ii - else - - ep_dir="`echo $ac_ii|$SED 's%/*[^/][^/]*/*$%%'`" - - ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$ac_ii\"`" - fi - - - if test "$ext_shared" = "yes"; then - LDFLAGS="-L$ai_p $LDFLAGS" - test -n "$ld_runpath_switch" && LDFLAGS="$ld_runpath_switch$ai_p $LDFLAGS" - else - - - - unique=`echo $ai_p|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$LIBPATH$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "LIBPATH$unique=set" - - test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p" - LDFLAGS="$LDFLAGS -L$ai_p" - PHP_RPATHS="$PHP_RPATHS $ai_p" - - fi - - - fi - - fi - - ;; - esac - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdImageEllipse in -lgd" >&5 -$as_echo_n "checking for gdImageEllipse in -lgd... " >&6; } -if ${ac_cv_lib_gd_gdImageEllipse+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgd $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gdImageEllipse (); -int -main () -{ -return gdImageEllipse (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gd_gdImageEllipse=yes -else - ac_cv_lib_gd_gdImageEllipse=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdImageEllipse" >&5 -$as_echo "$ac_cv_lib_gd_gdImageEllipse" >&6; } -if test "x$ac_cv_lib_gd_gdImageEllipse" = xyes; then : - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - -$as_echo "#define HAVE_GD_IMAGEELLIPSE 1" >>confdefs.h - - -else - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - unset ac_cv_lib_gd_gdImageEllipse - - -fi - - - save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " - - save_ext_shared=$ext_shared - ext_shared=yes - - for ac_i in $ac_stuff; do - case $ac_i in - -pthread) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -pthread" - else - - - unique=`echo $ac_i|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$EXTRA_LDFLAGS$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "EXTRA_LDFLAGS$unique=set" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i" - fi - - fi - ;; - -l*) - ac_ii=`echo $ac_i|cut -c 3-` - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -l$ac_ii" - else - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - LIBS="$LIBS -l$ac_ii" - ;; - esac - - - fi - ;; - esac - - - ;; - -L*) - ac_ii=`echo $ac_i|cut -c 3-` - - if test "$ac_ii" != "/usr/$PHP_LIBDIR" && test "$ac_ii" != "/usr/lib"; then - - if test -z "$ac_ii" || echo "$ac_ii" | grep '^/' >/dev/null ; then - ai_p=$ac_ii - else - - ep_dir="`echo $ac_ii|$SED 's%/*[^/][^/]*/*$%%'`" - - ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$ac_ii\"`" - fi - - - if test "$ext_shared" = "yes"; then - LDFLAGS="-L$ai_p $LDFLAGS" - test -n "$ld_runpath_switch" && LDFLAGS="$ld_runpath_switch$ai_p $LDFLAGS" - else - - - - unique=`echo $ai_p|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$LIBPATH$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "LIBPATH$unique=set" - - test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p" - LDFLAGS="$LDFLAGS -L$ai_p" - PHP_RPATHS="$PHP_RPATHS $ai_p" - - fi - - - fi - - fi - - ;; - esac - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdImageSetBrush in -lgd" >&5 -$as_echo_n "checking for gdImageSetBrush in -lgd... " >&6; } -if ${ac_cv_lib_gd_gdImageSetBrush+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgd $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gdImageSetBrush (); -int -main () -{ -return gdImageSetBrush (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gd_gdImageSetBrush=yes -else - ac_cv_lib_gd_gdImageSetBrush=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdImageSetBrush" >&5 -$as_echo "$ac_cv_lib_gd_gdImageSetBrush" >&6; } -if test "x$ac_cv_lib_gd_gdImageSetBrush" = xyes; then : - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - -$as_echo "#define HAVE_GD_IMAGESETBRUSH 1" >>confdefs.h - - -else - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - unset ac_cv_lib_gd_gdImageSetBrush - - -fi - - - save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " - - save_ext_shared=$ext_shared - ext_shared=yes - - for ac_i in $ac_stuff; do - case $ac_i in - -pthread) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -pthread" - else - - - unique=`echo $ac_i|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$EXTRA_LDFLAGS$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "EXTRA_LDFLAGS$unique=set" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i" - fi - - fi - ;; - -l*) - ac_ii=`echo $ac_i|cut -c 3-` - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -l$ac_ii" - else - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - LIBS="$LIBS -l$ac_ii" - ;; - esac - - - fi - ;; - esac - - - ;; - -L*) - ac_ii=`echo $ac_i|cut -c 3-` - - if test "$ac_ii" != "/usr/$PHP_LIBDIR" && test "$ac_ii" != "/usr/lib"; then - - if test -z "$ac_ii" || echo "$ac_ii" | grep '^/' >/dev/null ; then - ai_p=$ac_ii - else - - ep_dir="`echo $ac_ii|$SED 's%/*[^/][^/]*/*$%%'`" - - ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$ac_ii\"`" - fi - - - if test "$ext_shared" = "yes"; then - LDFLAGS="-L$ai_p $LDFLAGS" - test -n "$ld_runpath_switch" && LDFLAGS="$ld_runpath_switch$ai_p $LDFLAGS" - else - - - - unique=`echo $ai_p|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$LIBPATH$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "LIBPATH$unique=set" - - test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p" - LDFLAGS="$LDFLAGS -L$ai_p" - PHP_RPATHS="$PHP_RPATHS $ai_p" - - fi - - - fi - - fi - - ;; - esac - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdImageStringTTF in -lgd" >&5 -$as_echo_n "checking for gdImageStringTTF in -lgd... " >&6; } -if ${ac_cv_lib_gd_gdImageStringTTF+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgd $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gdImageStringTTF (); -int -main () -{ -return gdImageStringTTF (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gd_gdImageStringTTF=yes -else - ac_cv_lib_gd_gdImageStringTTF=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdImageStringTTF" >&5 -$as_echo "$ac_cv_lib_gd_gdImageStringTTF" >&6; } -if test "x$ac_cv_lib_gd_gdImageStringTTF" = xyes; then : - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - -$as_echo "#define HAVE_GD_STRINGTTF 1" >>confdefs.h - - -else - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - unset ac_cv_lib_gd_gdImageStringTTF - - -fi - - - save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " + ac_stuff=" $GD_SHARED_LIBADD " save_ext_shared=$ext_shared ext_shared=yes @@ -44195,7 +42648,7 @@ if test "x$ac_cv_lib_gd_gdImageStringFT" = xyes; then : LDFLAGS=$save_old_LDFLAGS ext_shared=$save_ext_shared -$as_echo "#define HAVE_GD_STRINGFT 1" >>confdefs.h +$as_echo "#define HAVE_GD_FREETYPE 1" >>confdefs.h else @@ -44208,1639 +42661,6 @@ else fi - save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " - - save_ext_shared=$ext_shared - ext_shared=yes - - for ac_i in $ac_stuff; do - case $ac_i in - -pthread) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -pthread" - else - - - unique=`echo $ac_i|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$EXTRA_LDFLAGS$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "EXTRA_LDFLAGS$unique=set" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i" - fi - - fi - ;; - -l*) - ac_ii=`echo $ac_i|cut -c 3-` - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -l$ac_ii" - else - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - LIBS="$LIBS -l$ac_ii" - ;; - esac - - - fi - ;; - esac - - - ;; - -L*) - ac_ii=`echo $ac_i|cut -c 3-` - - if test "$ac_ii" != "/usr/$PHP_LIBDIR" && test "$ac_ii" != "/usr/lib"; then - - if test -z "$ac_ii" || echo "$ac_ii" | grep '^/' >/dev/null ; then - ai_p=$ac_ii - else - - ep_dir="`echo $ac_ii|$SED 's%/*[^/][^/]*/*$%%'`" - - ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$ac_ii\"`" - fi - - - if test "$ext_shared" = "yes"; then - LDFLAGS="-L$ai_p $LDFLAGS" - test -n "$ld_runpath_switch" && LDFLAGS="$ld_runpath_switch$ai_p $LDFLAGS" - else - - - - unique=`echo $ai_p|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$LIBPATH$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "LIBPATH$unique=set" - - test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p" - LDFLAGS="$LDFLAGS -L$ai_p" - PHP_RPATHS="$PHP_RPATHS $ai_p" - - fi - - - fi - - fi - - ;; - esac - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdImageStringFTEx in -lgd" >&5 -$as_echo_n "checking for gdImageStringFTEx in -lgd... " >&6; } -if ${ac_cv_lib_gd_gdImageStringFTEx+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgd $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gdImageStringFTEx (); -int -main () -{ -return gdImageStringFTEx (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gd_gdImageStringFTEx=yes -else - ac_cv_lib_gd_gdImageStringFTEx=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdImageStringFTEx" >&5 -$as_echo "$ac_cv_lib_gd_gdImageStringFTEx" >&6; } -if test "x$ac_cv_lib_gd_gdImageStringFTEx" = xyes; then : - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - -$as_echo "#define HAVE_GD_STRINGFTEX 1" >>confdefs.h - - -else - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - unset ac_cv_lib_gd_gdImageStringFTEx - - -fi - - - save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " - - save_ext_shared=$ext_shared - ext_shared=yes - - for ac_i in $ac_stuff; do - case $ac_i in - -pthread) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -pthread" - else - - - unique=`echo $ac_i|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$EXTRA_LDFLAGS$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "EXTRA_LDFLAGS$unique=set" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i" - fi - - fi - ;; - -l*) - ac_ii=`echo $ac_i|cut -c 3-` - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -l$ac_ii" - else - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - LIBS="$LIBS -l$ac_ii" - ;; - esac - - - fi - ;; - esac - - - ;; - -L*) - ac_ii=`echo $ac_i|cut -c 3-` - - if test "$ac_ii" != "/usr/$PHP_LIBDIR" && test "$ac_ii" != "/usr/lib"; then - - if test -z "$ac_ii" || echo "$ac_ii" | grep '^/' >/dev/null ; then - ai_p=$ac_ii - else - - ep_dir="`echo $ac_ii|$SED 's%/*[^/][^/]*/*$%%'`" - - ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$ac_ii\"`" - fi - - - if test "$ext_shared" = "yes"; then - LDFLAGS="-L$ai_p $LDFLAGS" - test -n "$ld_runpath_switch" && LDFLAGS="$ld_runpath_switch$ai_p $LDFLAGS" - else - - - - unique=`echo $ai_p|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$LIBPATH$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "LIBPATH$unique=set" - - test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p" - LDFLAGS="$LDFLAGS -L$ai_p" - PHP_RPATHS="$PHP_RPATHS $ai_p" - - fi - - - fi - - fi - - ;; - esac - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdImageColorClosestHWB in -lgd" >&5 -$as_echo_n "checking for gdImageColorClosestHWB in -lgd... " >&6; } -if ${ac_cv_lib_gd_gdImageColorClosestHWB+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgd $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gdImageColorClosestHWB (); -int -main () -{ -return gdImageColorClosestHWB (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gd_gdImageColorClosestHWB=yes -else - ac_cv_lib_gd_gdImageColorClosestHWB=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdImageColorClosestHWB" >&5 -$as_echo "$ac_cv_lib_gd_gdImageColorClosestHWB" >&6; } -if test "x$ac_cv_lib_gd_gdImageColorClosestHWB" = xyes; then : - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - -$as_echo "#define HAVE_COLORCLOSESTHWB 1" >>confdefs.h - - -else - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - unset ac_cv_lib_gd_gdImageColorClosestHWB - - -fi - - - save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " - - save_ext_shared=$ext_shared - ext_shared=yes - - for ac_i in $ac_stuff; do - case $ac_i in - -pthread) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -pthread" - else - - - unique=`echo $ac_i|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$EXTRA_LDFLAGS$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "EXTRA_LDFLAGS$unique=set" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i" - fi - - fi - ;; - -l*) - ac_ii=`echo $ac_i|cut -c 3-` - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -l$ac_ii" - else - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - LIBS="$LIBS -l$ac_ii" - ;; - esac - - - fi - ;; - esac - - - ;; - -L*) - ac_ii=`echo $ac_i|cut -c 3-` - - if test "$ac_ii" != "/usr/$PHP_LIBDIR" && test "$ac_ii" != "/usr/lib"; then - - if test -z "$ac_ii" || echo "$ac_ii" | grep '^/' >/dev/null ; then - ai_p=$ac_ii - else - - ep_dir="`echo $ac_ii|$SED 's%/*[^/][^/]*/*$%%'`" - - ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$ac_ii\"`" - fi - - - if test "$ext_shared" = "yes"; then - LDFLAGS="-L$ai_p $LDFLAGS" - test -n "$ld_runpath_switch" && LDFLAGS="$ld_runpath_switch$ai_p $LDFLAGS" - else - - - - unique=`echo $ai_p|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$LIBPATH$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "LIBPATH$unique=set" - - test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p" - LDFLAGS="$LDFLAGS -L$ai_p" - PHP_RPATHS="$PHP_RPATHS $ai_p" - - fi - - - fi - - fi - - ;; - esac - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdImageColorResolve in -lgd" >&5 -$as_echo_n "checking for gdImageColorResolve in -lgd... " >&6; } -if ${ac_cv_lib_gd_gdImageColorResolve+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgd $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gdImageColorResolve (); -int -main () -{ -return gdImageColorResolve (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gd_gdImageColorResolve=yes -else - ac_cv_lib_gd_gdImageColorResolve=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdImageColorResolve" >&5 -$as_echo "$ac_cv_lib_gd_gdImageColorResolve" >&6; } -if test "x$ac_cv_lib_gd_gdImageColorResolve" = xyes; then : - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - -$as_echo "#define HAVE_GDIMAGECOLORRESOLVE 1" >>confdefs.h - - -else - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - unset ac_cv_lib_gd_gdImageColorResolve - - -fi - - - save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " - - save_ext_shared=$ext_shared - ext_shared=yes - - for ac_i in $ac_stuff; do - case $ac_i in - -pthread) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -pthread" - else - - - unique=`echo $ac_i|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$EXTRA_LDFLAGS$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "EXTRA_LDFLAGS$unique=set" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i" - fi - - fi - ;; - -l*) - ac_ii=`echo $ac_i|cut -c 3-` - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -l$ac_ii" - else - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - LIBS="$LIBS -l$ac_ii" - ;; - esac - - - fi - ;; - esac - - - ;; - -L*) - ac_ii=`echo $ac_i|cut -c 3-` - - if test "$ac_ii" != "/usr/$PHP_LIBDIR" && test "$ac_ii" != "/usr/lib"; then - - if test -z "$ac_ii" || echo "$ac_ii" | grep '^/' >/dev/null ; then - ai_p=$ac_ii - else - - ep_dir="`echo $ac_ii|$SED 's%/*[^/][^/]*/*$%%'`" - - ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$ac_ii\"`" - fi - - - if test "$ext_shared" = "yes"; then - LDFLAGS="-L$ai_p $LDFLAGS" - test -n "$ld_runpath_switch" && LDFLAGS="$ld_runpath_switch$ai_p $LDFLAGS" - else - - - - unique=`echo $ai_p|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$LIBPATH$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "LIBPATH$unique=set" - - test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p" - LDFLAGS="$LDFLAGS -L$ai_p" - PHP_RPATHS="$PHP_RPATHS $ai_p" - - fi - - - fi - - fi - - ;; - esac - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdImageGifCtx in -lgd" >&5 -$as_echo_n "checking for gdImageGifCtx in -lgd... " >&6; } -if ${ac_cv_lib_gd_gdImageGifCtx+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgd $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gdImageGifCtx (); -int -main () -{ -return gdImageGifCtx (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gd_gdImageGifCtx=yes -else - ac_cv_lib_gd_gdImageGifCtx=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdImageGifCtx" >&5 -$as_echo "$ac_cv_lib_gd_gdImageGifCtx" >&6; } -if test "x$ac_cv_lib_gd_gdImageGifCtx" = xyes; then : - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - -$as_echo "#define HAVE_GD_GIF_CTX 1" >>confdefs.h - - -else - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - unset ac_cv_lib_gd_gdImageGifCtx - - -fi - - - save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " - - save_ext_shared=$ext_shared - ext_shared=yes - - for ac_i in $ac_stuff; do - case $ac_i in - -pthread) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -pthread" - else - - - unique=`echo $ac_i|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$EXTRA_LDFLAGS$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "EXTRA_LDFLAGS$unique=set" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i" - fi - - fi - ;; - -l*) - ac_ii=`echo $ac_i|cut -c 3-` - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -l$ac_ii" - else - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - LIBS="$LIBS -l$ac_ii" - ;; - esac - - - fi - ;; - esac - - - ;; - -L*) - ac_ii=`echo $ac_i|cut -c 3-` - - if test "$ac_ii" != "/usr/$PHP_LIBDIR" && test "$ac_ii" != "/usr/lib"; then - - if test -z "$ac_ii" || echo "$ac_ii" | grep '^/' >/dev/null ; then - ai_p=$ac_ii - else - - ep_dir="`echo $ac_ii|$SED 's%/*[^/][^/]*/*$%%'`" - - ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$ac_ii\"`" - fi - - - if test "$ext_shared" = "yes"; then - LDFLAGS="-L$ai_p $LDFLAGS" - test -n "$ld_runpath_switch" && LDFLAGS="$ld_runpath_switch$ai_p $LDFLAGS" - else - - - - unique=`echo $ai_p|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$LIBPATH$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "LIBPATH$unique=set" - - test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p" - LDFLAGS="$LDFLAGS -L$ai_p" - PHP_RPATHS="$PHP_RPATHS $ai_p" - - fi - - - fi - - fi - - ;; - esac - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdCacheCreate in -lgd" >&5 -$as_echo_n "checking for gdCacheCreate in -lgd... " >&6; } -if ${ac_cv_lib_gd_gdCacheCreate+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgd $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gdCacheCreate (); -int -main () -{ -return gdCacheCreate (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gd_gdCacheCreate=yes -else - ac_cv_lib_gd_gdCacheCreate=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdCacheCreate" >&5 -$as_echo "$ac_cv_lib_gd_gdCacheCreate" >&6; } -if test "x$ac_cv_lib_gd_gdCacheCreate" = xyes; then : - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - -$as_echo "#define HAVE_GD_CACHE_CREATE 1" >>confdefs.h - - -else - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - unset ac_cv_lib_gd_gdCacheCreate - - -fi - - - save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " - - save_ext_shared=$ext_shared - ext_shared=yes - - for ac_i in $ac_stuff; do - case $ac_i in - -pthread) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -pthread" - else - - - unique=`echo $ac_i|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$EXTRA_LDFLAGS$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "EXTRA_LDFLAGS$unique=set" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i" - fi - - fi - ;; - -l*) - ac_ii=`echo $ac_i|cut -c 3-` - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -l$ac_ii" - else - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - LIBS="$LIBS -l$ac_ii" - ;; - esac - - - fi - ;; - esac - - - ;; - -L*) - ac_ii=`echo $ac_i|cut -c 3-` - - if test "$ac_ii" != "/usr/$PHP_LIBDIR" && test "$ac_ii" != "/usr/lib"; then - - if test -z "$ac_ii" || echo "$ac_ii" | grep '^/' >/dev/null ; then - ai_p=$ac_ii - else - - ep_dir="`echo $ac_ii|$SED 's%/*[^/][^/]*/*$%%'`" - - ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$ac_ii\"`" - fi - - - if test "$ext_shared" = "yes"; then - LDFLAGS="-L$ai_p $LDFLAGS" - test -n "$ld_runpath_switch" && LDFLAGS="$ld_runpath_switch$ai_p $LDFLAGS" - else - - - - unique=`echo $ai_p|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$LIBPATH$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "LIBPATH$unique=set" - - test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p" - LDFLAGS="$LDFLAGS -L$ai_p" - PHP_RPATHS="$PHP_RPATHS $ai_p" - - fi - - - fi - - fi - - ;; - esac - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdFontCacheShutdown in -lgd" >&5 -$as_echo_n "checking for gdFontCacheShutdown in -lgd... " >&6; } -if ${ac_cv_lib_gd_gdFontCacheShutdown+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgd $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gdFontCacheShutdown (); -int -main () -{ -return gdFontCacheShutdown (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gd_gdFontCacheShutdown=yes -else - ac_cv_lib_gd_gdFontCacheShutdown=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdFontCacheShutdown" >&5 -$as_echo "$ac_cv_lib_gd_gdFontCacheShutdown" >&6; } -if test "x$ac_cv_lib_gd_gdFontCacheShutdown" = xyes; then : - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - -$as_echo "#define HAVE_GD_FONTCACHESHUTDOWN 1" >>confdefs.h - - -else - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - unset ac_cv_lib_gd_gdFontCacheShutdown - - -fi - - - save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " - - save_ext_shared=$ext_shared - ext_shared=yes - - for ac_i in $ac_stuff; do - case $ac_i in - -pthread) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -pthread" - else - - - unique=`echo $ac_i|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$EXTRA_LDFLAGS$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "EXTRA_LDFLAGS$unique=set" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i" - fi - - fi - ;; - -l*) - ac_ii=`echo $ac_i|cut -c 3-` - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -l$ac_ii" - else - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - LIBS="$LIBS -l$ac_ii" - ;; - esac - - - fi - ;; - esac - - - ;; - -L*) - ac_ii=`echo $ac_i|cut -c 3-` - - if test "$ac_ii" != "/usr/$PHP_LIBDIR" && test "$ac_ii" != "/usr/lib"; then - - if test -z "$ac_ii" || echo "$ac_ii" | grep '^/' >/dev/null ; then - ai_p=$ac_ii - else - - ep_dir="`echo $ac_ii|$SED 's%/*[^/][^/]*/*$%%'`" - - ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$ac_ii\"`" - fi - - - if test "$ext_shared" = "yes"; then - LDFLAGS="-L$ai_p $LDFLAGS" - test -n "$ld_runpath_switch" && LDFLAGS="$ld_runpath_switch$ai_p $LDFLAGS" - else - - - - unique=`echo $ai_p|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$LIBPATH$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "LIBPATH$unique=set" - - test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p" - LDFLAGS="$LDFLAGS -L$ai_p" - PHP_RPATHS="$PHP_RPATHS $ai_p" - - fi - - - fi - - fi - - ;; - esac - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdFreeFontCache in -lgd" >&5 -$as_echo_n "checking for gdFreeFontCache in -lgd... " >&6; } -if ${ac_cv_lib_gd_gdFreeFontCache+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgd $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gdFreeFontCache (); -int -main () -{ -return gdFreeFontCache (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gd_gdFreeFontCache=yes -else - ac_cv_lib_gd_gdFreeFontCache=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdFreeFontCache" >&5 -$as_echo "$ac_cv_lib_gd_gdFreeFontCache" >&6; } -if test "x$ac_cv_lib_gd_gdFreeFontCache" = xyes; then : - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - -$as_echo "#define HAVE_GD_FREEFONTCACHE 1" >>confdefs.h - - -else - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - unset ac_cv_lib_gd_gdFreeFontCache - - -fi - - - save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " - - save_ext_shared=$ext_shared - ext_shared=yes - - for ac_i in $ac_stuff; do - case $ac_i in - -pthread) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -pthread" - else - - - unique=`echo $ac_i|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$EXTRA_LDFLAGS$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "EXTRA_LDFLAGS$unique=set" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i" - fi - - fi - ;; - -l*) - ac_ii=`echo $ac_i|cut -c 3-` - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -l$ac_ii" - else - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - LIBS="$LIBS -l$ac_ii" - ;; - esac - - - fi - ;; - esac - - - ;; - -L*) - ac_ii=`echo $ac_i|cut -c 3-` - - if test "$ac_ii" != "/usr/$PHP_LIBDIR" && test "$ac_ii" != "/usr/lib"; then - - if test -z "$ac_ii" || echo "$ac_ii" | grep '^/' >/dev/null ; then - ai_p=$ac_ii - else - - ep_dir="`echo $ac_ii|$SED 's%/*[^/][^/]*/*$%%'`" - - ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$ac_ii\"`" - fi - - - if test "$ext_shared" = "yes"; then - LDFLAGS="-L$ai_p $LDFLAGS" - test -n "$ld_runpath_switch" && LDFLAGS="$ld_runpath_switch$ai_p $LDFLAGS" - else - - - - unique=`echo $ai_p|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$LIBPATH$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "LIBPATH$unique=set" - - test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p" - LDFLAGS="$LDFLAGS -L$ai_p" - PHP_RPATHS="$PHP_RPATHS $ai_p" - - fi - - - fi - - fi - - ;; - esac - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdFontCacheMutexSetup in -lgd" >&5 -$as_echo_n "checking for gdFontCacheMutexSetup in -lgd... " >&6; } -if ${ac_cv_lib_gd_gdFontCacheMutexSetup+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgd $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gdFontCacheMutexSetup (); -int -main () -{ -return gdFontCacheMutexSetup (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gd_gdFontCacheMutexSetup=yes -else - ac_cv_lib_gd_gdFontCacheMutexSetup=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdFontCacheMutexSetup" >&5 -$as_echo "$ac_cv_lib_gd_gdFontCacheMutexSetup" >&6; } -if test "x$ac_cv_lib_gd_gdFontCacheMutexSetup" = xyes; then : - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - -$as_echo "#define HAVE_GD_FONTMUTEX 1" >>confdefs.h - - -else - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - unset ac_cv_lib_gd_gdFontCacheMutexSetup - - -fi - - - save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " - - save_ext_shared=$ext_shared - ext_shared=yes - - for ac_i in $ac_stuff; do - case $ac_i in - -pthread) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -pthread" - else - - - unique=`echo $ac_i|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$EXTRA_LDFLAGS$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "EXTRA_LDFLAGS$unique=set" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i" - fi - - fi - ;; - -l*) - ac_ii=`echo $ac_i|cut -c 3-` - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -l$ac_ii" - else - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - LIBS="$LIBS -l$ac_ii" - ;; - esac - - - fi - ;; - esac - - - ;; - -L*) - ac_ii=`echo $ac_i|cut -c 3-` - - if test "$ac_ii" != "/usr/$PHP_LIBDIR" && test "$ac_ii" != "/usr/lib"; then - - if test -z "$ac_ii" || echo "$ac_ii" | grep '^/' >/dev/null ; then - ai_p=$ac_ii - else - - ep_dir="`echo $ac_ii|$SED 's%/*[^/][^/]*/*$%%'`" - - ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$ac_ii\"`" - fi - - - if test "$ext_shared" = "yes"; then - LDFLAGS="-L$ai_p $LDFLAGS" - test -n "$ld_runpath_switch" && LDFLAGS="$ld_runpath_switch$ai_p $LDFLAGS" - else - - - - unique=`echo $ai_p|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$LIBPATH$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "LIBPATH$unique=set" - - test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p" - LDFLAGS="$LDFLAGS -L$ai_p" - PHP_RPATHS="$PHP_RPATHS $ai_p" - - fi - - - fi - - fi - - ;; - esac - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdNewDynamicCtxEx in -lgd" >&5 -$as_echo_n "checking for gdNewDynamicCtxEx in -lgd... " >&6; } -if ${ac_cv_lib_gd_gdNewDynamicCtxEx+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgd $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gdNewDynamicCtxEx (); -int -main () -{ -return gdNewDynamicCtxEx (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gd_gdNewDynamicCtxEx=yes -else - ac_cv_lib_gd_gdNewDynamicCtxEx=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdNewDynamicCtxEx" >&5 -$as_echo "$ac_cv_lib_gd_gdNewDynamicCtxEx" >&6; } -if test "x$ac_cv_lib_gd_gdNewDynamicCtxEx" = xyes; then : - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - -$as_echo "#define HAVE_GD_DYNAMIC_CTX_EX 1" >>confdefs.h - - -else - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - unset ac_cv_lib_gd_gdNewDynamicCtxEx - - -fi - - - save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " - - save_ext_shared=$ext_shared - ext_shared=yes - - for ac_i in $ac_stuff; do - case $ac_i in - -pthread) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -pthread" - else - - - unique=`echo $ac_i|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$EXTRA_LDFLAGS$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "EXTRA_LDFLAGS$unique=set" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i" - fi - - fi - ;; - -l*) - ac_ii=`echo $ac_i|cut -c 3-` - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -l$ac_ii" - else - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - LIBS="$LIBS -l$ac_ii" - ;; - esac - - - fi - ;; - esac - - - ;; - -L*) - ac_ii=`echo $ac_i|cut -c 3-` - - if test "$ac_ii" != "/usr/$PHP_LIBDIR" && test "$ac_ii" != "/usr/lib"; then - - if test -z "$ac_ii" || echo "$ac_ii" | grep '^/' >/dev/null ; then - ai_p=$ac_ii - else - - ep_dir="`echo $ac_ii|$SED 's%/*[^/][^/]*/*$%%'`" - - ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$ac_ii\"`" - fi - - - if test "$ext_shared" = "yes"; then - LDFLAGS="-L$ai_p $LDFLAGS" - test -n "$ld_runpath_switch" && LDFLAGS="$ld_runpath_switch$ai_p $LDFLAGS" - else - - - - unique=`echo $ai_p|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$LIBPATH$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "LIBPATH$unique=set" - - test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p" - LDFLAGS="$LDFLAGS -L$ai_p" - PHP_RPATHS="$PHP_RPATHS $ai_p" - - fi - - - fi - - fi - - ;; - esac - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdImageConvolution in -lgd" >&5 -$as_echo_n "checking for gdImageConvolution in -lgd... " >&6; } -if ${ac_cv_lib_gd_gdImageConvolution+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgd $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gdImageConvolution (); -int -main () -{ -return gdImageConvolution (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gd_gdImageConvolution=yes -else - ac_cv_lib_gd_gdImageConvolution=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdImageConvolution" >&5 -$as_echo "$ac_cv_lib_gd_gdImageConvolution" >&6; } -if test "x$ac_cv_lib_gd_gdImageConvolution" = xyes; then : - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - -$as_echo "#define HAVE_GD_IMAGE_CONVOLUTION 1" >>confdefs.h - - -else - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - unset ac_cv_lib_gd_gdImageConvolution - - -fi - - - save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " - - save_ext_shared=$ext_shared - ext_shared=yes - - for ac_i in $ac_stuff; do - case $ac_i in - -pthread) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -pthread" - else - - - unique=`echo $ac_i|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$EXTRA_LDFLAGS$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "EXTRA_LDFLAGS$unique=set" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i" - fi - - fi - ;; - -l*) - ac_ii=`echo $ac_i|cut -c 3-` - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - if test "$ext_shared" = "yes"; then - LDFLAGS="$LDFLAGS -l$ac_ii" - else - - - case $ac_ii in - c|c_r|pthread*) ;; - *) - LIBS="$LIBS -l$ac_ii" - ;; - esac - - - fi - ;; - esac - - - ;; - -L*) - ac_ii=`echo $ac_i|cut -c 3-` - - if test "$ac_ii" != "/usr/$PHP_LIBDIR" && test "$ac_ii" != "/usr/lib"; then - - if test -z "$ac_ii" || echo "$ac_ii" | grep '^/' >/dev/null ; then - ai_p=$ac_ii - else - - ep_dir="`echo $ac_ii|$SED 's%/*[^/][^/]*/*$%%'`" - - ep_realdir="`(cd \"$ep_dir\" && pwd)`" - ai_p="$ep_realdir/`basename \"$ac_ii\"`" - fi - - - if test "$ext_shared" = "yes"; then - LDFLAGS="-L$ai_p $LDFLAGS" - test -n "$ld_runpath_switch" && LDFLAGS="$ld_runpath_switch$ai_p $LDFLAGS" - else - - - - unique=`echo $ai_p|$SED 's/[^a-zA-Z0-9]/_/g'` - - cmd="echo $ac_n \"\$LIBPATH$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "LIBPATH$unique=set" - - test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p" - LDFLAGS="$LDFLAGS -L$ai_p" - PHP_RPATHS="$PHP_RPATHS $ai_p" - - fi - - - fi - - fi - - ;; - esac - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdImagePixelate in -lgd" >&5 -$as_echo_n "checking for gdImagePixelate in -lgd... " >&6; } -if ${ac_cv_lib_gd_gdImagePixelate+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgd $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gdImagePixelate (); -int -main () -{ -return gdImagePixelate (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gd_gdImagePixelate=yes -else - ac_cv_lib_gd_gdImagePixelate=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdImagePixelate" >&5 -$as_echo "$ac_cv_lib_gd_gdImagePixelate" >&6; } -if test "x$ac_cv_lib_gd_gdImagePixelate" = xyes; then : - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - -$as_echo "#define HAVE_GD_IMAGE_PIXELATE 1" >>confdefs.h - - -else - - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - unset ac_cv_lib_gd_gdImagePixelate - - -fi - - - elif test -z "$GD_INCLUDE"; then - as_fn_error $? "Unable to find gd.h anywhere under $PHP_GD" "$LINENO" 5 - else - as_fn_error $? "Unable to find libgd.(a|so) anywhere under $PHP_GD" "$LINENO" 5 - fi if test -z "$GD_INCLUDE" || echo "$GD_INCLUDE" | grep '^/' >/dev/null ; then @@ -45853,37 +42673,6 @@ fi GD_INCLUDE="$ep_realdir/`basename \"$GD_INCLUDE\"`" fi - - old_CPPFLAGS=$CPPFLAGS - CPPFLAGS=-I$GD_INCLUDE - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include <gd.h> -#include <stdlib.h> - -int -main () -{ - -gdIOCtx *ctx; -ctx = malloc(sizeof(gdIOCtx)); -ctx->gd_free = 1; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - -$as_echo "#define HAVE_LIBGD204 1" >>confdefs.h - - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CPPFLAGS=$old_CPPFLAGS - fi fi @@ -46182,13 +42971,12 @@ EOF fi + if test "$GD_MODULE_TYPE" = "builtin"; then BUILD_DIR="$BUILD_DIR $ext_builddir/libgd" - - if test "$GD_MODULE_TYPE" = "builtin"; then GDLIB_CFLAGS="-I$ext_srcdir/libgd $GDLIB_CFLAGS" GD_HEADER_DIRS="ext/gd/ ext/gd/libgd/" @@ -46265,7 +43053,7 @@ fi save_old_LDFLAGS=$LDFLAGS - ac_stuff=" -L$GD_LIB $GD_SHARED_LIBADD " + ac_stuff=" $GD_SHARED_LIBADD " save_ext_shared=$ext_shared ext_shared=yes @@ -86894,91 +83682,6 @@ else fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for buggy snmp_snprint_value" >&5 -$as_echo_n "checking for buggy snmp_snprint_value... " >&6; } -if ${ac_cv_buggy_snprint_value+:} false; then : - $as_echo_n "(cached) " >&6 -else - - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -I${SNMP_PREFIX}/include $SNMP_SHARED_LIBADD" - if test "$cross_compiling" = yes; then : - - ac_cv_buggy_snprint_value=no - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <net-snmp/net-snmp-config.h> -#include <net-snmp/net-snmp-includes.h> - -u_char uname[] = "Linux nex1.php.net 2.6.18-194.32.1.el5 #1 SMP Wed Jan 5 17:53:09 EST 2011 i686"; - -int main(int argc, char **argv) -{ - struct variable_list vars; - char buf1[2048]; - char buf2[sizeof(buf1)]; - - memset(&(buf1[0]), 0, sizeof(buf1)); - memset(&(buf2[0]), 0, sizeof(buf2)); - memset(&vars, 0, sizeof(vars)); - vars.type = 4; - vars.val.integer = (long *)&(uname[0]); - vars.val.string = &(uname[0]); - vars.val.bitstring = &(uname[0]); - vars.val.counter64 = (struct counter64 *)&(uname[0]); - vars.val.floatVal = (float *)&(uname[0]); - vars.val_len = sizeof(uname), - vars.name_loc[0] = 1; - vars.name_loc[1] = 3; - vars.name_loc[2] = 6; - vars.name_loc[3] = 1; - vars.name_loc[4] = 2; - vars.name_loc[5] = 1; - vars.name_loc[6] = 1; - vars.name_loc[7] = 1; - vars.name = (oid *)&(vars.name_loc); - vars.name_length = 9; - - init_snmp("snmpapp"); - - netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT, 0); - - snprint_value(buf1, (sizeof(uname) + 32), vars.name, vars.name_length, &vars); - snprint_value(buf2, sizeof(buf2), vars.name, vars.name_length, &vars); - exit((strncmp(buf1, buf2, sizeof(buf1)) != 0)); -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - - ac_cv_buggy_snprint_value=no - -else - - ac_cv_buggy_snprint_value=yes - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - CFLAGS="$save_CFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_buggy_snprint_value" >&5 -$as_echo "$ac_cv_buggy_snprint_value" >&6; } - if test "$ac_cv_buggy_snprint_value" = "yes"; then - -$as_echo "#define BUGGY_SNMPRINT_VALUE 1" >>confdefs.h - - fi - ext_builddir=ext/snmp ext_srcdir=$abs_srcdir/ext/snmp @@ -106124,7 +102827,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 106127 "configure" +#line 102830 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -108036,7 +104739,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 108039 "configure"' > conftest.$ac_ext + echo '#line 104742 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -109428,7 +106131,7 @@ else LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat > conftest.$ac_ext <<EOF -#line 109431 "configure" +#line 106134 "configure" #include "confdefs.h" int main() { ; return 0; } @@ -109586,11 +106289,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"configure:109589: $lt_compile\"" >&5) + (eval echo "\"configure:106292: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "configure:109593: \$? = $ac_status" >&5 + echo "configure:106296: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -109884,11 +106587,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"configure:109887: $lt_compile\"" >&5) + (eval echo "\"configure:106590: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "configure:109891: \$? = $ac_status" >&5 + echo "configure:106594: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -109988,11 +106691,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"configure:109991: $lt_compile\"" >&5) + (eval echo "\"configure:106694: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "configure:109995: \$? = $ac_status" >&5 + echo "configure:106698: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -110452,7 +107155,7 @@ _LT_EOF # Determine the default libpath from the value encoded in an empty executable. cat > conftest.$ac_ext <<EOF -#line 110455 "configure" +#line 107158 "configure" #include "confdefs.h" int main() { ; return 0; } @@ -110494,7 +107197,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # Determine the default libpath from the value encoded in an empty executable. cat > conftest.$ac_ext <<EOF -#line 110497 "configure" +#line 107200 "configure" #include "confdefs.h" int main() { ; return 0; } @@ -112019,7 +108722,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 112022 "configure" +#line 108725 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -112119,7 +108822,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 112122 "configure" +#line 108825 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -113184,7 +109887,7 @@ case $host_os in # Determine the default libpath from the value encoded in an empty executable. cat > conftest.$ac_ext <<EOF -#line 113187 "configure" +#line 109890 "configure" #include "confdefs.h" int main() { ; return 0; } @@ -113227,7 +109930,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # Determine the default libpath from the value encoded in an empty executable. cat > conftest.$ac_ext <<EOF -#line 113230 "configure" +#line 109933 "configure" #include "confdefs.h" int main() { ; return 0; } @@ -114479,11 +111182,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"configure:114482: $lt_compile\"" >&5) + (eval echo "\"configure:111185: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "configure:114486: \$? = $ac_status" >&5 + echo "configure:111189: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -114583,11 +111286,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"configure:114586: $lt_compile\"" >&5) + (eval echo "\"configure:111289: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "configure:114590: \$? = $ac_status" >&5 + echo "configure:111293: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized diff --git a/configure.in b/configure.in index 30140d5d9..59f595c8e 100644 --- a/configure.in +++ b/configure.in @@ -120,7 +120,7 @@ int zend_sprintf(char *buffer, const char *format, ...); PHP_MAJOR_VERSION=5 PHP_MINOR_VERSION=5 PHP_RELEASE_VERSION=0 -PHP_EXTRA_VERSION="beta4" +PHP_EXTRA_VERSION="RC1" PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION" PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION` diff --git a/ext/curl/config.w32 b/ext/curl/config.w32 index a481e2948..965721318 100644 --- a/ext/curl/config.w32 +++ b/ext/curl/config.w32 @@ -13,7 +13,7 @@ if (PHP_CURL != "no") { && (((PHP_ZLIB=="no") && (CHECK_LIB("zlib_a.lib;zlib.lib", "curl", PHP_CURL))) || (PHP_ZLIB_SHARED && CHECK_LIB("zlib.lib", "curl", PHP_CURL)) || (PHP_ZLIB == "yes" && (!PHP_ZLIB_SHARED))) ) { - EXTENSION("curl", "interface.c multi.c share.c streams.c curl_file.c", true); + EXTENSION("curl", "interface.c multi.c share.c curl_file.c", true); AC_DEFINE('HAVE_CURL', 1, 'Have cURL library'); AC_DEFINE('HAVE_CURL_SSL', 1, 'Have SSL suppurt in cURL'); AC_DEFINE('HAVE_CURL_EASY_STRERROR', 1, 'Have curl_easy_strerror in cURL'); diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c index d6a16cf48..d3f13f864 100644 --- a/ext/date/lib/parse_date.c +++ b/ext/date/lib/parse_date.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Sun Mar 31 10:47:54 2013 */ +/* Generated by re2c 0.13.5 on Fri Apr 26 11:10:28 2013 */ /* +----------------------------------------------------------------------+ | PHP Version 5 | @@ -24991,7 +24991,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim break; case '\\': /* escaped char */ - *fptr++; + ++fptr; if (*ptr == *fptr) { ++ptr; } else { diff --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re index 8aaa6c336..014f6a09e 100644 --- a/ext/date/lib/parse_date.re +++ b/ext/date/lib/parse_date.re @@ -2096,7 +2096,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim break; case '\\': /* escaped char */ - *fptr++; + ++fptr; if (*ptr == *fptr) { ++ptr; } else { diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 4ef314369..808dc5a37 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -614,13 +614,11 @@ static void date_object_free_storage_interval(void *object TSRMLS_DC); static void date_object_free_storage_period(void *object TSRMLS_DC); static zend_object_value date_object_new_date(zend_class_entry *class_type TSRMLS_DC); -static zend_object_value date_object_new_immutable(zend_class_entry *class_type TSRMLS_DC); static zend_object_value date_object_new_timezone(zend_class_entry *class_type TSRMLS_DC); static zend_object_value date_object_new_interval(zend_class_entry *class_type TSRMLS_DC); static zend_object_value date_object_new_period(zend_class_entry *class_type TSRMLS_DC); static zend_object_value date_object_clone_date(zval *this_ptr TSRMLS_DC); -static zend_object_value date_object_clone_immutable(zval *this_ptr TSRMLS_DC); static zend_object_value date_object_clone_timezone(zval *this_ptr TSRMLS_DC); static zend_object_value date_object_clone_interval(zval *this_ptr TSRMLS_DC); static zend_object_value date_object_clone_period(zval *this_ptr TSRMLS_DC); diff --git a/ext/fileinfo/libmagic.patch b/ext/fileinfo/libmagic.patch index a35ff6745..ced3b2bb5 100644 --- a/ext/fileinfo/libmagic.patch +++ b/ext/fileinfo/libmagic.patch @@ -1,6 +1,6 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c --- libmagic.orig/apprentice.c 2013-03-21 18:45:14.000000000 +0100 -+++ libmagic/apprentice.c 2013-04-08 16:14:17.828357711 +0200 ++++ libmagic/apprentice.c 2013-04-27 13:53:32.175250261 +0200 @@ -29,6 +29,8 @@ * apprentice - make one pass through /etc/magic, learning its secrets. */ @@ -352,7 +352,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c file_oomem(ms, slen); return -1; } -@@ -1102,14 +1121,14 @@ +@@ -1102,27 +1121,29 @@ if (me == NULL) return; for (i = 0; i < nme; i++) @@ -370,8 +370,9 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c struct magic_entry *mentry[MAGIC_SETS] = { NULL }; uint32_t mentrycount[MAGIC_SETS] = { 0 }; uint32_t i, j; -@@ -1117,12 +1136,14 @@ - char **filearr = NULL, *mfn; + size_t files = 0, maxfiles = 0; +- char **filearr = NULL, *mfn; ++ char **filearr = NULL; struct stat st; struct magic_map *map; - DIR *dir; @@ -411,7 +412,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c + int mflen; + char mfn[MAXPATHLEN]; + -+ dir = php_stream_opendir(fn, REPORT_ERRORS, NULL); ++ dir = php_stream_opendir((char *)fn, REPORT_ERRORS, NULL); if (!dir) { errs++; goto out; @@ -578,7 +579,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c +#ifdef PHP_WIN32 + /* Don't bother on windows with php_stream_open_wrapper, + return to give apprentice_load() a chance. */ -+ if (php_stream_stat_path_ex(fn, 0, &st, NULL) == SUCCESS) { ++ if (php_stream_stat_path_ex((char *)fn, 0, &st, NULL) == SUCCESS) { + if (st.sb.st_mode & S_IFDIR) { + goto error; + } @@ -751,7 +752,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c } - if (write(fd, map->nmagic, nm) != (ssize_t)nm) { -+ if (php_stream_write(stream, map->nmagic, nm) != (ssize_t)nm) { ++ if (php_stream_write(stream, (const char *)map->nmagic, nm) != (ssize_t)nm) { file_error(ms, errno, "error writing `%s'", dbname); goto out; } @@ -767,7 +768,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c for (i = 0; i < MAGIC_SETS; i++) { len = m * map->nmagic[i]; - if (write(fd, map->magic[i], len) != (ssize_t)len) { -+ if (php_stream_write(stream, map->magic[i], len) != (ssize_t)len) { ++ if (php_stream_write(stream, (const char *)map->magic[i], len) != (ssize_t)len) { file_error(ms, errno, "error writing `%s'", dbname); goto out; } @@ -2047,7 +2048,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c + diff -u libmagic.orig/magic.c libmagic/magic.c --- libmagic.orig/magic.c 2013-01-11 17:43:09.000000000 +0100 -+++ libmagic/magic.c 2013-04-08 15:42:57.328298809 +0200 ++++ libmagic/magic.c 2013-04-27 13:53:32.175250261 +0200 @@ -25,11 +25,6 @@ * SUCH DAMAGE. */ @@ -2089,7 +2090,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c #if defined(HAVE_UTIMES) # include <sys/time.h> #elif defined(HAVE_UTIME) -@@ -71,18 +75,24 @@ +@@ -71,18 +75,25 @@ #endif #endif @@ -2098,14 +2099,14 @@ diff -u libmagic.orig/magic.c libmagic/magic.c +# undef S_IFIFO +#endif + -+private void free_mlist(struct mlist *); private void close_and_restore(const struct magic_set *, const char *, int, const struct stat *); private int unreadable_info(struct magic_set *, mode_t, const char *); ++#if 0 private const char* get_default_magic(void); -#ifndef COMPILE_ONLY -private const char *file_or_fd(struct magic_set *, const char *, int); --#endif + #endif +private const char *file_or_stream(struct magic_set *, const char *, php_stream *); #ifndef STDIN_FILENO @@ -2117,7 +2118,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c private const char * get_default_magic(void) { -@@ -90,7 +100,7 @@ +@@ -90,7 +101,7 @@ static char *default_magic; char *home, *hmagicpath; @@ -2126,7 +2127,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c struct stat st; if (default_magic) { -@@ -104,17 +114,17 @@ +@@ -104,17 +115,17 @@ return MAGIC; if (stat(hmagicpath, &st) == -1) { free(hmagicpath); @@ -2153,7 +2154,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c } if (asprintf(&default_magic, "%s:%s", hmagicpath, MAGIC) < 0) -@@ -128,6 +138,7 @@ +@@ -128,6 +139,7 @@ #else char *hmagicp = hmagicpath; char *tmppath = NULL; @@ -2161,7 +2162,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c #define APPENDPATH() \ do { \ -@@ -172,7 +183,7 @@ +@@ -172,7 +184,7 @@ } /* Third, try to get magic file relative to dll location */ @@ -2170,7 +2171,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c dllpath[MAX_PATH] = 0; /* just in case long path gets truncated and not null terminated */ if (GetModuleFileNameA(NULL, dllpath, MAX_PATH)){ PathRemoveFileSpecA(dllpath); -@@ -210,6 +221,7 @@ +@@ -210,6 +222,7 @@ return action == FILE_LOAD ? get_default_magic() : MAGIC; } @@ -2178,7 +2179,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c public struct magic_set * magic_open(int flags) -@@ -250,7 +262,7 @@ +@@ -250,7 +263,7 @@ magic_load(struct magic_set *ms, const char *magicfile) { if (ms == NULL) @@ -2187,7 +2188,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c return file_apprentice(ms, magicfile, FILE_LOAD); } -@@ -262,13 +274,6 @@ +@@ -262,13 +275,6 @@ return file_apprentice(ms, magicfile, FILE_COMPILE); } @@ -2201,7 +2202,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c public int magic_list(struct magic_set *ms, const char *magicfile) -@@ -282,9 +287,6 @@ +@@ -282,9 +288,6 @@ close_and_restore(const struct magic_set *ms, const char *name, int fd, const struct stat *sb) { @@ -2211,7 +2212,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c if ((ms->flags & MAGIC_PRESERVE_ATIME) != 0) { /* -@@ -311,7 +313,6 @@ +@@ -311,7 +314,6 @@ } } @@ -2219,7 +2220,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c /* * find type of descriptor -@@ -321,7 +322,7 @@ +@@ -321,7 +323,7 @@ { if (ms == NULL) return NULL; @@ -2228,7 +2229,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c } /* -@@ -332,30 +333,42 @@ +@@ -332,30 +334,42 @@ { if (ms == NULL) return NULL; @@ -2277,7 +2278,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c case -1: /* error */ goto done; case 0: /* nothing found */ -@@ -365,68 +378,48 @@ +@@ -365,68 +379,48 @@ goto done; } @@ -2372,7 +2373,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c return rv == 0 ? file_getbuffer(ms) : NULL; } -@@ -440,14 +433,13 @@ +@@ -440,14 +434,13 @@ return NULL; /* * The main work is done here! @@ -2410,8 +2411,8 @@ diff -u libmagic.orig/magic.h libmagic/magic.h diff -u libmagic.orig/print.c libmagic/print.c --- libmagic.orig/print.c 2013-03-21 18:45:14.000000000 +0100 -+++ libmagic/print.c 2013-04-08 15:42:57.328298809 +0200 -@@ -28,6 +28,8 @@ ++++ libmagic/print.c 2013-04-27 13:53:32.175250261 +0200 +@@ -28,13 +28,17 @@ /* * print.c - debugging printout routines */ @@ -2419,8 +2420,9 @@ diff -u libmagic.orig/print.c libmagic/print.c +#include "php.h" #include "file.h" ++#include "cdf.h" -@@ -35,6 +37,7 @@ + #ifndef lint FILE_RCSID("@(#)$File: print.c,v 1.76 2013/02/26 18:25:00 christos Exp $") #endif /* lint */ @@ -2428,7 +2430,7 @@ diff -u libmagic.orig/print.c libmagic/print.c #include <string.h> #include <stdarg.h> #include <stdlib.h> -@@ -43,188 +46,28 @@ +@@ -43,188 +47,28 @@ #endif #include <time.h> @@ -2619,7 +2621,7 @@ diff -u libmagic.orig/print.c libmagic/print.c - (void) fprintf(stderr, "Warning: "); va_start(va, f); - (void) vfprintf(stderr, f, va); -+ vasprintf(&expanded_format, f, va); ++ if (vasprintf(&expanded_format, f, va)); /* silence */ va_end(va); - (void) fputc('\n', stderr); + @@ -2629,7 +2631,7 @@ diff -u libmagic.orig/print.c libmagic/print.c } protected const char * -@@ -235,7 +78,7 @@ +@@ -235,7 +79,7 @@ struct tm *tm; if (flags & FILE_T_WINDOWS) { diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c index 8ae572973..11920e658 100644 --- a/ext/fileinfo/libmagic/apprentice.c +++ b/ext/fileinfo/libmagic/apprentice.c @@ -1133,7 +1133,7 @@ apprentice_load(struct magic_set *ms, const char *fn, int action) uint32_t mentrycount[MAGIC_SETS] = { 0 }; uint32_t i, j; size_t files = 0, maxfiles = 0; - char **filearr = NULL, *mfn; + char **filearr = NULL; struct stat st; struct magic_map *map; php_stream *dir; @@ -1169,7 +1169,7 @@ apprentice_load(struct magic_set *ms, const char *fn, int action) int mflen; char mfn[MAXPATHLEN]; - dir = php_stream_opendir(fn, REPORT_ERRORS, NULL); + dir = php_stream_opendir((char *)fn, REPORT_ERRORS, NULL); if (!dir) { errs++; goto out; @@ -2613,7 +2613,7 @@ apprentice_map(struct magic_set *ms, const char *fn) #ifdef PHP_WIN32 /* Don't bother on windows with php_stream_open_wrapper, return to give apprentice_load() a chance. */ - if (php_stream_stat_path_ex(fn, 0, &st, NULL) == SUCCESS) { + if (php_stream_stat_path_ex((char *)fn, 0, &st, NULL) == SUCCESS) { if (st.sb.st_mode & S_IFDIR) { goto error; } @@ -2778,7 +2778,7 @@ apprentice_compile(struct magic_set *ms, struct magic_map *map, const char *fn) goto out; } - if (php_stream_write(stream, map->nmagic, nm) != (ssize_t)nm) { + if (php_stream_write(stream, (const char *)map->nmagic, nm) != (ssize_t)nm) { file_error(ms, errno, "error writing `%s'", dbname); goto out; } @@ -2792,7 +2792,7 @@ apprentice_compile(struct magic_set *ms, struct magic_map *map, const char *fn) for (i = 0; i < MAGIC_SETS; i++) { len = m * map->nmagic[i]; - if (php_stream_write(stream, map->magic[i], len) != (ssize_t)len) { + if (php_stream_write(stream, (const char *)map->magic[i], len) != (ssize_t)len) { file_error(ms, errno, "error writing `%s'", dbname); goto out; } diff --git a/ext/fileinfo/libmagic/magic.c b/ext/fileinfo/libmagic/magic.c index 15fd6be77..4bcc49eb8 100644 --- a/ext/fileinfo/libmagic/magic.c +++ b/ext/fileinfo/libmagic/magic.c @@ -80,11 +80,12 @@ FILE_RCSID("@(#)$File: magic.c,v 1.78 2013/01/07 18:20:19 christos Exp $") # undef S_IFIFO #endif -private void free_mlist(struct mlist *); private void close_and_restore(const struct magic_set *, const char *, int, const struct stat *); private int unreadable_info(struct magic_set *, mode_t, const char *); +#if 0 private const char* get_default_magic(void); +#endif private const char *file_or_stream(struct magic_set *, const char *, php_stream *); #ifndef STDIN_FILENO diff --git a/ext/fileinfo/libmagic/print.c b/ext/fileinfo/libmagic/print.c index 713487a69..eb4e6e8ce 100644 --- a/ext/fileinfo/libmagic/print.c +++ b/ext/fileinfo/libmagic/print.c @@ -32,6 +32,7 @@ #include "php.h" #include "file.h" +#include "cdf.h" #ifndef lint FILE_RCSID("@(#)$File: print.c,v 1.76 2013/02/26 18:25:00 christos Exp $") @@ -62,7 +63,7 @@ file_magwarn(struct magic_set *ms, const char *f, ...) TSRMLS_FETCH(); va_start(va, f); - vasprintf(&expanded_format, f, va); + if (vasprintf(&expanded_format, f, va)); /* silence */ va_end(va); php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Warning: %s", expanded_format); diff --git a/ext/gd/config.m4 b/ext/gd/config.m4 index c7a253c41..50660af6c 100644 --- a/ext/gd/config.m4 +++ b/ext/gd/config.m4 @@ -9,7 +9,6 @@ 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_VPX_DIR"; then PHP_ARG_WITH(vpx-dir, for the location of libvpx, [ --with-vpx-dir[=DIR] GD: Set the path to libvpx install prefix], no, no) @@ -159,18 +158,11 @@ 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/$PHP_LIBDIR/libXpm.$SHLIB_SUFFIX_NAME || test -f $i/$PHP_LIBDIR/libXpm.a && GD_XPM_DIR=$i && break + 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([libXpm.(a|so) not found.]) - fi - - for i in include include/X11; do - test -f $GD_XPM_DIR/$i/xpm.h && GD_XPM_INC=$GD_XPM_DIR/include - done - - if test -z "$GD_XPM_INC"; then AC_MSG_ERROR([xpm.h not found.]) fi @@ -259,52 +251,21 @@ AC_DEFUN([PHP_GD_JISX0208],[ ]) AC_DEFUN([PHP_GD_CHECK_VERSION],[ - PHP_CHECK_LIBRARY(gd, gdImageString16, [AC_DEFINE(HAVE_LIBGD13, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdImagePaletteCopy, [AC_DEFINE(HAVE_LIBGD15, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdImageCreateFromPng, [AC_DEFINE(HAVE_GD_PNG, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdImageCreateFromGif, [AC_DEFINE(HAVE_GD_GIF_READ, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdImageGif, [AC_DEFINE(HAVE_GD_GIF_CREATE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdImageWBMP, [AC_DEFINE(HAVE_GD_WBMP, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdImageCreateFromWebp, [AC_DEFINE(HAVE_GD_WEBP, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdImageCreateFromJpeg, [AC_DEFINE(HAVE_GD_JPG, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdImageCreateFromXpm, [AC_DEFINE(HAVE_GD_XPM, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdImageCreateFromGd2, [AC_DEFINE(HAVE_GD_GD2, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdImageCreateTrueColor, [AC_DEFINE(HAVE_LIBGD20, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdImageSetTile, [AC_DEFINE(HAVE_GD_IMAGESETTILE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdImageEllipse, [AC_DEFINE(HAVE_GD_IMAGEELLIPSE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdImageSetBrush, [AC_DEFINE(HAVE_GD_IMAGESETBRUSH, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdImageStringTTF, [AC_DEFINE(HAVE_GD_STRINGTTF, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdImageStringFT, [AC_DEFINE(HAVE_GD_STRINGFT, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdImageStringFTEx, [AC_DEFINE(HAVE_GD_STRINGFTEX, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdImageColorClosestHWB, [AC_DEFINE(HAVE_COLORCLOSESTHWB, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdImageColorResolve, [AC_DEFINE(HAVE_GDIMAGECOLORRESOLVE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdImageGifCtx, [AC_DEFINE(HAVE_GD_GIF_CTX, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdCacheCreate, [AC_DEFINE(HAVE_GD_CACHE_CREATE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdFontCacheShutdown, [AC_DEFINE(HAVE_GD_FONTCACHESHUTDOWN,1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdFreeFontCache, [AC_DEFINE(HAVE_GD_FREEFONTCACHE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdFontCacheMutexSetup, [AC_DEFINE(HAVE_GD_FONTMUTEX, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdNewDynamicCtxEx, [AC_DEFINE(HAVE_GD_DYNAMIC_CTX_EX, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdImageConvolution, [AC_DEFINE(HAVE_GD_IMAGE_CONVOLUTION, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) - PHP_CHECK_LIBRARY(gd, gdImagePixelate, [AC_DEFINE(HAVE_GD_IMAGE_PIXELATE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) + PHP_CHECK_LIBRARY(gd, gdImageCreateFromPng, [AC_DEFINE(HAVE_GD_PNG, 1, [ ])], [], [ $GD_SHARED_LIBADD ]) + PHP_CHECK_LIBRARY(gd, gdImageCreateFromWebp, [AC_DEFINE(HAVE_GD_WEBP, 1, [ ])], [], [ $GD_SHARED_LIBADD ]) + PHP_CHECK_LIBRARY(gd, gdImageCreateFromJpeg, [AC_DEFINE(HAVE_GD_JPG, 1, [ ])], [], [ $GD_SHARED_LIBADD ]) + PHP_CHECK_LIBRARY(gd, gdImageCreateFromXpm, [AC_DEFINE(HAVE_GD_XPM, 1, [ ])], [], [ $GD_SHARED_LIBADD ]) + PHP_CHECK_LIBRARY(gd, gdImageStringFT, [AC_DEFINE(HAVE_GD_FREETYPE, 1, [ ])], [], [ $GD_SHARED_LIBADD ]) ]) dnl dnl Main GD configure dnl -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/webpimg.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/xbm.c libgd/gd_gif_out.c libgd/gd_security.c \ - libgd/gd_filter.c libgd/gd_pixelate.c libgd/gd_arc.c libgd/gd_rotate.c libgd/gd_color.c \ - libgd/gd_transform.c libgd/gd_crop.c libgd/gd_interpolation.c libgd/gd_matrix.c" - -dnl check for fabsf and floorf which are available since C99 - AC_CHECK_FUNCS(fabsf floorf) +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 @@ -312,36 +273,33 @@ dnl PNG is required by GD library dnl Various checks for GD features PHP_GD_ZLIB PHP_GD_TTSTR - PHP_GD_JISX0208 - PHP_GD_JPEG PHP_GD_VPX + PHP_GD_JPEG PHP_GD_PNG PHP_GD_XPM PHP_GD_FREETYPE2 PHP_GD_T1LIB + 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/webpimg.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/xbm.c libgd/gd_gif_out.c libgd/gd_security.c \ + libgd/gd_filter.c libgd/gd_pixelate.c libgd/gd_arc.c libgd/gd_rotate.c libgd/gd_color.c \ + libgd/gd_transform.c libgd/gd_crop.c libgd/gd_interpolation.c libgd/gd_matrix.c" + +dnl check for fabsf and floorf which are available since C99 + AC_CHECK_FUNCS(fabsf floorf) dnl These are always available with bundled library - AC_DEFINE(HAVE_LIBGD, 1, [ ]) - AC_DEFINE(HAVE_LIBGD13, 1, [ ]) - AC_DEFINE(HAVE_LIBGD15, 1, [ ]) - AC_DEFINE(HAVE_LIBGD20, 1, [ ]) - AC_DEFINE(HAVE_LIBGD204, 1, [ ]) - AC_DEFINE(HAVE_GD_IMAGESETTILE, 1, [ ]) - AC_DEFINE(HAVE_GD_IMAGESETBRUSH, 1, [ ]) - AC_DEFINE(HAVE_GDIMAGECOLORRESOLVE, 1, [ ]) - AC_DEFINE(HAVE_COLORCLOSESTHWB, 1, [ ]) - AC_DEFINE(HAVE_GD_WBMP, 1, [ ]) - AC_DEFINE(HAVE_GD_GD2, 1, [ ]) - AC_DEFINE(HAVE_GD_PNG, 1, [ ]) - AC_DEFINE(HAVE_GD_XBM, 1, [ ]) AC_DEFINE(HAVE_GD_BUNDLED, 1, [ ]) - AC_DEFINE(HAVE_GD_GIF_READ, 1, [ ]) - AC_DEFINE(HAVE_GD_GIF_CREATE, 1, [ ]) - AC_DEFINE(HAVE_GD_IMAGEELLIPSE, 1, [ ]) - AC_DEFINE(HAVE_GD_FONTCACHESHUTDOWN,1, [ ]) - AC_DEFINE(HAVE_GD_FONTMUTEX, 1, [ ]) - AC_DEFINE(HAVE_GD_DYNAMIC_CTX_EX, 1, [ ]) - AC_DEFINE(HAVE_GD_GIF_CTX, 1, [ ]) + AC_DEFINE(HAVE_GD_PNG, 1, [ ]) + AC_DEFINE(HAVE_GD_CACHE_CREATE, 1, [ ]) dnl Make sure the libgd/ is first in the include path GDLIB_CFLAGS="-DHAVE_LIBPNG" @@ -365,8 +323,7 @@ dnl enable the support in bundled GD library fi if test -n "$FREETYPE2_DIR"; then - AC_DEFINE(HAVE_GD_STRINGFT, 1, [ ]) - AC_DEFINE(HAVE_GD_STRINGFTEX, 1, [ ]) + AC_DEFINE(HAVE_GD_FREETYPE, 1, [ ]) AC_DEFINE(ENABLE_GD_TTF, 1, [ ]) GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBFREETYPE -DENABLE_GD_TTF" fi @@ -380,8 +337,7 @@ else if test "$PHP_GD" != "no"; then GD_MODULE_TYPE=external - extra_sources="gdcache.c libgd/gd_compat.c libgd/gd_filter.c libgd/gd_pixelate.c libgd/gd_arc.c \ - libgd/gd_rotate.c libgd/gd_color.c" + extra_sources="gd_compat.c" dnl Various checks for GD features PHP_GD_ZLIB @@ -394,44 +350,28 @@ dnl Various checks for GD features PHP_GD_T1LIB dnl Header path - for i in include/gd1.3 include/gd include gd1.3 gd ""; do + for i in include/gd include gd ""; do test -f "$PHP_GD/$i/gd.h" && GD_INCLUDE="$PHP_GD/$i" done -dnl Library path - for i in $PHP_LIBDIR/gd1.3 $PHP_LIBDIR/gd $PHP_LIBDIR gd1.3 gd ""; do - test -f "$PHP_GD/$i/libgd.$SHLIB_SUFFIX_NAME" || test -f "$PHP_GD/$i/libgd.a" && GD_LIB="$PHP_GD/$i" - done - - if test -n "$GD_INCLUDE" && test -n "$GD_LIB"; then - PHP_ADD_LIBRARY_WITH_PATH(gd, $GD_LIB, GD_SHARED_LIBADD) - AC_DEFINE(HAVE_LIBGD,1,[ ]) - PHP_GD_CHECK_VERSION - elif test -z "$GD_INCLUDE"; then + if test -z "$GD_INCLUDE"; then AC_MSG_ERROR([Unable to find gd.h anywhere under $PHP_GD]) - else - AC_MSG_ERROR([Unable to find libgd.(a|so) anywhere under $PHP_GD]) fi - PHP_EXPAND_PATH($GD_INCLUDE, GD_INCLUDE) +dnl Library path - dnl - dnl Check for gd 2.0.4 greater availability - dnl - old_CPPFLAGS=$CPPFLAGS - CPPFLAGS=-I$GD_INCLUDE - AC_TRY_COMPILE([ -#include <gd.h> -#include <stdlib.h> - ], [ -gdIOCtx *ctx; -ctx = malloc(sizeof(gdIOCtx)); -ctx->gd_free = 1; - ], [ - AC_DEFINE(HAVE_LIBGD204, 1, [ ]) + 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 ]) - CPPFLAGS=$old_CPPFLAGS + PHP_GD_CHECK_VERSION + PHP_EXPAND_PATH($GD_INCLUDE, GD_INCLUDE) fi fi @@ -441,9 +381,8 @@ dnl if test "$PHP_GD" != "no"; then PHP_NEW_EXTENSION(gd, gd.c $extra_sources, $ext_shared,, \\$(GDLIB_CFLAGS)) - PHP_ADD_BUILD_DIR($ext_builddir/libgd) - - if test "$GD_MODULE_TYPE" = "builtin"; then + if test "$GD_MODULE_TYPE" = "builtin"; then + PHP_ADD_BUILD_DIR($ext_builddir/libgd) GDLIB_CFLAGS="-I$ext_srcdir/libgd $GDLIB_CFLAGS" GD_HEADER_DIRS="ext/gd/ ext/gd/libgd/" @@ -456,7 +395,7 @@ if test "$PHP_GD" != "no"; then PHP_ADD_INCLUDE($GD_INCLUDE) PHP_CHECK_LIBRARY(gd, gdImageCreate, [], [ AC_MSG_ERROR([GD build test failed. Please check the config.log for details.]) - ], [ -L$GD_LIB $GD_SHARED_LIBADD ]) + ], [ $GD_SHARED_LIBADD ]) fi PHP_INSTALL_HEADERS([$GD_HEADER_DIRS]) diff --git a/ext/gd/gd.c b/ext/gd/gd.c index b60891bdc..d6d2848d4 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -53,11 +53,13 @@ # include <Wingdi.h> #endif -#if HAVE_LIBGD -#if !HAVE_GD_BUNDLED -# include "libgd/gd_compat.h" +#ifdef HAVE_GD_XPM +# include <X11/xpm.h> #endif +# include "gd_compat.h" + + static int le_gd, le_gd_font; #if HAVE_LIBT1 #include <t1lib.h> @@ -73,9 +75,6 @@ static void php_free_ps_enc(zend_rsrc_list_entry *rsrc TSRMLS_DC); #include <gdfontl.h> /* 4 Large font */ #include <gdfontg.h> /* 5 Giant font */ -#ifdef HAVE_GD_WBMP -#include "libgd/wbmp.h" -#endif #ifdef ENABLE_GD_TTF # ifdef HAVE_LIBFREETYPE # include <ft2build.h> @@ -91,38 +90,7 @@ static void php_free_ps_enc(zend_rsrc_list_entry *rsrc TSRMLS_DC); static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int, int); #endif -#if HAVE_LIBGD15 -/* it's >= 1.5, i.e. has IOCtx */ -#define USE_GD_IOCTX 1 -#else -#undef USE_GD_IOCTX -#endif - -#ifdef USE_GD_IOCTX #include "gd_ctx.c" -#else -#define gdImageCreateFromGdCtx NULL -#define gdImageCreateFromGd2Ctx NULL -#define gdImageCreateFromGd2partCtx NULL -#define gdImageCreateFromGifCtx NULL -#define gdImageCreateFromJpegCtx NULL -#define gdImageCreateFromPngCtx NULL -#define gdImageCreateFromWBMPCtx NULL -typedef FILE gdIOCtx; -#define CTX_PUTC(c, fp) fputc(c, fp) -#endif - -#ifndef HAVE_GDIMAGECOLORRESOLVE -extern int gdImageColorResolve(gdImagePtr, int, int, int); -#endif - -#if HAVE_COLORCLOSESTHWB -int gdImageColorClosestHWB(gdImagePtr im, int r, int g, int b); -#endif - -#ifndef HAVE_GD_DYNAMIC_CTX_EX -#define gdNewDynamicCtxEx(len, data, val) gdNewDynamicCtx(len, data) -#endif /* Section Filters Declarations */ /* IMPORTANT NOTE FOR NEW FILTER @@ -239,12 +207,10 @@ ZEND_BEGIN_ARG_INFO(arginfo_imagesavealpha, 0) ZEND_ARG_INFO(0, save) ZEND_END_ARG_INFO() -#if HAVE_GD_BUNDLED ZEND_BEGIN_ARG_INFO(arginfo_imagelayereffect, 0) ZEND_ARG_INFO(0, im) ZEND_ARG_INFO(0, effect) ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_INFO(arginfo_imagecolorallocatealpha, 0) ZEND_ARG_INFO(0, im) @@ -308,19 +274,15 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_imagerotate, 0, 0, 3) ZEND_ARG_INFO(0, ignoretransparent) ZEND_END_ARG_INFO() -#if HAVE_GD_IMAGESETTILE ZEND_BEGIN_ARG_INFO(arginfo_imagesettile, 0) ZEND_ARG_INFO(0, im) ZEND_ARG_INFO(0, tile) ZEND_END_ARG_INFO() -#endif -#if HAVE_GD_IMAGESETBRUSH ZEND_BEGIN_ARG_INFO(arginfo_imagesetbrush, 0) ZEND_ARG_INFO(0, im) ZEND_ARG_INFO(0, brush) ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_INFO(arginfo_imagecreate, 0) ZEND_ARG_INFO(0, x_size) @@ -330,17 +292,13 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(arginfo_imagetypes, 0) ZEND_END_ARG_INFO() -#if HAVE_LIBGD15 ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromstring, 0) ZEND_ARG_INFO(0, image) ZEND_END_ARG_INFO() -#endif -#ifdef HAVE_GD_GIF_READ ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromgif, 0) ZEND_ARG_INFO(0, filename) ZEND_END_ARG_INFO() -#endif #ifdef HAVE_GD_JPG ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromjpeg, 0) @@ -360,29 +318,24 @@ ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromwebp, 0) ZEND_END_ARG_INFO() #endif -#ifdef HAVE_GD_XBM ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromxbm, 0) ZEND_ARG_INFO(0, filename) ZEND_END_ARG_INFO() -#endif -#if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED) +#if defined(HAVE_GD_XPM) ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromxpm, 0) ZEND_ARG_INFO(0, filename) ZEND_END_ARG_INFO() #endif -#ifdef HAVE_GD_WBMP ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromwbmp, 0) ZEND_ARG_INFO(0, filename) ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromgd, 0) ZEND_ARG_INFO(0, filename) ZEND_END_ARG_INFO() -#ifdef HAVE_GD_GD2 ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromgd2, 0) ZEND_ARG_INFO(0, filename) ZEND_END_ARG_INFO() @@ -394,22 +347,17 @@ ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromgd2part, 0) ZEND_ARG_INFO(0, width) ZEND_ARG_INFO(0, height) ZEND_END_ARG_INFO() -#endif -#if HAVE_GD_BUNDLED ZEND_BEGIN_ARG_INFO_EX(arginfo_imagexbm, 0, 0, 2) ZEND_ARG_INFO(0, im) ZEND_ARG_INFO(0, filename) ZEND_ARG_INFO(0, foreground) ZEND_END_ARG_INFO() -#endif -#ifdef HAVE_GD_GIF_CREATE ZEND_BEGIN_ARG_INFO_EX(arginfo_imagegif, 0, 0, 1) ZEND_ARG_INFO(0, im) ZEND_ARG_INFO(0, filename) ZEND_END_ARG_INFO() -#endif #ifdef HAVE_GD_PNG ZEND_BEGIN_ARG_INFO_EX(arginfo_imagepng, 0, 0, 1) @@ -433,27 +381,23 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_imagejpeg, 0, 0, 1) ZEND_END_ARG_INFO() #endif -#ifdef HAVE_GD_WBMP ZEND_BEGIN_ARG_INFO_EX(arginfo_imagewbmp, 0, 0, 1) ZEND_ARG_INFO(0, im) ZEND_ARG_INFO(0, filename) ZEND_ARG_INFO(0, foreground) ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_INFO_EX(arginfo_imagegd, 0, 0, 1) ZEND_ARG_INFO(0, im) ZEND_ARG_INFO(0, filename) ZEND_END_ARG_INFO() -#ifdef HAVE_GD_GD2 ZEND_BEGIN_ARG_INFO_EX(arginfo_imagegd2, 0, 0, 1) ZEND_ARG_INFO(0, im) ZEND_ARG_INFO(0, filename) ZEND_ARG_INFO(0, chunk_size) ZEND_ARG_INFO(0, type) ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_INFO(arginfo_imagedestroy, 0) ZEND_ARG_INFO(0, im) @@ -466,12 +410,10 @@ ZEND_BEGIN_ARG_INFO(arginfo_imagecolorallocate, 0) ZEND_ARG_INFO(0, blue) ZEND_END_ARG_INFO() -#if HAVE_LIBGD15 ZEND_BEGIN_ARG_INFO(arginfo_imagepalettecopy, 0) ZEND_ARG_INFO(0, dst) ZEND_ARG_INFO(0, src) ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_INFO(arginfo_imagecolorat, 0) ZEND_ARG_INFO(0, im) @@ -486,14 +428,12 @@ ZEND_BEGIN_ARG_INFO(arginfo_imagecolorclosest, 0) ZEND_ARG_INFO(0, blue) ZEND_END_ARG_INFO() -#if HAVE_COLORCLOSESTHWB ZEND_BEGIN_ARG_INFO(arginfo_imagecolorclosesthwb, 0) ZEND_ARG_INFO(0, im) ZEND_ARG_INFO(0, red) ZEND_ARG_INFO(0, green) ZEND_ARG_INFO(0, blue) ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_INFO(arginfo_imagecolordeallocate, 0) ZEND_ARG_INFO(0, im) @@ -695,7 +635,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_imagecopy, 0) ZEND_ARG_INFO(0, src_h) ZEND_END_ARG_INFO() -#if HAVE_LIBGD15 ZEND_BEGIN_ARG_INFO(arginfo_imagecopymerge, 0) ZEND_ARG_INFO(0, src_im) ZEND_ARG_INFO(0, dst_im) @@ -719,7 +658,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_imagecopymergegray, 0) ZEND_ARG_INFO(0, src_h) ZEND_ARG_INFO(0, pct) ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_INFO(arginfo_imagecopyresized, 0) ZEND_ARG_INFO(0, dst_im) @@ -743,7 +681,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_imagesy, 0) ZEND_END_ARG_INFO() #ifdef ENABLE_GD_TTF -#if HAVE_LIBFREETYPE && HAVE_GD_STRINGFTEX +#if HAVE_LIBFREETYPE ZEND_BEGIN_ARG_INFO_EX(arginfo_imageftbbox, 0, 0, 4) ZEND_ARG_INFO(0, size) ZEND_ARG_INFO(0, angle) @@ -839,15 +777,13 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_imagepsbbox, 0, 0, 3) ZEND_END_ARG_INFO() #endif -#ifdef HAVE_GD_WBMP ZEND_BEGIN_ARG_INFO_EX(arginfo_image2wbmp, 0, 0, 1) ZEND_ARG_INFO(0, im) ZEND_ARG_INFO(0, filename) ZEND_ARG_INFO(0, threshold) ZEND_END_ARG_INFO() -#endif -#if defined(HAVE_GD_JPG) && defined(HAVE_GD_WBMP) +#if defined(HAVE_GD_JPG) ZEND_BEGIN_ARG_INFO(arginfo_jpeg2wbmp, 0) ZEND_ARG_INFO(0, f_org) ZEND_ARG_INFO(0, f_dest) @@ -857,7 +793,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_jpeg2wbmp, 0) ZEND_END_ARG_INFO() #endif -#if defined(HAVE_GD_PNG) && defined(HAVE_GD_WBMP) +#if defined(HAVE_GD_PNG) ZEND_BEGIN_ARG_INFO(arginfo_png2wbmp, 0) ZEND_ARG_INFO(0, f_org) ZEND_ARG_INFO(0, f_dest) @@ -883,16 +819,17 @@ ZEND_BEGIN_ARG_INFO(arginfo_imageconvolution, 0) ZEND_ARG_INFO(0, offset) ZEND_END_ARG_INFO() -#ifdef HAVE_GD_BUNDLED -ZEND_BEGIN_ARG_INFO(arginfo_imageantialias, 0) +ZEND_BEGIN_ARG_INFO(arginfo_imageflip, 0) ZEND_ARG_INFO(0, im) - ZEND_ARG_INFO(0, on) + ZEND_ARG_INFO(0, mode) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_imageflip, 0) +#ifdef HAVE_GD_BUNDLED +ZEND_BEGIN_ARG_INFO(arginfo_imageantialias, 0) ZEND_ARG_INFO(0, im) - ZEND_ARG_INFO(0, mode) + ZEND_ARG_INFO(0, on) ZEND_END_ARG_INFO() +#endif ZEND_BEGIN_ARG_INFO(arginfo_imagecrop, 0) ZEND_ARG_INFO(0, im) @@ -934,8 +871,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_imagesetinterpolation, 0) ZEND_ARG_INFO(0, method) ZEND_END_ARG_INFO() -#endif - /* }}} */ /* {{{ gd_functions[] @@ -948,14 +883,10 @@ const zend_function_entry gd_functions[] = { PHP_FE(imagecharup, arginfo_imagecharup) PHP_FE(imagecolorat, arginfo_imagecolorat) PHP_FE(imagecolorallocate, arginfo_imagecolorallocate) -#if HAVE_LIBGD15 PHP_FE(imagepalettecopy, arginfo_imagepalettecopy) PHP_FE(imagecreatefromstring, arginfo_imagecreatefromstring) -#endif PHP_FE(imagecolorclosest, arginfo_imagecolorclosest) -#if HAVE_COLORCLOSESTHWB PHP_FE(imagecolorclosesthwb, arginfo_imagecolorclosesthwb) -#endif PHP_FE(imagecolordeallocate, arginfo_imagecolordeallocate) PHP_FE(imagecolorresolve, arginfo_imagecolorresolve) PHP_FE(imagecolorexact, arginfo_imagecolorexact) @@ -964,10 +895,8 @@ const zend_function_entry gd_functions[] = { PHP_FE(imagecolorstotal, arginfo_imagecolorstotal) PHP_FE(imagecolorsforindex, arginfo_imagecolorsforindex) PHP_FE(imagecopy, arginfo_imagecopy) -#if HAVE_LIBGD15 PHP_FE(imagecopymerge, arginfo_imagecopymerge) PHP_FE(imagecopymergegray, arginfo_imagecopymergegray) -#endif PHP_FE(imagecopyresized, arginfo_imagecopyresized) PHP_FE(imagecreate, arginfo_imagecreate) PHP_FE(imagecreatetruecolor, arginfo_imagecreatetruecolor) @@ -991,10 +920,11 @@ const zend_function_entry gd_functions[] = { #endif PHP_FE(imagerotate, arginfo_imagerotate) + PHP_FE(imageflip, arginfo_imageflip) #ifdef HAVE_GD_BUNDLED PHP_FE(imageantialias, arginfo_imageantialias) - PHP_FE(imageflip, arginfo_imageflip) +#endif PHP_FE(imagecrop, arginfo_imagecrop) PHP_FE(imagecropauto, arginfo_imagecropauto) PHP_FE(imagescale, arginfo_imagescale) @@ -1002,16 +932,8 @@ const zend_function_entry gd_functions[] = { PHP_FE(imageaffinematrixconcat, arginfo_imageaffinematrixconcat) PHP_FE(imageaffinematrixget, arginfo_imageaffinematrixget) PHP_FE(imagesetinterpolation, arginfo_imagesetinterpolation) -#endif - -#if HAVE_GD_IMAGESETTILE PHP_FE(imagesettile, arginfo_imagesettile) -#endif - -#if HAVE_GD_IMAGESETBRUSH PHP_FE(imagesetbrush, arginfo_imagesetbrush) -#endif - PHP_FE(imagesetstyle, arginfo_imagesetstyle) #ifdef HAVE_GD_PNG @@ -1020,45 +942,31 @@ const zend_function_entry gd_functions[] = { #ifdef HAVE_GD_WEBP PHP_FE(imagecreatefromwebp, arginfo_imagecreatefromwebp) #endif -#ifdef HAVE_GD_GIF_READ PHP_FE(imagecreatefromgif, arginfo_imagecreatefromgif) -#endif #ifdef HAVE_GD_JPG PHP_FE(imagecreatefromjpeg, arginfo_imagecreatefromjpeg) #endif -#ifdef HAVE_GD_WBMP PHP_FE(imagecreatefromwbmp, arginfo_imagecreatefromwbmp) -#endif -#ifdef HAVE_GD_XBM PHP_FE(imagecreatefromxbm, arginfo_imagecreatefromxbm) -#endif -#if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED) +#if defined(HAVE_GD_XPM) PHP_FE(imagecreatefromxpm, arginfo_imagecreatefromxpm) #endif PHP_FE(imagecreatefromgd, arginfo_imagecreatefromgd) -#ifdef HAVE_GD_GD2 PHP_FE(imagecreatefromgd2, arginfo_imagecreatefromgd2) PHP_FE(imagecreatefromgd2part, arginfo_imagecreatefromgd2part) -#endif #ifdef HAVE_GD_PNG PHP_FE(imagepng, arginfo_imagepng) #endif #ifdef HAVE_GD_WEBP PHP_FE(imagewebp, arginfo_imagewebp) #endif -#ifdef HAVE_GD_GIF_CREATE PHP_FE(imagegif, arginfo_imagegif) -#endif #ifdef HAVE_GD_JPG PHP_FE(imagejpeg, arginfo_imagejpeg) #endif -#ifdef HAVE_GD_WBMP PHP_FE(imagewbmp, arginfo_imagewbmp) -#endif PHP_FE(imagegd, arginfo_imagegd) -#ifdef HAVE_GD_GD2 PHP_FE(imagegd2, arginfo_imagegd2) -#endif PHP_FE(imagedestroy, arginfo_imagedestroy) PHP_FE(imagegammacorrect, arginfo_imagegammacorrect) @@ -1083,7 +991,7 @@ const zend_function_entry gd_functions[] = { #ifdef ENABLE_GD_TTF PHP_FE(imagettfbbox, arginfo_imagettfbbox) PHP_FE(imagettftext, arginfo_imagettftext) -#if HAVE_LIBFREETYPE && HAVE_GD_STRINGFTEX +#if HAVE_GD_FREETYPE && HAVE_LIBFREETYPE PHP_FE(imageftbbox, arginfo_imageftbbox) PHP_FE(imagefttext, arginfo_imagefttext) #endif @@ -1103,19 +1011,15 @@ const zend_function_entry gd_functions[] = { #endif PHP_FE(imagetypes, arginfo_imagetypes) -#if defined(HAVE_GD_JPG) && defined(HAVE_GD_WBMP) +#if defined(HAVE_GD_JPG) PHP_FE(jpeg2wbmp, arginfo_jpeg2wbmp) #endif -#if defined(HAVE_GD_PNG) && defined(HAVE_GD_WBMP) +#if defined(HAVE_GD_PNG) PHP_FE(png2wbmp, arginfo_png2wbmp) #endif -#ifdef HAVE_GD_WBMP PHP_FE(image2wbmp, arginfo_image2wbmp) -#endif -#if HAVE_GD_BUNDLED PHP_FE(imagelayereffect, arginfo_imagelayereffect) PHP_FE(imagexbm, arginfo_imagexbm) -#endif PHP_FE(imagecolormatch, arginfo_imagecolormatch) @@ -1132,13 +1036,13 @@ zend_module_entry gd_module_entry = { "gd", gd_functions, PHP_MINIT(gd), -#if HAVE_LIBT1 || HAVE_GD_FONTMUTEX +#if HAVE_LIBT1 PHP_MSHUTDOWN(gd), #else NULL, #endif NULL, -#if HAVE_GD_STRINGFT && (HAVE_LIBFREETYPE && (HAVE_GD_FONTCACHESHUTDOWN || HAVE_GD_FREEFONTCACHE)) +#if HAVE_GD_FREETYPE && HAVE_LIBFREETYPE PHP_RSHUTDOWN(gd), #else NULL, @@ -1180,15 +1084,25 @@ static void php_free_gd_font(zend_rsrc_list_entry *rsrc TSRMLS_DC) } /* }}} */ +#ifndef HAVE_GD_BUNDLED +/* {{{ php_gd_error_method + */ +void php_gd_error_method(int type, const char *format, va_list args) +{ + TSRMLS_FETCH(); + + php_verror(NULL, "", type, format, args TSRMLS_CC); +} +/* }}} */ +#endif + /* {{{ PHP_MSHUTDOWN_FUNCTION */ -#if HAVE_LIBT1 || HAVE_GD_FONTMUTEX +#if HAVE_LIBT1 PHP_MSHUTDOWN_FUNCTION(gd) { -#if HAVE_LIBT1 T1_CloseLib(); -#endif -#if HAVE_GD_FONTMUTEX && HAVE_LIBFREETYPE +#if HAVE_GD_BUNDLED && HAVE_LIBFREETYPE gdFontCacheMutexShutdown(); #endif UNREGISTER_INI_ENTRIES(); @@ -1205,7 +1119,7 @@ PHP_MINIT_FUNCTION(gd) le_gd = zend_register_list_destructors_ex(php_free_gd_image, NULL, "gd", module_number); le_gd_font = zend_register_list_destructors_ex(php_free_gd_font, NULL, "gd font", module_number); -#if HAVE_GD_FONTMUTEX && HAVE_LIBFREETYPE +#if HAVE_GD_BUNDLED && HAVE_LIBFREETYPE gdFontCacheMutexSetup(); #endif #if HAVE_LIBT1 @@ -1215,7 +1129,9 @@ PHP_MINIT_FUNCTION(gd) le_ps_font = zend_register_list_destructors_ex(php_free_ps_font, NULL, "gd PS font", module_number); le_ps_enc = zend_register_list_destructors_ex(php_free_ps_enc, NULL, "gd PS encoding", module_number); #endif - +#ifndef HAVE_GD_BUNDLED + gdSetErrorMethod(php_gd_error_method); +#endif REGISTER_INI_ENTRIES(); REGISTER_LONG_CONSTANT("IMG_GIF", 1, CONST_CS | CONST_PERSISTENT); @@ -1224,14 +1140,14 @@ PHP_MINIT_FUNCTION(gd) REGISTER_LONG_CONSTANT("IMG_PNG", 4, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IMG_WBMP", 8, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IMG_XPM", 16, CONST_CS | CONST_PERSISTENT); -#ifdef gdTiled + /* special colours for gd */ REGISTER_LONG_CONSTANT("IMG_COLOR_TILED", gdTiled, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IMG_COLOR_STYLED", gdStyled, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IMG_COLOR_BRUSHED", gdBrushed, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IMG_COLOR_STYLEDBRUSHED", gdStyledBrushed, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IMG_COLOR_TRANSPARENT", gdTransparent, CONST_CS | CONST_PERSISTENT); -#endif + /* for imagefilledarc */ REGISTER_LONG_CONSTANT("IMG_ARC_ROUNDED", gdArc, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IMG_ARC_PIE", gdPie, CONST_CS | CONST_PERSISTENT); @@ -1239,23 +1155,16 @@ PHP_MINIT_FUNCTION(gd) REGISTER_LONG_CONSTANT("IMG_ARC_NOFILL", gdNoFill, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IMG_ARC_EDGED", gdEdged, CONST_CS | CONST_PERSISTENT); -/* GD2 image format types */ -#ifdef GD2_FMT_RAW + /* GD2 image format types */ REGISTER_LONG_CONSTANT("IMG_GD2_RAW", GD2_FMT_RAW, CONST_CS | CONST_PERSISTENT); -#endif -#ifdef GD2_FMT_COMPRESSED REGISTER_LONG_CONSTANT("IMG_GD2_COMPRESSED", GD2_FMT_COMPRESSED, CONST_CS | CONST_PERSISTENT); -#endif -#if HAVE_GD_BUNDLED + REGISTER_LONG_CONSTANT("IMG_FLIP_HORIZONTAL", GD_FLIP_HORINZONTAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_FLIP_VERTICAL", GD_FLIP_VERTICAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_FLIP_BOTH", GD_FLIP_BOTH, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IMG_EFFECT_REPLACE", gdEffectReplace, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IMG_EFFECT_ALPHABLEND", gdEffectAlphaBlend, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IMG_EFFECT_NORMAL", gdEffectNormal, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IMG_EFFECT_OVERLAY", gdEffectOverlay, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GD_BUNDLED", 1, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("IMG_FLIP_HORIZONTAL", GD_FLIP_HORINZONTAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FLIP_VERTICAL", GD_FLIP_VERTICAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FLIP_BOTH", GD_FLIP_BOTH, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IMG_CROP_DEFAULT", GD_CROP_DEFAULT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IMG_CROP_TRANSPARENT", GD_CROP_TRANSPARENT, CONST_CS | CONST_PERSISTENT); @@ -1293,6 +1202,8 @@ PHP_MINIT_FUNCTION(gd) REGISTER_LONG_CONSTANT("IMG_AFFINE_SHEAR_HORIZONTAL", GD_AFFINE_SHEAR_HORIZONTAL, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IMG_AFFINE_SHEAR_VERTICAL", GD_AFFINE_SHEAR_VERTICAL, CONST_CS | CONST_PERSISTENT); +#if defined(HAVE_GD_BUNDLED) + REGISTER_LONG_CONSTANT("GD_BUNDLED", 1, CONST_CS | CONST_PERSISTENT); #else REGISTER_LONG_CONSTANT("GD_BUNDLED", 0, CONST_CS | CONST_PERSISTENT); #endif @@ -1346,27 +1257,19 @@ PHP_MINIT_FUNCTION(gd) /* {{{ PHP_RSHUTDOWN_FUNCTION */ -#if HAVE_GD_STRINGFT && (HAVE_LIBFREETYPE && (HAVE_GD_FONTCACHESHUTDOWN || HAVE_GD_FREEFONTCACHE)) +#if HAVE_GD_FREETYPE && HAVE_LIBFREETYPE PHP_RSHUTDOWN_FUNCTION(gd) { -#if HAVE_GD_FONTCACHESHUTDOWN gdFontCacheShutdown(); -#else - gdFreeFontCache(); -#endif return SUCCESS; } #endif /* }}} */ -#if HAVE_GD_BUNDLED +#if defined(HAVE_GD_BUNDLED) #define PHP_GD_VERSION_STRING "bundled (2.1.0 compatible)" #else -# ifdef GD_VERSION_STRING -# define PHP_GD_VERSION_STRING GD_VERSION_STRING -# else -# define PHP_GD_VERSION_STRING "2.0" -# endif +# define PHP_GD_VERSION_STRING GD_VERSION_STRING #endif /* {{{ PHP_MINFO_FUNCTION @@ -1405,20 +1308,13 @@ PHP_MINFO_FUNCTION(gd) php_info_print_table_row(2, "T1Lib Support", "enabled"); #endif -/* this next part is stupid ... if I knew better, I'd put them all on one row (cmv) */ - -#ifdef HAVE_GD_GIF_READ php_info_print_table_row(2, "GIF Read Support", "enabled"); -#endif -#ifdef HAVE_GD_GIF_CREATE php_info_print_table_row(2, "GIF Create Support", "enabled"); -#endif + #ifdef HAVE_GD_JPG { - char tmp[12]; - snprintf(tmp, sizeof(tmp), "%s", gdJpegGetVersionString()); php_info_print_table_row(2, "JPEG Support", "enabled"); - php_info_print_table_row(2, "libJPEG Version", tmp); + php_info_print_table_row(2, "libJPEG Version", gdJpegGetVersionString()); } #endif @@ -1426,10 +1322,8 @@ PHP_MINFO_FUNCTION(gd) php_info_print_table_row(2, "PNG Support", "enabled"); php_info_print_table_row(2, "libPNG Version", gdPngGetVersionString()); #endif -#ifdef HAVE_GD_WBMP php_info_print_table_row(2, "WBMP Support", "enabled"); -#endif -#if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED) +#if defined(HAVE_GD_XPM) php_info_print_table_row(2, "XPM Support", "enabled"); { char tmp[12]; @@ -1437,10 +1331,8 @@ PHP_MINFO_FUNCTION(gd) php_info_print_table_row(2, "libXpm Version", tmp); } #endif -#ifdef HAVE_GD_XBM php_info_print_table_row(2, "XBM Support", "enabled"); -#endif -#if defined(USE_GD_JISX0208) && defined(HAVE_GD_BUNDLED) +#if defined(USE_GD_JISX0208) php_info_print_table_row(2, "JIS-mapped Japanese Font Support", "enabled"); #endif #ifdef HAVE_GD_WEBP @@ -1479,16 +1371,8 @@ PHP_FUNCTION(gd_info) #else add_assoc_bool(return_value, "T1Lib Support", 0); #endif -#ifdef HAVE_GD_GIF_READ add_assoc_bool(return_value, "GIF Read Support", 1); -#else - add_assoc_bool(return_value, "GIF Read Support", 0); -#endif -#ifdef HAVE_GD_GIF_CREATE add_assoc_bool(return_value, "GIF Create Support", 1); -#else - add_assoc_bool(return_value, "GIF Create Support", 0); -#endif #ifdef HAVE_GD_JPG add_assoc_bool(return_value, "JPEG Support", 1); #else @@ -1499,22 +1383,14 @@ PHP_FUNCTION(gd_info) #else add_assoc_bool(return_value, "PNG Support", 0); #endif -#ifdef HAVE_GD_WBMP add_assoc_bool(return_value, "WBMP Support", 1); -#else - add_assoc_bool(return_value, "WBMP Support", 0); -#endif -#if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED) +#if defined(HAVE_GD_XPM) add_assoc_bool(return_value, "XPM Support", 1); #else add_assoc_bool(return_value, "XPM Support", 0); #endif -#ifdef HAVE_GD_XBM add_assoc_bool(return_value, "XBM Support", 1); -#else - add_assoc_bool(return_value, "XBM Support", 0); -#endif -#if defined(USE_GD_JISX0208) && defined(HAVE_GD_BUNDLED) +#if defined(USE_GD_JISX0208) add_assoc_bool(return_value, "JIS-mapped Japanese Font Support", 1); #else add_assoc_bool(return_value, "JIS-mapped Japanese Font Support", 0); @@ -1529,62 +1405,6 @@ PHP_GD_API int phpi_get_le_gd(void) } /* }}} */ -#ifndef HAVE_GDIMAGECOLORRESOLVE - -/* {{{ gdImageColorResolve - */ -/********************************************************************/ -/* gdImageColorResolve is a replacement for the old fragment: */ -/* */ -/* if ((color=gdImageColorExact(im,R,G,B)) < 0) */ -/* if ((color=gdImageColorAllocate(im,R,G,B)) < 0) */ -/* color=gdImageColorClosest(im,R,G,B); */ -/* */ -/* in a single function */ - -int gdImageColorResolve(gdImagePtr im, int r, int g, int b) -{ - int c; - int ct = -1; - int op = -1; - long rd, gd, bd, dist; - long mindist = 3*255*255; /* init to max poss dist */ - - for (c = 0; c < im->colorsTotal; c++) { - if (im->open[c]) { - op = c; /* Save open slot */ - continue; /* Color not in use */ - } - rd = (long) (im->red [c] - r); - gd = (long) (im->green[c] - g); - bd = (long) (im->blue [c] - b); - dist = rd * rd + gd * gd + bd * bd; - if (dist < mindist) { - if (dist == 0) { - return c; /* Return exact match color */ - } - mindist = dist; - ct = c; - } - } - /* no exact match. We now know closest, but first try to allocate exact */ - if (op == -1) { - op = im->colorsTotal; - if (op == gdMaxColors) { /* No room for more colors */ - return ct; /* Return closest available color */ - } - im->colorsTotal++; - } - im->red [op] = r; - im->green[op] = g; - im->blue [op] = b; - im->open [op] = 0; - return op; /* Return newly allocated color */ -} -/* }}} */ - -#endif - #define FLIPWORD(a) (((a & 0xff000000) >> 24) | ((a & 0x00ff0000) >> 8) | ((a & 0x0000ff00) << 8) | ((a & 0x000000ff) << 24)) /* {{{ proto int imageloadfont(string filename) @@ -1647,13 +1467,7 @@ PHP_FUNCTION(imageloadfont) body_size = font->w * font->h * font->nchars; } - if (overflow2(font->nchars, font->h)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error reading font, invalid font header"); - efree(font); - php_stream_close(stream); - RETURN_FALSE; - } - if (overflow2(font->nchars * font->h, font->w )) { + if (overflow2(font->nchars, font->h) || overflow2(font->nchars * font->h, font->w )) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error reading font, invalid font header"); efree(font); php_stream_close(stream); @@ -1976,7 +1790,6 @@ PHP_FUNCTION(imagesavealpha) } /* }}} */ -#if HAVE_GD_BUNDLED /* {{{ proto bool imagelayereffect(resource im, int effect) Set the alpha blending flag to use the bundled libgd layering effects */ PHP_FUNCTION(imagelayereffect) @@ -1995,7 +1808,6 @@ PHP_FUNCTION(imagelayereffect) RETURN_TRUE; } /* }}} */ -#endif /* {{{ proto int imagecolorallocatealpha(resource im, int red, int green, int blue, int alpha) Allocate a color with an alpha level. Works for true color and palette based images */ @@ -2280,7 +2092,6 @@ PHP_FUNCTION(imagerotate) } /* }}} */ -#if HAVE_GD_IMAGESETTILE /* {{{ proto bool imagesettile(resource image, resource tile) Set the tile image to $tile when filling $image with the "IMG_COLOR_TILED" color */ PHP_FUNCTION(imagesettile) @@ -2300,9 +2111,7 @@ PHP_FUNCTION(imagesettile) RETURN_TRUE; } /* }}} */ -#endif -#if HAVE_GD_IMAGESETBRUSH /* {{{ proto bool imagesetbrush(resource image, resource brush) Set the brush image to $brush when filling $image with the "IMG_COLOR_BRUSHED" color */ PHP_FUNCTION(imagesetbrush) @@ -2322,7 +2131,6 @@ PHP_FUNCTION(imagesetbrush) RETURN_TRUE; } /* }}} */ -#endif /* {{{ proto resource imagecreate(int x_size, int y_size) Create a new image */ @@ -2355,19 +2163,15 @@ PHP_FUNCTION(imagecreate) PHP_FUNCTION(imagetypes) { int ret=0; -#ifdef HAVE_GD_GIF_CREATE ret = 1; -#endif #ifdef HAVE_GD_JPG ret |= 2; #endif #ifdef HAVE_GD_PNG ret |= 4; #endif -#ifdef HAVE_GD_WBMP ret |= 8; -#endif -#if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED) +#if defined(HAVE_GD_XPM) ret |= 16; #endif @@ -2379,13 +2183,31 @@ PHP_FUNCTION(imagetypes) } /* }}} */ +/* {{{ _php_ctx_getmbi + */ + +static int _php_ctx_getmbi(gdIOCtx *ctx) +{ + int i, mbi = 0; + + do { + i = (ctx->getC)(ctx); + if (i < 0) { + return -1; + } + mbi = (mbi << 7) | (i & 0x7f); + } while (i & 0x80); + + return mbi; +} +/* }}} */ + /* {{{ _php_image_type */ static const char php_sig_gd2[3] = {'g', 'd', '2'}; static int _php_image_type (char data[8]) { -#ifdef HAVE_LIBGD15 /* Based on ext/standard/image.c */ if (data == NULL) { @@ -2403,34 +2225,22 @@ static int _php_image_type (char data[8]) } else if (!memcmp(data, php_sig_gif, 3)) { return PHP_GDIMG_TYPE_GIF; } -#ifdef HAVE_GD_WBMP else { gdIOCtx *io_ctx; io_ctx = gdNewDynamicCtxEx(8, data, 0); if (io_ctx) { - if (getmbi((int(*)(void *)) io_ctx->getC, io_ctx) == 0 && skipheader((int(*)(void *)) io_ctx->getC, io_ctx) == 0 ) { -#if HAVE_LIBGD204 + if (_php_ctx_getmbi(io_ctx) == 0 && _php_ctx_getmbi(io_ctx) >= 0) { io_ctx->gd_free(io_ctx); -#else - io_ctx->free(io_ctx); -#endif return PHP_GDIMG_TYPE_WBM; } else { -#if HAVE_LIBGD204 io_ctx->gd_free(io_ctx); -#else - io_ctx->free(io_ctx); -#endif } } } -#endif return -1; -#endif } /* }}} */ -#ifdef HAVE_LIBGD15 /* {{{ _php_image_create_from_string */ gdImagePtr _php_image_create_from_string(zval **data, char *tn, gdImagePtr (*ioctx_func_p)() TSRMLS_DC) @@ -2447,19 +2257,11 @@ gdImagePtr _php_image_create_from_string(zval **data, char *tn, gdImagePtr (*ioc im = (*ioctx_func_p)(io_ctx); if (!im) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Passed data is not in '%s' format", tn); -#if HAVE_LIBGD204 io_ctx->gd_free(io_ctx); -#else - io_ctx->free(io_ctx); -#endif return NULL; } -#if HAVE_LIBGD204 io_ctx->gd_free(io_ctx); -#else - io_ctx->free(io_ctx); -#endif return im; } @@ -2508,30 +2310,15 @@ PHP_FUNCTION(imagecreatefromstring) break; case PHP_GDIMG_TYPE_GIF: -#ifdef HAVE_GD_GIF_READ im = _php_image_create_from_string(data, "GIF", gdImageCreateFromGifCtx TSRMLS_CC); -#else - php_error_docref(NULL TSRMLS_CC, E_WARNING, "No GIF support in this PHP build"); - RETURN_FALSE; -#endif break; case PHP_GDIMG_TYPE_WBM: -#ifdef HAVE_GD_WBMP im = _php_image_create_from_string(data, "WBMP", gdImageCreateFromWBMPCtx TSRMLS_CC); -#else - php_error_docref(NULL TSRMLS_CC, E_WARNING, "No WBMP support in this PHP build"); - RETURN_FALSE; -#endif break; case PHP_GDIMG_TYPE_GD2: -#ifdef HAVE_GD_GD2 im = _php_image_create_from_string(data, "GD2", gdImageCreateFromGd2Ctx TSRMLS_CC); -#else - php_error_docref(NULL TSRMLS_CC, E_WARNING, "No GD2 support in this PHP build"); - RETURN_FALSE; -#endif break; default: @@ -2547,7 +2334,6 @@ PHP_FUNCTION(imagecreatefromstring) ZEND_REGISTER_RESOURCE(return_value, im, le_gd); } /* }}} */ -#endif /* {{{ _php_image_create_from */ @@ -2559,9 +2345,8 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, gdImagePtr im = NULL; php_stream *stream; FILE * fp = NULL; -#ifdef HAVE_GD_JPG long ignore_warning; -#endif + if (image_type == PHP_GDIMG_TYPE_GD2PART) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sllll", &file, &file_len, &srcx, &srcy, &width, &height) == FAILURE) { return; @@ -2581,9 +2366,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, RETURN_FALSE; } -#ifndef USE_GD_IOCTX ioctx_func_p = NULL; /* don't allow sockets without IOCtx */ -#endif if (image_type == PHP_GDIMG_TYPE_WEBP) { size_t buff_size; @@ -2608,7 +2391,6 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, goto out_err; } } else if (ioctx_func_p) { -#ifdef USE_GD_IOCTX /* we can create an io context */ gdIOCtx* io_ctx; size_t buff_size; @@ -2634,13 +2416,8 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, } else { im = (*ioctx_func_p)(io_ctx); } -#if HAVE_LIBGD204 io_ctx->gd_free(io_ctx); -#else - io_ctx->free(io_ctx); -#endif pefree(buff, 1); -#endif } else { /* try and force the stream to be FILE* */ @@ -2654,7 +2431,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, case PHP_GDIMG_TYPE_GD2PART: im = (*func_p)(fp, srcx, srcy, width, height); break; -#if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED) +#if defined(HAVE_GD_XPM) case PHP_GDIMG_TYPE_XPM: im = gdImageCreateFromXpm(file); break; @@ -2663,11 +2440,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, #ifdef HAVE_GD_JPG case PHP_GDIMG_TYPE_JPG: ignore_warning = INI_INT("gd.jpeg_ignore_warning"); -#ifdef HAVE_GD_BUNDLED - im = gdImageCreateFromJpeg(fp, ignore_warning); -#else - im = gdImageCreateFromJpeg(fp); -#endif + im = gdImageCreateFromJpegEx(fp, ignore_warning); break; #endif @@ -2694,7 +2467,6 @@ out_err: } /* }}} */ -#ifdef HAVE_GD_GIF_READ /* {{{ proto resource imagecreatefromgif(string filename) Create a new image from GIF file or URL */ PHP_FUNCTION(imagecreatefromgif) @@ -2702,7 +2474,6 @@ PHP_FUNCTION(imagecreatefromgif) _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GIF, "GIF", gdImageCreateFromGif, gdImageCreateFromGifCtx); } /* }}} */ -#endif /* HAVE_GD_GIF_READ */ #ifdef HAVE_GD_JPG /* {{{ proto resource imagecreatefromjpeg(string filename) @@ -2734,7 +2505,6 @@ PHP_FUNCTION(imagecreatefromwebp) /* }}} */ #endif /* HAVE_GD_VPX */ -#ifdef HAVE_GD_XBM /* {{{ proto resource imagecreatefromxbm(string filename) Create a new image from XBM file or URL */ PHP_FUNCTION(imagecreatefromxbm) @@ -2742,9 +2512,8 @@ PHP_FUNCTION(imagecreatefromxbm) _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_XBM, "XBM", gdImageCreateFromXbm, NULL); } /* }}} */ -#endif /* HAVE_GD_XBM */ -#if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED) +#if defined(HAVE_GD_XPM) /* {{{ proto resource imagecreatefromxpm(string filename) Create a new image from XPM file or URL */ PHP_FUNCTION(imagecreatefromxpm) @@ -2754,7 +2523,6 @@ PHP_FUNCTION(imagecreatefromxpm) /* }}} */ #endif -#ifdef HAVE_GD_WBMP /* {{{ proto resource imagecreatefromwbmp(string filename) Create a new image from WBMP file or URL */ PHP_FUNCTION(imagecreatefromwbmp) @@ -2762,7 +2530,6 @@ PHP_FUNCTION(imagecreatefromwbmp) _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_WBM, "WBMP", gdImageCreateFromWBMP, gdImageCreateFromWBMPCtx); } /* }}} */ -#endif /* HAVE_GD_WBMP */ /* {{{ proto resource imagecreatefromgd(string filename) Create a new image from GD file or URL */ @@ -2772,7 +2539,6 @@ PHP_FUNCTION(imagecreatefromgd) } /* }}} */ -#ifdef HAVE_GD_GD2 /* {{{ proto resource imagecreatefromgd2(string filename) Create a new image from GD2 file or URL */ PHP_FUNCTION(imagecreatefromgd2) @@ -2788,7 +2554,6 @@ PHP_FUNCTION(imagecreatefromgd2part) _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GD2PART, "GD2", gdImageCreateFromGd2Part, gdImageCreateFromGd2PartCtx); } /* }}} */ -#endif /* HAVE_GD_GD2 */ /* {{{ _php_image_output */ @@ -2833,7 +2598,6 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char } switch (image_type) { -#ifdef HAVE_GD_WBMP case PHP_GDIMG_CONVERT_WBM: if (q == -1) { q = 0; @@ -2843,7 +2607,6 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char } gdImageWBMP(im, q, fp); break; -#endif case PHP_GDIMG_TYPE_JPG: (*func_p)(im, fp, q); break; @@ -2859,14 +2622,12 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char } (*func_p)(im, fp); break; -#ifdef HAVE_GD_GD2 case PHP_GDIMG_TYPE_GD2: if (q == -1) { q = 128; } (*func_p)(im, fp, q, t); break; -#endif default: if (q == -1) { q = 128; @@ -2889,7 +2650,6 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char } switch (image_type) { -#ifdef HAVE_GD_WBMP case PHP_GDIMG_CONVERT_WBM: if (q == -1) { q = 0; @@ -2899,7 +2659,6 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char } gdImageWBMP(im, q, tmp); break; -#endif case PHP_GDIMG_TYPE_JPG: (*func_p)(im, tmp, q); break; @@ -2917,14 +2676,12 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char } (*func_p)(im, tmp); break; -#ifdef HAVE_GD_GD2 case PHP_GDIMG_TYPE_GD2: if (q == -1) { q = 128; } (*func_p)(im, tmp, q, t); break; -#endif default: (*func_p)(im, tmp); break; @@ -2952,15 +2709,12 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char /* {{{ proto int imagexbm(int im, string filename [, int foreground]) Output XBM image to browser or file */ -#if HAVE_GD_BUNDLED PHP_FUNCTION(imagexbm) { _php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_XBM, "XBM", gdImageXbmCtx); } -#endif /* }}} */ -#ifdef HAVE_GD_GIF_CREATE /* {{{ proto bool imagegif(resource im [, string filename]) Output GIF image to browser or file */ PHP_FUNCTION(imagegif) @@ -2968,7 +2722,6 @@ PHP_FUNCTION(imagegif) _php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GIF, "GIF", gdImageGifCtx); } /* }}} */ -#endif /* HAVE_GD_GIF_CREATE */ #ifdef HAVE_GD_PNG /* {{{ proto bool imagepng(resource im [, string filename]) @@ -3002,7 +2755,6 @@ PHP_FUNCTION(imagejpeg) /* }}} */ #endif /* HAVE_GD_JPG */ -#ifdef HAVE_GD_WBMP /* {{{ proto bool imagewbmp(resource im [, string filename, [, int foreground]]) Output WBMP image to browser or file */ PHP_FUNCTION(imagewbmp) @@ -3010,7 +2762,6 @@ PHP_FUNCTION(imagewbmp) _php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_WBM, "WBMP", gdImageWBMPCtx); } /* }}} */ -#endif /* HAVE_GD_WBMP */ /* {{{ proto bool imagegd(resource im [, string filename]) Output GD image to browser or file */ @@ -3020,7 +2771,6 @@ PHP_FUNCTION(imagegd) } /* }}} */ -#ifdef HAVE_GD_GD2 /* {{{ proto bool imagegd2(resource im [, string filename, [, int chunk_size, [, int type]]]) Output GD2 image to browser or file */ PHP_FUNCTION(imagegd2) @@ -3028,7 +2778,6 @@ PHP_FUNCTION(imagegd2) _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GD2, "GD2", gdImageGd2); } /* }}} */ -#endif /* HAVE_GD_GD2 */ /* {{{ proto bool imagedestroy(resource im) Destroy an image */ @@ -3073,7 +2822,6 @@ PHP_FUNCTION(imagecolorallocate) } /* }}} */ -#if HAVE_LIBGD15 /* {{{ proto void imagepalettecopy(resource dst, resource src) Copy the palette from the src image onto the dst image */ PHP_FUNCTION(imagepalettecopy) @@ -3091,7 +2839,6 @@ PHP_FUNCTION(imagepalettecopy) gdImagePaletteCopy(dst, src); } /* }}} */ -#endif /* {{{ proto int imagecolorat(resource im, int x, int y) Get the index of the color of a pixel */ @@ -3143,7 +2890,6 @@ PHP_FUNCTION(imagecolorclosest) } /* }}} */ -#if HAVE_COLORCLOSESTHWB /* {{{ proto int imagecolorclosesthwb(resource im, int red, int green, int blue) Get the index of the color which has the hue, white and blackness nearest to the given color */ PHP_FUNCTION(imagecolorclosesthwb) @@ -3161,7 +2907,6 @@ PHP_FUNCTION(imagecolorclosesthwb) RETURN_LONG(gdImageColorClosestHWB(im, red, green, blue)); } /* }}} */ -#endif /* {{{ proto bool imagecolordeallocate(resource im, int index) De-allocate a color for an image */ @@ -3883,7 +3628,6 @@ PHP_FUNCTION(imagecopy) } /* }}} */ -#if HAVE_LIBGD15 /* {{{ proto bool imagecopymerge(resource src_im, resource dst_im, int dst_x, int dst_y, int src_x, int src_y, int src_w, int src_h, int pct) Merge one part of an image with another */ PHP_FUNCTION(imagecopymerge) @@ -3941,7 +3685,6 @@ PHP_FUNCTION(imagecopymergegray) RETURN_TRUE; } /* }}} */ -#endif /* {{{ proto bool imagecopyresized(resource dst_im, resource src_im, int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h) Copy and resize part of an image */ @@ -4019,7 +3762,7 @@ PHP_FUNCTION(imagesy) #ifdef ENABLE_GD_TTF -#if HAVE_LIBFREETYPE && HAVE_GD_STRINGFTEX +#if HAVE_GD_FREETYPE && HAVE_LIBFREETYPE /* {{{ proto array imageftbbox(float size, float angle, string font_file, string text [, array extrainfo]) Give the bounding box of a text using fonts via freetype2 */ PHP_FUNCTION(imageftbbox) @@ -4035,7 +3778,7 @@ PHP_FUNCTION(imagefttext) php_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_DRAW, 1); } /* }}} */ -#endif +#endif /* HAVE_GD_FREETYPE && HAVE_LIBFREETYPE */ /* {{{ proto array imagettfbbox(float size, float angle, string font_file, string text) Give the bounding box of a text using TrueType fonts */ @@ -4065,13 +3808,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int char *str = NULL, *fontname = NULL; char *error = NULL; int argc = ZEND_NUM_ARGS(); -#if HAVE_GD_STRINGFTEX gdFTStringExtra strex = {0}; -#endif - -#if !HAVE_GD_STRINGFTEX - assert(!extended); -#endif if (mode == TTFTEXT_BBOX) { if (argc < 4 || argc > ((extended) ? 5 : 4)) { @@ -4091,7 +3828,6 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int /* convert angle to radians */ angle = angle * (M_PI/180); -#if HAVE_GD_STRINGFTEX if (extended && EXT) { /* parse extended info */ HashPosition pos; @@ -4118,7 +3854,6 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int } while (zend_hash_move_forward_ex(HASH_OF(EXT), &pos) == SUCCESS); } -#endif #ifdef VIRTUAL_DIR { @@ -4128,25 +3863,18 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int fontname = NULL; } } -#endif +#endif /* VIRTUAL_DIR */ PHP_GD_CHECK_OPEN_BASEDIR(fontname, "Invalid font filename"); -#ifdef USE_GD_IMGSTRTTF -# if HAVE_GD_STRINGFTEX +#ifdef HAVE_GD_FREETYPE if (extended) { error = gdImageStringFTEx(im, brect, col, fontname, ptsize, angle, x, y, str, &strex); } else -# endif - -# if HAVE_GD_STRINGFT - error = gdImageStringFT(im, brect, col, fontname, ptsize, angle, x, y, str); -# elif HAVE_GD_STRINGTTF - error = gdImageStringTTF(im, brect, col, fontname, ptsize, angle, x, y, str); -# endif + error = gdImageStringFT(im, brect, col, fontname, ptsize, angle, x, y, str); -#endif +#endif /* HAVE_GD_FREETYPE */ if (error) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", error); @@ -4617,7 +4345,6 @@ PHP_FUNCTION(imagepsbbox) /* }}} */ #endif -#ifdef HAVE_GD_WBMP /* {{{ proto bool image2wbmp(resource im [, string filename [, int threshold]]) Output WBMP image to browser or file */ PHP_FUNCTION(image2wbmp) @@ -4625,9 +4352,8 @@ PHP_FUNCTION(image2wbmp) _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_CONVERT_WBM, "WBMP", _php_image_bw_convert); } /* }}} */ -#endif /* HAVE_GD_WBMP */ -#if defined(HAVE_GD_JPG) && defined(HAVE_GD_WBMP) +#if defined(HAVE_GD_JPG) /* {{{ proto bool jpeg2wbmp (string f_org, string f_dest, int d_height, int d_width, int threshold) Convert JPEG image to WBMP image */ PHP_FUNCTION(jpeg2wbmp) @@ -4637,7 +4363,7 @@ PHP_FUNCTION(jpeg2wbmp) /* }}} */ #endif -#if defined(HAVE_GD_PNG) && defined(HAVE_GD_WBMP) +#if defined(HAVE_GD_PNG) /* {{{ proto bool png2wbmp (string f_org, string f_dest, int d_height, int d_width, int threshold) Convert PNG image to WBMP image */ PHP_FUNCTION(png2wbmp) @@ -4647,7 +4373,6 @@ PHP_FUNCTION(png2wbmp) /* }}} */ #endif -#ifdef HAVE_GD_WBMP /* {{{ _php_image_bw_convert * It converts a gd Image to bw using a threshold value */ static void _php_image_bw_convert(gdImagePtr im_org, gdIOCtx *out, int threshold) @@ -4694,11 +4419,7 @@ static void _php_image_bw_convert(gdImagePtr im_org, gdIOCtx *out, int threshold gdImageSetPixel (im_dest, x, y, color); } } -#ifdef USE_GD_IOCTX gdImageWBMPCtx (im_dest, black, out); -#else - gdImageWBMP (im_dest, black, out); -#endif } /* }}} */ @@ -4722,9 +4443,7 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type ) int int_threshold; int x, y; float x_ratio, y_ratio; -#ifdef HAVE_GD_JPG long ignore_warning; -#endif if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pplll", &f_org, &f_org_len, &f_dest, &f_dest_len, &height, &width, &threshold) == FAILURE) { return; @@ -4763,7 +4482,6 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type ) } switch (image_type) { -#ifdef HAVE_GD_GIF_READ case PHP_GDIMG_TYPE_GIF: im_org = gdImageCreateFromGif(org); if (im_org == NULL) { @@ -4771,16 +4489,11 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type ) RETURN_FALSE; } break; -#endif /* HAVE_GD_GIF_READ */ #ifdef HAVE_GD_JPG case PHP_GDIMG_TYPE_JPG: ignore_warning = INI_INT("gd.jpeg_ignore_warning"); -#ifdef HAVE_GD_BUNDLED - im_org = gdImageCreateFromJpeg(org, ignore_warning); -#else - im_org = gdImageCreateFromJpeg(org); -#endif + im_org = gdImageCreateFromJpegEx(org, ignore_warning); if (im_org == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open '%s' Not a valid JPEG file", fn_dest); RETURN_FALSE; @@ -4788,7 +4501,6 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type ) break; #endif /* HAVE_GD_JPG */ - #ifdef HAVE_GD_PNG case PHP_GDIMG_TYPE_PNG: im_org = gdImageCreateFromPng(org); @@ -4889,9 +4601,6 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type ) RETURN_TRUE; } /* }}} */ -#endif /* HAVE_GD_WBMP */ - -#endif /* HAVE_LIBGD */ /* Section Filters */ #define PHP_GD_SINGLE_RES \ @@ -5189,26 +4898,6 @@ PHP_FUNCTION(imageconvolution) /* }}} */ /* End section: Filters */ -#ifdef HAVE_GD_BUNDLED -/* {{{ proto bool imageantialias(resource im, bool on) - Should antialiased functions used or not*/ -PHP_FUNCTION(imageantialias) -{ - zval *IM; - zend_bool alias; - gdImagePtr im; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb", &IM, &alias) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd); - gdImageAntialias(im, alias); - RETURN_TRUE; -} -/* }}} */ - - /* {{{ proto void imageflip(resource im, int mode) Flip an image (in place) horizontally, vertically or both directions. */ PHP_FUNCTION(imageflip) @@ -5245,14 +4934,31 @@ PHP_FUNCTION(imageflip) } /* }}} */ +#ifdef HAVE_GD_BUNDLED +/* {{{ proto bool imageantialias(resource im, bool on) + Should antialiased functions used or not*/ +PHP_FUNCTION(imageantialias) +{ + zval *IM; + zend_bool alias; + gdImagePtr im; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb", &IM, &alias) == FAILURE) { + return; + } + + ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd); + gdImageAntialias(im, alias); + RETURN_TRUE; +} +/* }}} */ +#endif + /* {{{ proto void imagecrop(resource im, array rect) Crop an image using the given coordinates and size, x, y, width and height. */ PHP_FUNCTION(imagecrop) { zval *IM; - long mode = -1; - long color = -1; - double threshold = 0.5f; gdImagePtr im; gdImagePtr im_crop; gdRect rect; @@ -5352,13 +5058,10 @@ PHP_FUNCTION(imagecropauto) /* }}} */ /* {{{ proto resource imagescale(resource im, new_width[, new_height[, method]]) - Crop an image using the given coordinates and size, x, y, width and height. */ + Scale an image using the given new width and height. */ PHP_FUNCTION(imagescale) { zval *IM; - long mode = -1; - long color = -1; - double threshold = 0.5f; gdImagePtr im; gdImagePtr im_scaled; int new_width, new_height = -1; @@ -5407,9 +5110,6 @@ finish: PHP_FUNCTION(imageaffine) { zval *IM; - long mode = -1; - long color = -1; - double threshold = 0.5f; gdImagePtr src; gdImagePtr dst; gdRect rect; @@ -5515,7 +5215,7 @@ PHP_FUNCTION(imageaffinematrixget) gdAffineStandardMatrix type; zval *options; zval **tmp; - int res, i; + int res = GD_FALSE, i; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|z", &type, &options) == FAILURE) { return; @@ -5575,9 +5275,13 @@ PHP_FUNCTION(imageaffinematrixget) RETURN_FALSE; } - array_init(return_value); - for (i = 0; i < 6; i++) { - add_index_double(return_value, i, affine[i]); + if (res == GD_FALSE) { + RETURN_FALSE; + } else { + array_init(return_value); + for (i = 0; i < 6; i++) { + add_index_double(return_value, i, affine[i]); + } } } @@ -5671,8 +5375,6 @@ PHP_FUNCTION(imagesetinterpolation) RETURN_BOOL(gdImageSetInterpolationMethod(im, (gdInterpolationMethod) method)); } /* }}} */ -#endif - /* * Local variables: diff --git a/ext/gd/libgd/gd_compat.c b/ext/gd/gd_compat.c index f3627a140..dc6a95ae1 100644 --- a/ext/gd/libgd/gd_compat.c +++ b/ext/gd/gd_compat.c @@ -1,4 +1,5 @@ -#include "php_config.h" +#include "php_config.h" + #ifdef HAVE_GD_PNG /* needs to be first */ # include <png.h> @@ -8,6 +9,9 @@ # include <jpeglib.h> #endif +#include "gd_compat.h" +#include "php.h" + #ifdef HAVE_GD_JPG int gdJpegGetVersionInt() { @@ -20,6 +24,15 @@ const char * gdJpegGetVersionString() case 62: return "6b"; break; + + case 70: + return "7"; + break; + + case 80: + return "8"; + break; + default: return "unknown"; } @@ -33,50 +46,18 @@ const char * gdPngGetVersionString() } #endif -/* Not exported by libgd, copied from gdhelpers.h */ int overflow2(int a, int b) { + TSRMLS_FETCH(); + if(a <= 0 || b <= 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "gd warning: one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully\n"); return 1; } if(a > INT_MAX / b) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully\n"); return 1; } return 0; } -/* Not exported by libgd, copied from wbmp.c */ -int -getmbi (int (*getin) (void *in), void *in) -{ - int i, mbi = 0; - - do - { - i = getin (in); - if (i < 0) - return (-1); - mbi = (mbi << 7) | (i & 0x7f); - } - while (i & 0x80); - - return (mbi); -} - -/* Not exported by libgd, copied from wbmp.c */ -int -skipheader (int (*getin) (void *in), void *in) -{ - int i; - - do - { - i = getin (in); - if (i < 0) - return (-1); - } - while (i & 0x80); - - return (0); -} - diff --git a/ext/gd/gd_compat.h b/ext/gd/gd_compat.h new file mode 100644 index 000000000..db757f598 --- /dev/null +++ b/ext/gd/gd_compat.h @@ -0,0 +1,14 @@ +#ifndef GD_COMPAT_H +#define GD_COMPAT_H 1 + +#ifndef HAVE_GD_BUNDLED +/* from gd_compat.c */ +const char * gdPngGetVersionString(); +const char * gdJpegGetVersionString(); +int gdJpegGetVersionInt(); +#endif + +/* from gd_compat.c of libgd/gd_security.c */ +int overflow2(int a, int b); + +#endif /* GD_COMPAT_H */ diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c index b0e8aa66a..2a0b500e9 100644 --- a/ext/gd/gd_ctx.c +++ b/ext/gd/gd_ctx.c @@ -189,11 +189,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, break; } -#if HAVE_LIBGD204 ctx->gd_free(ctx); -#else - ctx->free(ctx); -#endif RETURN_TRUE; } diff --git a/ext/gd/gdcache.c b/ext/gd/gdcache.c index 231a1f791..2af6737f7 100644 --- a/ext/gd/gdcache.c +++ b/ext/gd/gdcache.c @@ -44,7 +44,7 @@ #else #include <php_config.h> #endif -#if HAVE_LIBFREETYPE && !defined(HAVE_GD_CACHE_CREATE) +#if HAVE_LIBFREETYPE && !defined(HAVE_GD_BUNDLED) #include "gdcache.h" diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c index cb45c0e9c..81eba52c8 100644 --- a/ext/gd/libgd/gd.c +++ b/ext/gd/libgd/gd.c @@ -1958,7 +1958,6 @@ static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc) { int i, l, x1, x2, dy; int oc; /* old pixel value */ - int tiled; int wx2,wy2; /* stack of filled segments */ struct seg *stack; @@ -1970,7 +1969,6 @@ static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc) } wx2=im->sx;wy2=im->sy; - tiled = nc==gdTiled; nc = gdImageTileGet(im,x,y); @@ -2035,7 +2033,6 @@ void gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color) { int x1h = x1, x1v = x1, y1h = y1, y1v = y1, x2h = x2, x2v = x2, y2h = y2, y2v = y2; int thick = im->thick; - int half1 = 1; int t; if (x1 == x2 && y1 == y2 && thick == 1) { @@ -2057,7 +2054,7 @@ void gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color) if (thick > 1) { int cx, cy, x1ul, y1ul, x2lr, y2lr; int half = thick >> 1; - half1 = thick - half; + x1ul = x1 - half; y1ul = y1 - half; @@ -2355,8 +2352,6 @@ void gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int int colorMap[gdMaxColors]; /* Stretch vectors */ int *stx, *sty; - /* We only need to use floating point to determine the correct stretch vector for one line's worth. */ - double accum; if (overflow2(sizeof(int), srcW)) { return; @@ -2367,7 +2362,6 @@ void gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int stx = (int *) gdMalloc (sizeof (int) * srcW); sty = (int *) gdMalloc (sizeof (int) * srcH); - accum = 0; /* Fixed by Mao Morimoto 2.0.16 */ for (i = 0; (i < srcW); i++) { @@ -3017,7 +3011,7 @@ void gdImageGetClip (gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P) int gdImagePaletteToTrueColor(gdImagePtr src) { unsigned int y; - unsigned char alloc_y = 0, alloc_aa = 0; + unsigned char alloc_y = 0; unsigned int yy; if (src == NULL) { diff --git a/ext/gd/libgd/gd.h b/ext/gd/libgd/gd.h index 0bd8ad336..72515108d 100644 --- a/ext/gd/libgd/gd.h +++ b/ext/gd/libgd/gd.h @@ -362,8 +362,12 @@ gdImagePtr gdImageCreateFromPng(FILE *fd); gdImagePtr gdImageCreateFromPngCtx(gdIOCtxPtr in); gdImagePtr gdImageCreateFromWBMP(FILE *inFile); gdImagePtr gdImageCreateFromWBMPCtx(gdIOCtx *infile); -gdImagePtr gdImageCreateFromJpeg(FILE *infile, int ignore_warning); -gdImagePtr gdImageCreateFromJpegCtx(gdIOCtx *infile, int ignore_warning); +gdImagePtr gdImageCreateFromJpeg(FILE *infile); +gdImagePtr gdImageCreateFromJpegEx(FILE *infile, int ignore_warning); +gdImagePtr gdImageCreateFromJpegCtx(gdIOCtx *infile); +gdImagePtr gdImageCreateFromJpegCtxEx(gdIOCtx *infile, int ignore_warning); +gdImagePtr gdImageCreateFromJpegPtr (int size, void *data); +gdImagePtr gdImageCreateFromJpegPtrEx (int size, void *data, int ignore_warning); gdImagePtr gdImageCreateFromWebp(FILE *fd); gdImagePtr gdImageCreateFromWebpCtx(gdIOCtxPtr in); gdImagePtr gdImageCreateFromWebpPtr (int size, void *data); diff --git a/ext/gd/libgd/gd_compat.h b/ext/gd/libgd/gd_compat.h deleted file mode 100644 index e8fedf80c..000000000 --- a/ext/gd/libgd/gd_compat.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef GD_COMPAT_H -#define GD_COMPAT_H 1 - -#if HAVE_GD_BUNDLED -# include "gd.h" -#else -# include <gd.h> -#endif - -const char * gdPngGetVersionString(); -const char * gdJpegGetVersionString(); -int gdJpegGetVersionInt(); -int overflow2(int a, int b); -int getmbi (int (*getin) (void *in), void *in); -int skipheader (int (*getin) (void *in), void *in); - - -/* filters section - * - * Negate the imag src, white becomes black, - * The red, green, and blue intensities of an image are negated. - * White becomes black, yellow becomes blue, etc. - */ -int gdImageNegate(gdImagePtr src); - -/* Convert the image src to a grayscale image */ -int gdImageGrayScale(gdImagePtr src); - -/* Set the brightness level <brightness> for the image src */ -int gdImageBrightness(gdImagePtr src, int brightness); - -/* Set the contrast level <contrast> for the image <src> */ -int gdImageContrast(gdImagePtr src, double contrast); - -/* Simply adds or substracts respectively red, green or blue to a pixel */ -int gdImageColor(gdImagePtr src, const int red, const int green, const int blue, const int alpha); - -#if !defined(HAVE_GD_IMAGE_CONVOLUTION) -/* Image convolution by a 3x3 custom matrix */ -int gdImageConvolution(gdImagePtr src, float ft[3][3], float filter_div, float offset); -int gdImageEdgeDetectQuick(gdImagePtr src); -int gdImageGaussianBlur(gdImagePtr im); -int gdImageSelectiveBlur( gdImagePtr src); -int gdImageEmboss(gdImagePtr im); -int gdImageMeanRemoval(gdImagePtr im); -int gdImageSmooth(gdImagePtr im, float weight); -#endif - -#if !defined(HAVE_GD_IMAGE_PIXELATE) -enum gdPixelateMode { - GD_PIXELATE_UPPERLEFT, - GD_PIXELATE_AVERAGE -}; - -int gdImagePixelate(gdImagePtr im, int block_size, const unsigned int mode); -#endif - -int gdImagePixelate(gdImagePtr im, int block_size, const unsigned int mode); - -#if !HAVE_GD_IMAGEELLIPSE -void gdImageEllipse(gdImagePtr im, int cx, int cy, int w, int h, int c); -#endif - -gdImagePtr gdImageRotate (gdImagePtr src, double dAngle, int clrBack, int ignoretransparent); - -int gdImageColorMatch (gdImagePtr im1, gdImagePtr im2); - -#endif - diff --git a/ext/gd/libgd/gd_interpolation.c b/ext/gd/libgd/gd_interpolation.c index ccdefb9b4..6c5549eba 100644 --- a/ext/gd/libgd/gd_interpolation.c +++ b/ext/gd/libgd/gd_interpolation.c @@ -978,7 +978,7 @@ static inline void _gdScaleRow(gdImagePtr pSrc, unsigned int src_width, gdImage /* Accumulate each channel */ for (i = left; i <= right; i++) { - const left_channel = i - left; + const int left_channel = i - left; r += (unsigned char)(contrib->ContribRow[x].Weights[left_channel] * (double)(gdTrueColorGetRed(p_src_row[i]))); g += (unsigned char)(contrib->ContribRow[x].Weights[left_channel] * (double)(gdTrueColorGetGreen(p_src_row[i]))); b += (unsigned char)(contrib->ContribRow[x].Weights[left_channel] * (double)(gdTrueColorGetBlue(p_src_row[i]))); diff --git a/ext/gd/libgd/gd_jpeg.c b/ext/gd/libgd/gd_jpeg.c index 175c5b85f..a882b28c8 100644 --- a/ext/gd/libgd/gd_jpeg.c +++ b/ext/gd/libgd/gd_jpeg.c @@ -269,21 +269,31 @@ void gdImageJpegCtx (gdImagePtr im, gdIOCtx * outfile, int quality) gdFree (row); } -gdImagePtr gdImageCreateFromJpeg (FILE * inFile, int ignore_warning) +gdImagePtr gdImageCreateFromJpeg (FILE * inFile) +{ + return gdImageCreateFromJpegEx(inFile, 1); +} + +gdImagePtr gdImageCreateFromJpegEx (FILE * inFile, int ignore_warning) { gdImagePtr im; gdIOCtx *in = gdNewFileCtx(inFile); - im = gdImageCreateFromJpegCtx(in, ignore_warning); + im = gdImageCreateFromJpegCtxEx(in, ignore_warning); in->gd_free (in); return im; } -gdImagePtr gdImageCreateFromJpegPtr (int size, void *data, int ignore_warning) +gdImagePtr gdImageCreateFromJpegPtr (int size, void *data) +{ + return gdImageCreateFromJpegPtrEx(size, data, 1); +} + +gdImagePtr gdImageCreateFromJpegPtrEx (int size, void *data, int ignore_warning) { gdImagePtr im; gdIOCtx *in = gdNewDynamicCtxEx(size, data, 0); - im = gdImageCreateFromJpegCtx(in, ignore_warning); + im = gdImageCreateFromJpegCtxEx(in, ignore_warning); in->gd_free(in); return im; @@ -298,7 +308,12 @@ static int CMYKToRGB(int c, int m, int y, int k, int inverted); * Create a gd-format image from the JPEG-format INFILE. Returns the * image, or NULL upon error. */ -gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile, int ignore_warning) +gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile) +{ + return gdImageCreateFromJpegCtxEx(infile, 1); +} + +gdImagePtr gdImageCreateFromJpegCtxEx (gdIOCtx * infile, int ignore_warning) { struct jpeg_decompress_struct cinfo; struct jpeg_error_mgr jerr; diff --git a/ext/gd/php_gd.h b/ext/gd/php_gd.h index 3c60007a7..269c315e8 100644 --- a/ext/gd/php_gd.h +++ b/ext/gd/php_gd.h @@ -22,15 +22,13 @@ #ifndef PHP_GD_H #define PHP_GD_H -#define HAVE_GDIMAGECREATEFROMPNG 1 - #if HAVE_LIBFREETYPE # ifndef ENABLE_GD_TTF # define ENABLE_GD_TTF # endif #endif -#if HAVE_LIBGD +#if defined(HAVE_LIBGD) || defined(HAVE_GD_BUNDLED) /* open_basedir and safe_mode checks */ #define PHP_GD_CHECK_OPEN_BASEDIR(filename, errormsg) \ @@ -69,10 +67,10 @@ extern zend_module_entry gd_module_entry; /* gd.c functions */ PHP_MINFO_FUNCTION(gd); PHP_MINIT_FUNCTION(gd); -#if HAVE_LIBT1 || HAVE_GD_FONTMUTEX +#if HAVE_LIBT1 PHP_MSHUTDOWN_FUNCTION(gd); #endif -#if HAVE_GD_STRINGFT +#if HAVE_GD_FREETYPE && HAVE_LIBFREETYPE PHP_RSHUTDOWN_FUNCTION(gd); #endif @@ -123,9 +121,12 @@ PHP_FUNCTION(imagegrabscreen); PHP_FUNCTION(imagerotate); +PHP_FUNCTION(imageflip); + #ifdef HAVE_GD_BUNDLED PHP_FUNCTION(imageantialias); -PHP_FUNCTION(imageflip); +#endif + PHP_FUNCTION(imagecrop); PHP_FUNCTION(imagecropauto); PHP_FUNCTION(imagescale); @@ -133,7 +134,6 @@ PHP_FUNCTION(imageaffine); PHP_FUNCTION(imageaffinematrixget); PHP_FUNCTION(imageaffinematrixconcat); PHP_FUNCTION(imagesetinterpolation); -#endif PHP_FUNCTION(imagesetthickness); PHP_FUNCTION(imagecopymergegray); @@ -151,7 +151,7 @@ PHP_FUNCTION(imagecreatefromwbmp); PHP_FUNCTION(imagecreatefromgd); PHP_FUNCTION(imagecreatefromgd2); PHP_FUNCTION(imagecreatefromgd2part); -#if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED) +#if defined(HAVE_GD_XPM) PHP_FUNCTION(imagecreatefromxpm); #endif @@ -202,10 +202,8 @@ PHP_FUNCTION(image2wbmp); PHP_FUNCTION(imagecolormatch); -#if HAVE_GD_BUNDLED PHP_FUNCTION(imagelayereffect); PHP_FUNCTION(imagexbm); -#endif PHP_FUNCTION(imagefilter); PHP_FUNCTION(imageconvolution); diff --git a/ext/gd/tests/bug43073.phpt b/ext/gd/tests/bug43073.phpt index 4f448f2b4..8ddd32442 100644 --- a/ext/gd/tests/bug43073.phpt +++ b/ext/gd/tests/bug43073.phpt @@ -33,19 +33,19 @@ imagepng($g, "$cwd/bug43073.png"); --CLEAN-- <?php @unlink(dirname(__FILE__) . '/bug43073.png'); ?> --EXPECTF-- -(500, 402), (610, 402), (610, 376), (500, 376) +(500, 40%d), (610, 40%d), (610, 376), (500, 376) (492, 363), (591, 322), (580, 295), (480, 336) (470, 331), (548, 254), (527, 233), (449, 310) (439, 309), (483, 202), (461, 193), (416, 299) -(401, 300), (401, 183), (381, 183), (381, 300) +(40%d, 300), (40%d, 183), (38%d, 183), (38%d, 300) (362, 307), (316, 195), (291, 205), (337, 318) (330, 329), (246, 244), (224, 265), (308, 350) (308, 360), (202, 316), (190, 344), (296, 388) -(300, 399), (186, 399), (186, 425), (300, 425) +(300, %d), (18%d, %d), (18%d, 425), (%d, 425) (306, 437), (195, 483), (206, 510), (318, 464) (328, 469), (240, 557), (260, 578), (349, 491) (359, 491), (312, 607), (334, 616), (382, 501) -(398, 500), (398, 618), (418, 618), (418, 500) +(%d, 500), (%d, 618), (41%d, 618), (41%d, 500) (436, 493), (483, 607), (507, 597), (461, 482) (468, 471), (555, 558), (577, 538), (490, 450) (490, 440), (600, 485), (611, 457), (502, 412) diff --git a/ext/gd/tests/bug48801.phpt b/ext/gd/tests/bug48801.phpt index fd25541a5..773564f78 100644 --- a/ext/gd/tests/bug48801.phpt +++ b/ext/gd/tests/bug48801.phpt @@ -20,6 +20,6 @@ echo '(' . $bbox[6] . ', ' . $bbox[7] . ")\n"; ?> --EXPECTF-- (-1, 15) -(155, 15) -(155, -48) +(15%d, 15) +(15%d, -48) (-1, -48) diff --git a/ext/gd/tests/imageloadfont_invalid.phpt b/ext/gd/tests/imageloadfont_invalid.phpt index 07bf150ac..6cf0e336b 100644 --- a/ext/gd/tests/imageloadfont_invalid.phpt +++ b/ext/gd/tests/imageloadfont_invalid.phpt @@ -3,7 +3,6 @@ imageloadfont() function crashes --SKIPIF-- <?php if (!extension_loaded('gd')) die("skip gd extension not available\n"); - if (!GD_BUNDLED) die('skip external GD libraries always fail'); ?> --FILE-- <?php diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index 1731bb70f..d14b61682 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -1271,7 +1271,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags php_mysqli_fetch_into_hash_aux(return_value, result, fetchtype TSRMLS_CC); - if (into_object && Z_TYPE_P(return_value) != IS_NULL) { + if (into_object && Z_TYPE_P(return_value) == IS_ARRAY) { zval dataset = *return_value; zend_fcall_info fci; zend_fcall_info_cache fcc; diff --git a/ext/mysqli/tests/bug64726.phpt b/ext/mysqli/tests/bug64726.phpt new file mode 100644 index 000000000..8f24ad09b --- /dev/null +++ b/ext/mysqli/tests/bug64726.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #63398 (Segfault when calling fetch_object on a use_result and DB pointer has closed) +--SKIPIF-- +<?php +require_once('skipif.inc'); +require_once("connect.inc"); +if (!$IS_MYSQLND) { + die("skip mysqlnd only test"); +} +require_once('skipifconnectfailure.inc'); +?> +--FILE-- +<?php +require 'connect.inc'; +$db = new my_mysqli($host, $user, $passwd, $db, $port, $socket); + +$result = $db->query('SELECT 1', MYSQLI_USE_RESULT); +$db->close(); +var_dump($result->fetch_object()); +?> +--EXPECTF-- +Warning: mysqli_result::fetch_object(): Error while reading a row in %sbug64726.php on line %d +bool(false) diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index ccd8af51c..724876e89 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -27,6 +27,7 @@ #include "mysqlnd_statistics.h" #include "mysqlnd_charset.h" #include "mysqlnd_debug.h" +#include "ext/standard/php_smart_str.h" /* TODO : diff --git a/ext/mysqlnd/mysqlnd_result.c b/ext/mysqlnd/mysqlnd_result.c index 7ab7d0016..b4725feb2 100644 --- a/ext/mysqlnd/mysqlnd_result.c +++ b/ext/mysqlnd/mysqlnd_result.c @@ -1479,6 +1479,7 @@ MYSQLND_METHOD(mysqlnd_res, fetch_into)(MYSQLND_RES * result, unsigned int flags mysqlnd_array_init(return_value, mysqlnd_num_fields(result) * 2); if (FAIL == result->m.fetch_row(result, (void *)return_value, flags, &fetched_anything TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error while reading a row"); + zval_dtor(return_value); RETVAL_FALSE; } else if (fetched_anything == FALSE) { zval_dtor(return_value); diff --git a/ext/mysqlnd/mysqlnd_structs.h b/ext/mysqlnd/mysqlnd_structs.h index 55775d97e..99981f7e7 100644 --- a/ext/mysqlnd/mysqlnd_structs.h +++ b/ext/mysqlnd/mysqlnd_structs.h @@ -23,7 +23,7 @@ #ifndef MYSQLND_STRUCTS_H #define MYSQLND_STRUCTS_H -#include "ext/standard/php_smart_str.h" +#include "ext/standard/php_smart_str_public.h" #define MYSQLND_TYPEDEFED_METHODS diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c index 4dbb7c568..b8c381406 100644 --- a/ext/opcache/Optimizer/block_pass.c +++ b/ext/opcache/Optimizer/block_pass.c @@ -1257,14 +1257,15 @@ static void assemble_code_blocks(zend_cfg *cfg, zend_op_array *op_array) } cur_block = cur_block->next; } -#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO - if (opline[-1].opcode == ZEND_THROW) { + + if ((opline-1)->opcode == ZEND_THROW) { /* if we finished with THROW, we need to add space between THROW and HANDLE to not confuse zend_throw_internal */ MAKE_NOP(opline); opline->lineno = opline[-1].lineno; opline++; } +#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO MAKE_NOP(opline); opline->opcode = ZEND_HANDLE_EXCEPTION; opline->lineno = opline[-1].lineno; diff --git a/ext/opcache/Optimizer/zend_optimizer_internal.h b/ext/opcache/Optimizer/zend_optimizer_internal.h index 0097496df..a9bad01be 100644 --- a/ext/opcache/Optimizer/zend_optimizer_internal.h +++ b/ext/opcache/Optimizer/zend_optimizer_internal.h @@ -26,7 +26,7 @@ #if ZEND_EXTENSION_API_NO > PHP_5_4_X_API_NO
# define VAR_NUM(v) ((zend_uint)(EX_TMP_VAR_NUM(0, 0) - EX_TMP_VAR(0, v)))
-# define NUM_VAR(v) ((zend_uint)EX_TMP_VAR_NUM(0, v))
+# define NUM_VAR(v) ((zend_uint)(zend_uintptr_t)EX_TMP_VAR_NUM(0, v))
#else
# define VAR_NUM(v) ((v)/(sizeof(temp_variable)))
# define NUM_VAR(v) ((v)*(sizeof(temp_variable)))
diff --git a/ext/snmp/config.m4 b/ext/snmp/config.m4 index ccb7eea9a..9c0b82f77 100644 --- a/ext/snmp/config.m4 +++ b/ext/snmp/config.m4 @@ -59,67 +59,6 @@ if test "$PHP_SNMP" != "no"; then $SNMP_SHARED_LIBADD ]) - dnl Check for buggy snmp_snprint_value() (net-snmp BUGid 2027834) - AC_CACHE_CHECK([for buggy snmp_snprint_value], ac_cv_buggy_snprint_value,[ - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -I${SNMP_PREFIX}/include $SNMP_SHARED_LIBADD" - AC_TRY_RUN( [ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <net-snmp/net-snmp-config.h> -#include <net-snmp/net-snmp-includes.h> - -u_char uname[] = "Linux nex1.php.net 2.6.18-194.32.1.el5 #1 SMP Wed Jan 5 17:53:09 EST 2011 i686"; - -int main(int argc, char **argv) -{ - struct variable_list vars; - char buf1[2048]; - char buf2[sizeof(buf1)]; - - memset(&(buf1[0]), 0, sizeof(buf1)); - memset(&(buf2[0]), 0, sizeof(buf2)); - memset(&vars, 0, sizeof(vars)); - vars.type = 4; - vars.val.integer = (long *)&(uname[0]); - vars.val.string = &(uname[0]); - vars.val.bitstring = &(uname[0]); - vars.val.counter64 = (struct counter64 *)&(uname[0]); - vars.val.floatVal = (float *)&(uname[0]); - vars.val_len = sizeof(uname), - vars.name_loc[0] = 1; - vars.name_loc[1] = 3; - vars.name_loc[2] = 6; - vars.name_loc[3] = 1; - vars.name_loc[4] = 2; - vars.name_loc[5] = 1; - vars.name_loc[6] = 1; - vars.name_loc[7] = 1; - vars.name = (oid *)&(vars.name_loc); - vars.name_length = 9; - - init_snmp("snmpapp"); - - netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT, 0); - - snprint_value(buf1, (sizeof(uname) + 32), vars.name, vars.name_length, &vars); - snprint_value(buf2, sizeof(buf2), vars.name, vars.name_length, &vars); - exit((strncmp(buf1, buf2, sizeof(buf1)) != 0)); -} - ],[ - ac_cv_buggy_snprint_value=no - ],[ - ac_cv_buggy_snprint_value=yes - ],[ - ac_cv_buggy_snprint_value=no - ]) - CFLAGS="$save_CFLAGS" - ]) - if test "$ac_cv_buggy_snprint_value" = "yes"; then - AC_DEFINE(BUGGY_SNMPRINT_VALUE, 1, [ ]) - fi - PHP_NEW_EXTENSION(snmp, snmp.c, $ext_shared) PHP_SUBST(SNMP_SHARED_LIBADD) fi diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index 9789638c6..47e2d43f5 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -80,14 +80,6 @@ #include <net-snmp/net-snmp-config.h> #include <net-snmp/net-snmp-includes.h> -#if PHP_VERSION_ID < 50300 -#define Z_ADDREF_P(pz) pz->refcount++ -#define Z_ISREF_PP(oid) (PZVAL_IS_REF(*(oid))) -#define Z_REFCOUNT_P(pz) pz->refcount -#define Z_SET_REFCOUNT_P(pz, rc) pz->refcount = rc -#define zend_parse_parameters_none() zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") -#endif - /* For net-snmp prior to 5.4 */ #ifndef HAVE_SHUTDOWN_SNMP_LOGGING extern netsnmp_log_handler *logh_head; @@ -497,9 +489,6 @@ static void php_snmp_object_free_storage(void *object TSRMLS_DC) static zend_object_value php_snmp_object_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */ { -#if PHP_VERSION_ID < 50399 - zval *tmp; -#endif zend_object_value retval; php_snmp_object *intern; @@ -508,11 +497,7 @@ static zend_object_value php_snmp_object_new(zend_class_entry *class_type TSRMLS memset(&intern->zo, 0, sizeof(php_snmp_object)); zend_object_std_init(&intern->zo, class_type TSRMLS_CC); -#if PHP_VERSION_ID < 50399 - zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &tmp, sizeof(zval *)); -#else object_properties_init(&intern->zo, class_type); -#endif retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) php_snmp_object_free_storage, NULL TSRMLS_CC); retval.handlers = (zend_object_handlers *) &php_snmp_object_handlers; @@ -566,35 +551,60 @@ static void php_snmp_error(zval *object, const char *docref TSRMLS_DC, int type, static void php_snmp_getvalue(struct variable_list *vars, zval *snmpval TSRMLS_DC, int valueretrieval) { zval *val; -#ifdef BUGGY_SNMPRINT_VALUE - char sbuf[2048]; -#else - char sbuf[64]; -#endif + char sbuf[512]; char *buf = &(sbuf[0]); char *dbuf = (char *)NULL; int buflen = sizeof(sbuf) - 1; int val_len = vars->val_len; - if ((valueretrieval & SNMP_VALUE_PLAIN) == 0) { - val_len += 32; /* snprint_value will add type info into value, make some space for it */ + /* use emalloc() for large values, use static array otherwize */ + + /* There is no way to know the size of buffer snprint_value() needs in order to print a value there. + * So we are forced to probe it + */ + while ((valueretrieval & SNMP_VALUE_PLAIN) == 0) { + *buf = '\0'; + if (snprint_value(buf, buflen, vars->name, vars->name_length, vars) == -1) { + if (val_len > 512*1024) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "snprint_value() asks for a buffer more than 512k, Net-SNMP bug?"); + break; + } + /* buffer is not long enough to hold full output, double it */ + val_len *= 2; + } else { + break; + } + + if (buf == dbuf) { + dbuf = (char *)erealloc(dbuf, val_len + 1); + } else { + dbuf = (char *)emalloc(val_len + 1); + } + + if (!dbuf) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "emalloc() failed: %s, fallback to static buffer", strerror(errno)); + buf = &(sbuf[0]); + buflen = sizeof(sbuf) - 1; + break; + } + + buf = dbuf; + buflen = val_len; } - /* use emalloc() for large values, use static array otherwize */ - if(val_len > buflen){ + if((valueretrieval & SNMP_VALUE_PLAIN) && val_len > buflen){ if ((dbuf = (char *)emalloc(val_len + 1))) { buf = dbuf; buflen = val_len; } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "emalloc() failed: %s, fallback to static array", strerror(errno)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "emalloc() failed: %s, fallback to static buffer", strerror(errno)); } } - *buf = 0; - MAKE_STD_ZVAL(val); if (valueretrieval & SNMP_VALUE_PLAIN) { + *buf = 0; switch (vars->type) { case ASN_BIT_STR: /* 0x03, asn1.h */ ZVAL_STRINGL(val, (char *)vars->val.bitstring, vars->val_len, 1); @@ -667,7 +677,7 @@ static void php_snmp_getvalue(struct variable_list *vars, zval *snmpval TSRMLS_D break; } } else /* use Net-SNMP value translation */ { - snprint_value(buf, buflen, vars->name, vars->name_length, vars); + /* we have desired string in buffer, just use it */ ZVAL_STRING(val, buf, 1); } @@ -1177,9 +1187,10 @@ static int netsnmp_session_init(php_snmp_session **session_p, int version, char continue; } if ((*res)->sa_family == AF_INET6) { - strcpy(session->peername, "udp6:"); + strcpy(session->peername, "udp6:["); pptr = session->peername + strlen(session->peername); inet_ntop((*res)->sa_family, &(((struct sockaddr_in6*)(*res))->sin6_addr), pptr, MAX_NAME_LEN); + strcat(pptr, "]"); } else if ((*res)->sa_family == AF_INET) { inet_ntop((*res)->sa_family, &(((struct sockaddr_in*)(*res))->sin_addr), pptr, MAX_NAME_LEN); } else { @@ -1775,11 +1786,7 @@ PHP_FUNCTION(snmp_read_mib) char *filename; int filename_len; -#if PHP_VERSION_ID < 50399 - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { -#else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) { -#endif RETURN_FALSE; } @@ -1804,31 +1811,17 @@ PHP_METHOD(snmp, __construct) long retries = SNMP_DEFAULT_RETRIES; long version = SNMP_DEFAULT_VERSION; int argc = ZEND_NUM_ARGS(); -#if PHP_VERSION_ID > 50300 zend_error_handling error_handling; -#endif snmp_object = (php_snmp_object *)zend_object_store_get_object(object TSRMLS_CC); -#if PHP_VERSION_ID > 50300 zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); -#else - php_set_error_handling(EH_THROW, zend_exception_get_default(TSRMLS_C) TSRMLS_CC); -#endif if (zend_parse_parameters(argc TSRMLS_CC, "lss|ll", &version, &a1, &a1_len, &a2, &a2_len, &timeout, &retries) == FAILURE) { -#if PHP_VERSION_ID > 50300 zend_restore_error_handling(&error_handling TSRMLS_CC); -#else - php_std_error_handling(); -#endif return; } -#if PHP_VERSION_ID > 50300 zend_restore_error_handling(&error_handling TSRMLS_CC); -#else - php_std_error_handling(); -#endif switch(version) { case SNMP_VERSION_1: @@ -1976,11 +1969,7 @@ void php_snmp_add_property(HashTable *h, const char *name, size_t name_length, p /* {{{ php_snmp_read_property(zval *object, zval *member, int type[, const zend_literal *key]) Generic object property reader */ -#if PHP_VERSION_ID < 50399 -zval *php_snmp_read_property(zval *object, zval *member, int type TSRMLS_DC) -#else zval *php_snmp_read_property(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC) -#endif { zval tmp_member; zval *retval; @@ -2010,11 +1999,7 @@ zval *php_snmp_read_property(zval *object, zval *member, int type, const zend_li } } else { zend_object_handlers * std_hnd = zend_get_std_object_handlers(); -#if PHP_VERSION_ID < 50399 - retval = std_hnd->read_property(object, member, type TSRMLS_CC); -#else retval = std_hnd->read_property(object, member, type, key TSRMLS_CC); -#endif } if (member == &tmp_member) { @@ -2026,11 +2011,7 @@ zval *php_snmp_read_property(zval *object, zval *member, int type, const zend_li /* {{{ php_snmp_write_property(zval *object, zval *member, zval *value[, const zend_literal *key]) Generic object property writer */ -#if PHP_VERSION_ID < 50399 -void php_snmp_write_property(zval *object, zval *member, zval *value TSRMLS_DC) -#else void php_snmp_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC) -#endif { zval tmp_member; php_snmp_object *obj; @@ -2057,11 +2038,7 @@ void php_snmp_write_property(zval *object, zval *member, zval *value, const zend } } else { zend_object_handlers * std_hnd = zend_get_std_object_handlers(); -#if PHP_VERSION_ID < 50399 - std_hnd->write_property(object, member, value TSRMLS_CC); -#else std_hnd->write_property(object, member, value, key TSRMLS_CC); -#endif } if (member == &tmp_member) { @@ -2072,11 +2049,7 @@ void php_snmp_write_property(zval *object, zval *member, zval *value, const zend /* {{{ php_snmp_has_property(zval *object, zval *member, int has_set_exists[, const zend_literal *key]) Generic object property checker */ -#if PHP_VERSION_ID < 50399 -static int php_snmp_has_property(zval *object, zval *member, int has_set_exists TSRMLS_DC) -#else static int php_snmp_has_property(zval *object, zval *member, int has_set_exists, const zend_literal *key TSRMLS_DC) -#endif { php_snmp_prop_handler *hnd; int ret = 0; @@ -2087,11 +2060,7 @@ static int php_snmp_has_property(zval *object, zval *member, int has_set_exists, ret = 1; break; case 0: { -#if PHP_VERSION_ID < 50399 - zval *value = php_snmp_read_property(object, member, BP_VAR_IS TSRMLS_CC); -#else zval *value = php_snmp_read_property(object, member, BP_VAR_IS, key TSRMLS_CC); -#endif if (value != EG(uninitialized_zval_ptr)) { ret = Z_TYPE_P(value) != IS_NULL? 1:0; /* refcount is 0 */ @@ -2101,11 +2070,7 @@ static int php_snmp_has_property(zval *object, zval *member, int has_set_exists, break; } default: { -#if PHP_VERSION_ID < 50399 - zval *value = php_snmp_read_property(object, member, BP_VAR_IS TSRMLS_CC); -#else zval *value = php_snmp_read_property(object, member, BP_VAR_IS, key TSRMLS_CC); -#endif if (value != EG(uninitialized_zval_ptr)) { convert_to_boolean(value); ret = Z_BVAL_P(value)? 1:0; @@ -2118,11 +2083,7 @@ static int php_snmp_has_property(zval *object, zval *member, int has_set_exists, } } else { zend_object_handlers * std_hnd = zend_get_std_object_handlers(); -#if PHP_VERSION_ID < 50399 - ret = std_hnd->has_property(object, member, has_set_exists TSRMLS_CC); -#else ret = std_hnd->has_property(object, member, has_set_exists, key TSRMLS_CC); -#endif } return ret; } @@ -2142,11 +2103,7 @@ static HashTable *php_snmp_get_properties(zval *object TSRMLS_DC) ulong num_key; obj = (php_snmp_object *)zend_objects_get_address(object TSRMLS_CC); -#if PHP_VERSION_ID < 50399 - props = obj->zo.properties; -#else props = zend_std_get_properties(object TSRMLS_CC); -#endif zend_hash_internal_pointer_reset_ex(&php_snmp_properties, &pos); diff --git a/ext/snmp/tests/README b/ext/snmp/tests/README index 819a50d8a..0db1a4f82 100644 --- a/ext/snmp/tests/README +++ b/ext/snmp/tests/README @@ -35,6 +35,8 @@ On Linux/FreeBSD Before launching daemon make sure that there is no file /var/net-snmp/snmpd.conf Delete it if exists. Ingoring to to so will fail SNMPv3 tests. +- Place bigtest.sh near snmpd.conf, tune path to it in snmpd.conf + - Launch snmpd (service snmpd start or /etc/init.d/snmpd start). Alternatively you can start snmpd daemon using following command line: sudo snmpd -C -c ./snmpd.conf -f -Le diff --git a/ext/snmp/tests/bigtest.sh b/ext/snmp/tests/bigtest.sh new file mode 100755 index 000000000..d0d8be783 --- /dev/null +++ b/ext/snmp/tests/bigtest.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +Q=""; +i=0; +while [ $i -lt 32 ]; do + Q="${Q}\3\2\4\11\22\13\14\15\16\17\20\21\22\23\24\25\26\27"; + i=$((i+1)); +done + +printf "${Q}" diff --git a/ext/snmp/tests/bug64159.phpt b/ext/snmp/tests/bug64159.phpt new file mode 100644 index 000000000..51b159952 --- /dev/null +++ b/ext/snmp/tests/bug64159.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #64159: Truncated snmpget +--CREDITS-- +Boris Lytochkin +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--ENV-- +MIBS=noneXistent +--FILE-- +<?php +require_once(dirname(__FILE__).'/snmp_include.inc'); + +snmp_set_quick_print(false); +snmp_set_valueretrieval(SNMP_VALUE_LIBRARY); + +var_dump(("ab8283f948419b2d24d22f44a80b17d3" === md5(snmpget($hostname, $community, '.1.3.6.1.4.1.2021.8.1.101.2')))); + +?> +--EXPECTF-- +MIB search path: %s +Cannot find module (noneXistent): At line %d in (%s) +bool(true) diff --git a/ext/snmp/tests/snmp-object.phpt b/ext/snmp/tests/snmp-object.phpt index 522d417af..40567dae9 100644 --- a/ext/snmp/tests/snmp-object.phpt +++ b/ext/snmp/tests/snmp-object.phpt @@ -90,12 +90,6 @@ array_shift($z); var_dump(key($z)); array_shift($z); var_dump(key($z)); -array_shift($z); -var_dump(key($z)); -array_shift($z); -var_dump(key($z)); -array_shift($z); -var_dump(key($z)); var_dump($session->close()); echo "SNMPv3 (default security settings)\n"; @@ -211,9 +205,6 @@ string(3) "2.0" string(3) "3.0" string(3) "4.0" string(3) "5.0" -string(3) "6.0" -string(3) "7.0" -string(3) "8.0" bool(true) SNMPv3 (default security settings) string(%d) "%S" diff --git a/ext/snmp/tests/snmpd.conf b/ext/snmp/tests/snmpd.conf index 3e9137294..5297d0b9e 100644 --- a/ext/snmp/tests/snmpd.conf +++ b/ext/snmp/tests/snmpd.conf @@ -23,3 +23,5 @@ createUser adminMD5DES MD5 test1234 DES test1234 createUser noAuthUser authuser read noAuthUser noauth + +exec HexTest /bin/sh /etc/snmp/bigtest.sh diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index d83b85e63..7a109c196 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -162,6 +162,7 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph zval **proxy_host, **proxy_port, **tmp; char *host; char *name; + char *protocol; long namelen; int port; int old_error_reporting; @@ -189,7 +190,41 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph old_error_reporting = EG(error_reporting); EG(error_reporting) &= ~(E_WARNING|E_NOTICE|E_USER_WARNING|E_USER_NOTICE); - namelen = spprintf(&name, 0, "%s://%s:%d", (use_ssl && !*use_proxy)? "ssl" : "tcp", host, port); + /* Changed ternary operator to an if/else so that additional comparisons can be done on the ssl_method property */ + if (use_ssl && !*use_proxy) { + if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_ssl_method", sizeof("_ssl_method"), (void **) &tmp) == SUCCESS && + Z_TYPE_PP(tmp) == IS_LONG) { + /* uses contants declared in soap.c to determine ssl uri protocol */ + switch (Z_LVAL_PP(tmp)) { + case SOAP_SSL_METHOD_TLS: + protocol = "tls"; + break; + + case SOAP_SSL_METHOD_SSLv2: + protocol = "sslv2"; + break; + + case SOAP_SSL_METHOD_SSLv3: + protocol = "sslv3"; + break; + + case SOAP_SSL_METHOD_SSLv23: + protocol = "ssl"; + break; + + default: + protocol = "ssl"; + break; + + } + } else { + protocol = "ssl"; + } + } else { + protocol = "tcp"; + } + + namelen = spprintf(&name, 0, "%s://%s:%d", protocol, host, port); stream = php_stream_xport_create(name, namelen, REPORT_ERRORS, @@ -237,7 +272,34 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph } /* enable SSL transport layer */ if (stream) { - if (php_stream_xport_crypto_setup(stream, STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL TSRMLS_CC) < 0 || + /* if a stream is created without encryption, check to see if SSL method parameter is specified and use + proper encrypyion method based on constants defined in soap.c */ + int crypto_method = STREAM_CRYPTO_METHOD_SSLv23_CLIENT; + if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_ssl_method", sizeof("_ssl_method"), (void **) &tmp) == SUCCESS && + Z_TYPE_PP(tmp) == IS_LONG) { + switch (Z_LVAL_PP(tmp)) { + case SOAP_SSL_METHOD_TLS: + crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT; + break; + + case SOAP_SSL_METHOD_SSLv2: + crypto_method = STREAM_CRYPTO_METHOD_SSLv2_CLIENT; + break; + + case SOAP_SSL_METHOD_SSLv3: + crypto_method = STREAM_CRYPTO_METHOD_SSLv3_CLIENT; + break; + + case SOAP_SSL_METHOD_SSLv23: + crypto_method = STREAM_CRYPTO_METHOD_SSLv23_CLIENT; + break; + + default: + crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT; + break; + } + } + if (php_stream_xport_crypto_setup(stream, crypto_method, NULL TSRMLS_CC) < 0 || php_stream_xport_crypto_enable(stream, 1 TSRMLS_CC) < 0) { php_stream_close(stream); stream = NULL; diff --git a/ext/soap/php_soap.h b/ext/soap/php_soap.h index 0e37db5d4..7d0a3c16f 100644 --- a/ext/soap/php_soap.h +++ b/ext/soap/php_soap.h @@ -149,6 +149,13 @@ struct _soapService { #define WSDL_CACHE_MEMORY 0x2 #define WSDL_CACHE_BOTH 0x3 +/* New SOAP SSL Method Constants */ +#define SOAP_SSL_METHOD_TLS 0 +#define SOAP_SSL_METHOD_SSLv2 1 +#define SOAP_SSL_METHOD_SSLv3 2 +#define SOAP_SSL_METHOD_SSLv23 3 + + ZEND_BEGIN_MODULE_GLOBALS(soap) HashTable defEncNs; /* mapping of default namespaces to prefixes */ HashTable defEnc; diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 7df84e5b2..cabe5c068 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -753,6 +753,12 @@ PHP_MINIT_FUNCTION(soap) REGISTER_LONG_CONSTANT("WSDL_CACHE_MEMORY", WSDL_CACHE_MEMORY, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("WSDL_CACHE_BOTH", WSDL_CACHE_BOTH, CONST_CS | CONST_PERSISTENT); + /* New SOAP SSL Method Constants */ + REGISTER_LONG_CONSTANT("SOAP_SSL_METHOD_TLS", SOAP_SSL_METHOD_TLS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOAP_SSL_METHOD_SSLv2", SOAP_SSL_METHOD_SSLv2, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOAP_SSL_METHOD_SSLv3", SOAP_SSL_METHOD_SSLv3, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOAP_SSL_METHOD_SSLv23", SOAP_SSL_METHOD_SSLv23, CONST_CS | CONST_PERSISTENT); + old_error_handler = zend_error_cb; zend_error_cb = soap_error_handler; @@ -2497,6 +2503,11 @@ PHP_METHOD(SoapClient, SoapClient) (Z_TYPE_PP(tmp) == IS_BOOL || Z_TYPE_PP(tmp) == IS_LONG) && Z_LVAL_PP(tmp) == 0) { add_property_long(this_ptr, "_keep_alive", 0); } + + if (zend_hash_find(ht, "ssl_method", sizeof("ssl_method"), (void**)&tmp) == SUCCESS && + Z_TYPE_PP(tmp) == IS_LONG) { + add_property_long(this_ptr, "_ssl_method", Z_LVAL_PP(tmp)); + } } else if (Z_TYPE_P(wsdl) == IS_NULL) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "'location' and 'uri' options are required in nonWSDL mode"); } diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 21c55e404..209cb7f9b 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -601,7 +601,6 @@ static int stream_array_to_fd_set(zval *stream_array, fd_set *fds, php_socket_t { zval **elem; php_stream *stream; - php_socket_t this_fd; int cnt = 0; if (Z_TYPE_P(stream_array) != IS_ARRAY) { @@ -611,6 +610,11 @@ static int stream_array_to_fd_set(zval *stream_array, fd_set *fds, php_socket_t zend_hash_get_current_data(Z_ARRVAL_P(stream_array), (void **) &elem) == SUCCESS; zend_hash_move_forward(Z_ARRVAL_P(stream_array))) { + /* Temporary int fd is needed for the STREAM data type on windows, passing this_fd directly to php_stream_cast() + would eventually bring a wrong result on x64. php_stream_cast() casts to int internally, and this will leave + the higher bits of a SOCKET variable uninitialized on systems with little endian. */ + int tmp_fd; + php_stream_from_zval_no_verify(stream, elem); if (stream == NULL) { continue; @@ -620,7 +624,9 @@ static int stream_array_to_fd_set(zval *stream_array, fd_set *fds, php_socket_t * when casting. It is only used here so that the buffered data warning * is not displayed. * */ - if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, (void*)&this_fd, 1) && this_fd != -1) { + if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, (void*)&tmp_fd, 1) && tmp_fd != -1) { + + php_socket_t this_fd = (php_socket_t)tmp_fd; PHP_SAFE_FD_SET(this_fd, fds); @@ -638,7 +644,6 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC) zval **elem, **dest_elem; php_stream *stream; HashTable *new_hash; - php_socket_t this_fd; int ret = 0; if (Z_TYPE_P(stream_array) != IS_ARRAY) { @@ -655,6 +660,11 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC) char *key; uint key_len; ulong num_ind; + /* Temporary int fd is needed for the STREAM data type on windows, passing this_fd directly to php_stream_cast() + would eventually bring a wrong result on x64. php_stream_cast() casts to int internally, and this will leave + the higher bits of a SOCKET variable uninitialized on systems with little endian. */ + int tmp_fd; + type = zend_hash_get_current_key_ex(Z_ARRVAL_P(stream_array), &key, &key_len, &num_ind, 0, NULL); @@ -672,7 +682,10 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC) * when casting. It is only used here so that the buffered data warning * is not displayed. */ - if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, (void*)&this_fd, 1) && this_fd != -1) { + if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, (void*)&tmp_fd, 1) && tmp_fd != -1) { + + php_socket_t this_fd = (php_socket_t)tmp_fd; + if (PHP_SAFE_FD_ISSET(this_fd, fds)) { if (type == HASH_KEY_IS_LONG) { zend_hash_index_update(new_hash, num_ind, (void *)elem, sizeof(zval *), (void **)&dest_elem); diff --git a/ext/standard/tests/file/bug24482.phpt b/ext/standard/tests/file/bug24482.phpt index f545f1add..9d0568af3 100644 --- a/ext/standard/tests/file/bug24482.phpt +++ b/ext/standard/tests/file/bug24482.phpt @@ -8,6 +8,11 @@ if (!function_exists("glob")) { ?> --FILE-- <?php + +// run this test in ext/standard/tests (see bug #64714) +chdir(__DIR__); // ensure in ext/standard/tests/file +chdir('..'); // move up to ext/standard/tests + $globdirs = glob("*", GLOB_ONLYDIR); $dirs = array(); diff --git a/ext/standard/tests/streams/bug64770.phpt b/ext/standard/tests/streams/bug64770.phpt new file mode 100644 index 000000000..785c4237a --- /dev/null +++ b/ext/standard/tests/streams/bug64770.phpt @@ -0,0 +1,52 @@ +--TEST-- +Bug #64770 stream_select() fails with pipes from proc_open() +--FILE-- +<?php + +$descs = array( + 0 => array('pipe', 'r'), // stdin + 1 => array('pipe', 'w'), // stdout + 2 => array('pipe', 'w'), // strerr +); + +$other_opts = array('suppress_errors' => false, 'binary_pipes' => true); + +$cmd = (substr(PHP_OS, 0, 3) == 'WIN') ? 'dir' : 'ls'; +$p = proc_open($cmd, $descs, $pipes, '.', NULL, $other_opts); + +if (is_resource($p)) { + $data = ''; + + while (1) { + $w = $e = NULL; + $n = stream_select($pipes, $w, $e, 300); + + if ($n === false) { + echo "no streams \n"; + break; + } else if ($n === 0) { + echo "process timed out\n"; + proc_terminate($p, 9); + break; + } else if ($n > 0) { + $line = fread($pipes[1], 8192); + if (strlen($line) == 0) { + /* EOF */ + break; + } + $data .= $line; + } + } + var_dump(strlen($data)); + + $ret = proc_close($p); + var_dump($ret); +} else { + echo "no process\n"; +} +?> +==DONE== +--EXPECTF-- +int(%d) +int(0) +==DONE== diff --git a/ext/zlib/tests/bug_52944-win.phpt b/ext/zlib/tests/bug_52944-win.phpt deleted file mode 100644 index fa369f8fb..000000000 --- a/ext/zlib/tests/bug_52944-win.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -Bug #52944 (segfault with zlib filter and corrupted data) ---SKIPIF-- -<?php if (!extension_loaded("zlib")) print "skip"; ?> -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die("skip windows only"); -} ---INI-- -allow_url_fopen=1 ---FILE-- -<?php -require dirname(__FILE__) . "/bug_52944_corrupted_data.inc"; - -$fp = fopen('data://text/plain;base64,' . $data, 'r'); -stream_filter_append($fp, 'zlib.inflate', STREAM_FILTER_READ); -var_dump(fread($fp,1)); -var_dump(fread($fp,1)); -fclose($fp); -echo "Done.\n"; ---EXPECT-- -string(1) "%" -string(1) "C" -Done. diff --git a/ext/zlib/tests/bug_52944.phpt b/ext/zlib/tests/bug_52944.phpt index ed4af3e15..ff82d29cc 100644 --- a/ext/zlib/tests/bug_52944.phpt +++ b/ext/zlib/tests/bug_52944.phpt @@ -3,9 +3,6 @@ Bug #52944 (segfault with zlib filter and corrupted data) --SKIPIF-- <?php if (!extension_loaded("zlib")) print "skip"; ?> <?php -if (substr(PHP_OS, 0, 3) == 'WIN') { - die("skip not for windows"); -} if (PHP_OS == 'Darwin') { die("skip not for Darwin"); } @@ -13,6 +10,10 @@ if (PHP_OS == 'Darwin') { allow_url_fopen=1 --FILE-- <?php +/* NOTE this test can fail on asm builds of zlib 1.2.5 or + 1.2.7 on at least Windows and Darwin. Using unoptimized + zlib build fixes the issue. */ + require dirname(__FILE__) . "/bug_52944_corrupted_data.inc"; $fp = fopen('data://text/plain;base64,' . $data, 'r'); diff --git a/main/php_config.h.in b/main/php_config.h.in index a20b2b391..8abbabf88 100644 --- a/main/php_config.h.in +++ b/main/php_config.h.in @@ -25,9 +25,6 @@ #undef BETHREADS /* */ -#undef BUGGY_SNMPRINT_VALUE - -/* */ #undef CDB_INCLUDE_FILE /* Define if system uses EBCDIC */ @@ -517,9 +514,6 @@ /* */ #undef HAVE_CODBC -/* */ -#undef HAVE_COLORCLOSESTHWB - /* Whether you have a Continuity Server */ #undef HAVE_CONTINUITY @@ -714,52 +708,13 @@ #undef HAVE_GCVT /* */ -#undef HAVE_GDIMAGECOLORRESOLVE - -/* */ #undef HAVE_GD_BUNDLED /* */ #undef HAVE_GD_CACHE_CREATE /* */ -#undef HAVE_GD_DYNAMIC_CTX_EX - -/* */ -#undef HAVE_GD_FONTCACHESHUTDOWN - -/* */ -#undef HAVE_GD_FONTMUTEX - -/* */ -#undef HAVE_GD_FREEFONTCACHE - -/* */ -#undef HAVE_GD_GD2 - -/* */ -#undef HAVE_GD_GIF_CREATE - -/* */ -#undef HAVE_GD_GIF_CTX - -/* */ -#undef HAVE_GD_GIF_READ - -/* */ -#undef HAVE_GD_IMAGEELLIPSE - -/* */ -#undef HAVE_GD_IMAGESETBRUSH - -/* */ -#undef HAVE_GD_IMAGESETTILE - -/* */ -#undef HAVE_GD_IMAGE_CONVOLUTION - -/* */ -#undef HAVE_GD_IMAGE_PIXELATE +#undef HAVE_GD_FREETYPE /* */ #undef HAVE_GD_JPG @@ -768,24 +723,9 @@ #undef HAVE_GD_PNG /* */ -#undef HAVE_GD_STRINGFT - -/* */ -#undef HAVE_GD_STRINGFTEX - -/* */ -#undef HAVE_GD_STRINGTTF - -/* */ -#undef HAVE_GD_WBMP - -/* */ #undef HAVE_GD_WEBP /* */ -#undef HAVE_GD_XBM - -/* */ #undef HAVE_GD_XPM /* Define if you have the getaddrinfo function */ @@ -1056,18 +996,6 @@ #undef HAVE_LIBGD /* */ -#undef HAVE_LIBGD13 - -/* */ -#undef HAVE_LIBGD15 - -/* */ -#undef HAVE_LIBGD20 - -/* */ -#undef HAVE_LIBGD204 - -/* */ #undef HAVE_LIBICONV /* */ diff --git a/main/php_version.h b/main/php_version.h index 944a8998c..510ba3dc1 100644 --- a/main/php_version.h +++ b/main/php_version.h @@ -3,6 +3,6 @@ #define PHP_MAJOR_VERSION 5 #define PHP_MINOR_VERSION 5 #define PHP_RELEASE_VERSION 0 -#define PHP_EXTRA_VERSION "beta4" -#define PHP_VERSION "5.5.0beta4" +#define PHP_EXTRA_VERSION "RC1" +#define PHP_VERSION "5.5.0RC1" #define PHP_VERSION_ID 50500 diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index 25e2cc43a..0a8a0e37e 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -540,12 +540,17 @@ static char *fpm_conf_set_array(zval *key, zval *value, void **config, int conve kv->key = strdup(Z_STRVAL_P(key)); if (!kv->key) { + free(kv); return "fpm_conf_set_array: strdup(key) failed"; } if (convert_to_bool) { char *err = fpm_conf_set_boolean(value, &subconf, 0); - if (err) return err; + if (err) { + free(kv->key); + free(kv); + return err; + } kv->value = strdup(b ? "1" : "0"); } else { kv->value = strdup(Z_STRVAL_P(value)); @@ -556,6 +561,7 @@ static char *fpm_conf_set_array(zval *key, zval *value, void **config, int conve if (!kv->value) { free(kv->key); + free(kv); return "fpm_conf_set_array: strdup(value) failed"; } @@ -578,6 +584,7 @@ static void *fpm_worker_pool_config_alloc() /* {{{ */ wp->config = malloc(sizeof(struct fpm_worker_pool_config_s)); if (!wp->config) { + fpm_worker_pool_free(wp); return 0; } @@ -1002,7 +1009,7 @@ static int fpm_conf_process_all_pools() /* {{{ */ nb_ext = 0; /* find the number of extensions */ - while ((ext = strtok(limit_extensions, " \t"))) { + while (strtok(limit_extensions, " \t")) { limit_extensions = NULL; nb_ext++; } @@ -1024,8 +1031,8 @@ static int fpm_conf_process_all_pools() /* {{{ */ nb_ext = 0; /* parse the string and save the extension in the array */ - while ((ext = strtok(security_limit_extensions, " \t"))) { - security_limit_extensions = NULL; + while ((ext = strtok(limit_extensions, " \t"))) { + limit_extensions = NULL; wp->limit_extensions[nb_ext++] = strdup(ext); } @@ -1107,6 +1114,7 @@ int fpm_conf_write_pid() /* {{{ */ if (len != write(fd, buf, len)) { zlog(ZLOG_SYSERROR, "Unable to write to the PID file."); + close(fd); return -1; } close(fd); @@ -1460,6 +1468,7 @@ int fpm_conf_load_ini_file(char *filename TSRMLS_DC) /* {{{ */ if (ini_recursion++ > 4) { zlog(ZLOG_ERROR, "failed to include more than 5 files recusively"); + close(fd); return -1; } diff --git a/sapi/fpm/fpm/fpm_log.c b/sapi/fpm/fpm/fpm_log.c index 6b014b500..4e1a057db 100644 --- a/sapi/fpm/fpm/fpm_log.c +++ b/sapi/fpm/fpm/fpm_log.c @@ -57,7 +57,9 @@ int fpm_log_open(int reopen) /* {{{ */ wp->log_fd = fd; } - fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC); + if (0 > fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC)) { + zlog(ZLOG_WARNING, "failed to change attribute of access_log"); + } } return ret; @@ -237,7 +239,7 @@ int fpm_log_write(char *log_format TSRMLS_DC) /* {{{ */ case 'f': /* script */ if (!test) { - len2 = snprintf(b, FPM_LOG_BUFFER - len, "%s", proc.script_filename && *proc.script_filename ? proc.script_filename : "-"); + len2 = snprintf(b, FPM_LOG_BUFFER - len, "%s", *proc.script_filename ? proc.script_filename : "-"); } break; @@ -249,7 +251,7 @@ int fpm_log_write(char *log_format TSRMLS_DC) /* {{{ */ case 'm': /* method */ if (!test) { - len2 = snprintf(b, FPM_LOG_BUFFER - len, "%s", proc.request_method && *proc.request_method ? proc.request_method : "-"); + len2 = snprintf(b, FPM_LOG_BUFFER - len, "%s", *proc.request_method ? proc.request_method : "-"); } break; @@ -347,19 +349,19 @@ int fpm_log_write(char *log_format TSRMLS_DC) /* {{{ */ case 'q': /* query_string */ if (!test) { - len2 = snprintf(b, FPM_LOG_BUFFER - len, "%s", proc.query_string ? proc.query_string : ""); + len2 = snprintf(b, FPM_LOG_BUFFER - len, "%s", proc.query_string); } break; case 'Q': /* '?' */ if (!test) { - len2 = snprintf(b, FPM_LOG_BUFFER - len, "%s", proc.query_string && *proc.query_string ? "?" : ""); + len2 = snprintf(b, FPM_LOG_BUFFER - len, "%s", *proc.query_string ? "?" : ""); } break; case 'r': /* request URI */ if (!test) { - len2 = snprintf(b, FPM_LOG_BUFFER - len, "%s", proc.request_uri ? proc.request_uri : "-"); + len2 = snprintf(b, FPM_LOG_BUFFER - len, "%s", proc.request_uri); } break; @@ -397,7 +399,7 @@ int fpm_log_write(char *log_format TSRMLS_DC) /* {{{ */ case 'u': /* remote user */ if (!test) { - len2 = snprintf(b, FPM_LOG_BUFFER - len, "%s", proc.auth_user ? proc.auth_user : "-"); + len2 = snprintf(b, FPM_LOG_BUFFER - len, "%s", proc.auth_user); } break; diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index 61088c465..043e0e00a 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -1098,7 +1098,7 @@ static void init_request_info(TSRMLS_D) #define APACHE_PROXY_FCGI_PREFIX "proxy:fcgi://" /* Fix proxy URLs in SCRIPT_FILENAME generated by Apache mod_proxy_fcgi: - * proxy:fcgi://localhost:9000/some-dir/info.php/test + * proxy:fcgi://localhost:9000/some-dir/info.php/test?foo=bar * should be changed to: * /some-dir/info.php/test * See: http://bugs.php.net/bug.php?id=54152 @@ -1118,6 +1118,11 @@ static void init_request_info(TSRMLS_D) memmove(env_script_filename, p, strlen(p) + 1); apache_was_here = 1; } + /* ignore query string if sent by Apache (RewriteRule) */ + p = strchr(env_script_filename, '?'); + if (p) { + *p =0; + } } if (CGIG(fix_pathinfo)) { @@ -1173,119 +1178,123 @@ static void init_request_info(TSRMLS_D) int len = script_path_translated_len; char *ptr; - while ((ptr = strrchr(pt, '/')) || (ptr = strrchr(pt, '\\'))) { - *ptr = 0; - if (stat(pt, &st) == 0 && S_ISREG(st.st_mode)) { - /* - * okay, we found the base script! - * work out how many chars we had to strip off; - * then we can modify PATH_INFO - * accordingly - * - * we now have the makings of - * PATH_INFO=/test - * SCRIPT_FILENAME=/docroot/info.php - * - * we now need to figure out what docroot is. - * if DOCUMENT_ROOT is set, this is easy, otherwise, - * we have to play the game of hide and seek to figure - * out what SCRIPT_NAME should be - */ - int ptlen = strlen(pt); - int slen = len - ptlen; - int pilen = env_path_info ? strlen(env_path_info) : 0; - int tflag = 0; - char *path_info; - if (apache_was_here) { - /* recall that PATH_INFO won't exist */ - path_info = script_path_translated + ptlen; - tflag = (slen != 0 && (!orig_path_info || strcmp(orig_path_info, path_info) != 0)); - } else { - path_info = env_path_info ? env_path_info + pilen - slen : NULL; - tflag = (orig_path_info != path_info); - } + if (pt) { + while ((ptr = strrchr(pt, '/')) || (ptr = strrchr(pt, '\\'))) { + *ptr = 0; + if (stat(pt, &st) == 0 && S_ISREG(st.st_mode)) { + /* + * okay, we found the base script! + * work out how many chars we had to strip off; + * then we can modify PATH_INFO + * accordingly + * + * we now have the makings of + * PATH_INFO=/test + * SCRIPT_FILENAME=/docroot/info.php + * + * we now need to figure out what docroot is. + * if DOCUMENT_ROOT is set, this is easy, otherwise, + * we have to play the game of hide and seek to figure + * out what SCRIPT_NAME should be + */ + int ptlen = strlen(pt); + int slen = len - ptlen; + int pilen = env_path_info ? strlen(env_path_info) : 0; + int tflag = 0; + char *path_info; + if (apache_was_here) { + /* recall that PATH_INFO won't exist */ + path_info = script_path_translated + ptlen; + tflag = (slen != 0 && (!orig_path_info || strcmp(orig_path_info, path_info) != 0)); + } else { + path_info = env_path_info ? env_path_info + pilen - slen : NULL; + tflag = (orig_path_info != path_info); + } - if (tflag) { - if (orig_path_info) { - char old; - - _sapi_cgibin_putenv("ORIG_PATH_INFO", orig_path_info TSRMLS_CC); - old = path_info[0]; - path_info[0] = 0; - if (!orig_script_name || - strcmp(orig_script_name, env_path_info) != 0) { - if (orig_script_name) { - _sapi_cgibin_putenv("ORIG_SCRIPT_NAME", orig_script_name TSRMLS_CC); + if (tflag) { + if (orig_path_info) { + char old; + + _sapi_cgibin_putenv("ORIG_PATH_INFO", orig_path_info TSRMLS_CC); + old = path_info[0]; + path_info[0] = 0; + if (!orig_script_name || + strcmp(orig_script_name, env_path_info) != 0) { + if (orig_script_name) { + _sapi_cgibin_putenv("ORIG_SCRIPT_NAME", orig_script_name TSRMLS_CC); + } + SG(request_info).request_uri = _sapi_cgibin_putenv("SCRIPT_NAME", env_path_info TSRMLS_CC); + } else { + SG(request_info).request_uri = orig_script_name; } - SG(request_info).request_uri = _sapi_cgibin_putenv("SCRIPT_NAME", env_path_info TSRMLS_CC); - } else { - SG(request_info).request_uri = orig_script_name; + path_info[0] = old; } - path_info[0] = old; + env_path_info = _sapi_cgibin_putenv("PATH_INFO", path_info TSRMLS_CC); } - env_path_info = _sapi_cgibin_putenv("PATH_INFO", path_info TSRMLS_CC); - } - if (!orig_script_filename || - strcmp(orig_script_filename, pt) != 0) { - if (orig_script_filename) { - _sapi_cgibin_putenv("ORIG_SCRIPT_FILENAME", orig_script_filename TSRMLS_CC); - } - script_path_translated = _sapi_cgibin_putenv("SCRIPT_FILENAME", pt TSRMLS_CC); - } - TRANSLATE_SLASHES(pt); - - /* figure out docroot - * SCRIPT_FILENAME minus SCRIPT_NAME - */ - if (env_document_root) { - int l = strlen(env_document_root); - int path_translated_len = 0; - char *path_translated = NULL; - - if (l && env_document_root[l - 1] == '/') { - --l; + if (!orig_script_filename || + strcmp(orig_script_filename, pt) != 0) { + if (orig_script_filename) { + _sapi_cgibin_putenv("ORIG_SCRIPT_FILENAME", orig_script_filename TSRMLS_CC); + } + script_path_translated = _sapi_cgibin_putenv("SCRIPT_FILENAME", pt TSRMLS_CC); } + TRANSLATE_SLASHES(pt); - /* we have docroot, so we should have: - * DOCUMENT_ROOT=/docroot - * SCRIPT_FILENAME=/docroot/info.php + /* figure out docroot + * SCRIPT_FILENAME minus SCRIPT_NAME */ + if (env_document_root) { + int l = strlen(env_document_root); + int path_translated_len = 0; + char *path_translated = NULL; - /* PATH_TRANSLATED = DOCUMENT_ROOT + PATH_INFO */ - path_translated_len = l + (env_path_info ? strlen(env_path_info) : 0); - path_translated = (char *) emalloc(path_translated_len + 1); - memcpy(path_translated, env_document_root, l); - if (env_path_info) { - memcpy(path_translated + l, env_path_info, (path_translated_len - l)); - } - path_translated[path_translated_len] = '\0'; - if (orig_path_translated) { - _sapi_cgibin_putenv("ORIG_PATH_TRANSLATED", orig_path_translated TSRMLS_CC); - } - env_path_translated = _sapi_cgibin_putenv("PATH_TRANSLATED", path_translated TSRMLS_CC); - efree(path_translated); - } else if ( env_script_name && - strstr(pt, env_script_name) - ) { - /* PATH_TRANSLATED = PATH_TRANSLATED - SCRIPT_NAME + PATH_INFO */ - int ptlen = strlen(pt) - strlen(env_script_name); - int path_translated_len = ptlen + (env_path_info ? strlen(env_path_info) : 0); - char *path_translated = NULL; - - path_translated = (char *) emalloc(path_translated_len + 1); - memcpy(path_translated, pt, ptlen); - if (env_path_info) { - memcpy(path_translated + ptlen, env_path_info, path_translated_len - ptlen); - } - path_translated[path_translated_len] = '\0'; - if (orig_path_translated) { - _sapi_cgibin_putenv("ORIG_PATH_TRANSLATED", orig_path_translated TSRMLS_CC); + if (l && env_document_root[l - 1] == '/') { + --l; + } + + /* we have docroot, so we should have: + * DOCUMENT_ROOT=/docroot + * SCRIPT_FILENAME=/docroot/info.php + */ + + /* PATH_TRANSLATED = DOCUMENT_ROOT + PATH_INFO */ + path_translated_len = l + (env_path_info ? strlen(env_path_info) : 0); + path_translated = (char *) emalloc(path_translated_len + 1); + memcpy(path_translated, env_document_root, l); + if (env_path_info) { + memcpy(path_translated + l, env_path_info, (path_translated_len - l)); + } + path_translated[path_translated_len] = '\0'; + if (orig_path_translated) { + _sapi_cgibin_putenv("ORIG_PATH_TRANSLATED", orig_path_translated TSRMLS_CC); + } + env_path_translated = _sapi_cgibin_putenv("PATH_TRANSLATED", path_translated TSRMLS_CC); + efree(path_translated); + } else if ( env_script_name && + strstr(pt, env_script_name) + ) { + /* PATH_TRANSLATED = PATH_TRANSLATED - SCRIPT_NAME + PATH_INFO */ + int ptlen = strlen(pt) - strlen(env_script_name); + int path_translated_len = ptlen + (env_path_info ? strlen(env_path_info) : 0); + char *path_translated = NULL; + + path_translated = (char *) emalloc(path_translated_len + 1); + memcpy(path_translated, pt, ptlen); + if (env_path_info) { + memcpy(path_translated + ptlen, env_path_info, path_translated_len - ptlen); + } + path_translated[path_translated_len] = '\0'; + if (orig_path_translated) { + _sapi_cgibin_putenv("ORIG_PATH_TRANSLATED", orig_path_translated TSRMLS_CC); + } + env_path_translated = _sapi_cgibin_putenv("PATH_TRANSLATED", path_translated TSRMLS_CC); + efree(path_translated); } - env_path_translated = _sapi_cgibin_putenv("PATH_TRANSLATED", path_translated TSRMLS_CC); - efree(path_translated); + break; } - break; } + } else { + ptr = NULL; } if (!ptr) { /* diff --git a/sapi/fpm/fpm/fpm_signals.c b/sapi/fpm/fpm/fpm_signals.c index 8993a860a..c5d0692f1 100644 --- a/sapi/fpm/fpm/fpm_signals.c +++ b/sapi/fpm/fpm/fpm_signals.c @@ -145,7 +145,9 @@ static void sig_soft_quit(int signo) /* {{{ */ /* closing fastcgi listening socket will force fcgi_accept() exit immediately */ close(0); - socket(AF_UNIX, SOCK_STREAM, 0); + if (0 > socket(AF_UNIX, SOCK_STREAM, 0)) { + zlog(ZLOG_WARNING, "failed to create a new socket"); + } fpm_php_soft_quit(); errno = saved_errno; } diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c index 76759e7f2..f959cf36d 100644 --- a/sapi/fpm/fpm/fpm_sockets.c +++ b/sapi/fpm/fpm/fpm_sockets.c @@ -167,7 +167,7 @@ static int fpm_sockets_new_listening_socket(struct fpm_worker_pool_s *wp, struct { int flags = 1; int sock; - mode_t saved_umask; + mode_t saved_umask = 0; sock = socket(sa->sa_family, SOCK_STREAM, 0); @@ -176,11 +176,14 @@ static int fpm_sockets_new_listening_socket(struct fpm_worker_pool_s *wp, struct return -1; } - setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &flags, sizeof(flags)); + if (0 > setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &flags, sizeof(flags))) { + zlog(ZLOG_WARNING, "failed to change socket attribute"); + } if (wp->listen_address_domain == FPM_AF_UNIX) { if (fpm_socket_unix_test_connect((struct sockaddr_un *)sa, socklen) == 0) { zlog(ZLOG_ERROR, "An another FPM instance seems to already listen on %s", ((struct sockaddr_un *) sa)->sun_path); + close(sock); return -1; } unlink( ((struct sockaddr_un *) sa)->sun_path); @@ -192,6 +195,7 @@ static int fpm_sockets_new_listening_socket(struct fpm_worker_pool_s *wp, struct if (wp->listen_address_domain == FPM_AF_UNIX) { umask(saved_umask); } + close(sock); return -1; } @@ -203,6 +207,7 @@ static int fpm_sockets_new_listening_socket(struct fpm_worker_pool_s *wp, struct if (wp->socket_uid != -1 || wp->socket_gid != -1) { if (0 > chown(path, wp->socket_uid, wp->socket_gid)) { zlog(ZLOG_SYSERROR, "failed to chown() the socket '%s'", wp->config->listen_address); + close(sock); return -1; } } @@ -210,6 +215,7 @@ static int fpm_sockets_new_listening_socket(struct fpm_worker_pool_s *wp, struct if (0 > listen(sock, wp->config->listen_backlog)) { zlog(ZLOG_SYSERROR, "failed to listen to address '%s'", wp->config->listen_address); + close(sock); return -1; } diff --git a/sapi/fpm/fpm/fpm_stdio.c b/sapi/fpm/fpm/fpm_stdio.c index 6a587d00e..10b867d00 100644 --- a/sapi/fpm/fpm/fpm_stdio.c +++ b/sapi/fpm/fpm/fpm_stdio.c @@ -34,6 +34,7 @@ int fpm_stdio_init_main() /* {{{ */ if (0 > dup2(fd, STDIN_FILENO) || 0 > dup2(fd, STDOUT_FILENO)) { zlog(ZLOG_SYSERROR, "failed to init stdio: dup2()"); + close(fd); return -1; } close(fd); @@ -294,7 +295,9 @@ int fpm_stdio_open_error_log(int reopen) /* {{{ */ zlog_set_fd(fpm_globals.error_log_fd); } } - fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC); + if (0 > fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC)) { + zlog(ZLOG_WARNING, "failed to change attribute of error_log"); + } return 0; } /* }}} */ diff --git a/sapi/fpm/fpm/fpm_worker_pool.c b/sapi/fpm/fpm/fpm_worker_pool.c index 123f9893f..ebe1866c8 100644 --- a/sapi/fpm/fpm/fpm_worker_pool.c +++ b/sapi/fpm/fpm/fpm_worker_pool.c @@ -18,6 +18,21 @@ struct fpm_worker_pool_s *fpm_worker_all_pools; +void fpm_worker_pool_free(struct fpm_worker_pool_s *wp) /* {{{ */ +{ + if (wp->config) { + free(wp->config); + } + if (wp->user) { + free(wp->user); + } + if (wp->home) { + free(wp->home); + } + free(wp); +} +/* }}} */ + static void fpm_worker_pool_cleanup(int which, void *arg) /* {{{ */ { struct fpm_worker_pool_s *wp, *wp_next; @@ -29,10 +44,7 @@ static void fpm_worker_pool_cleanup(int which, void *arg) /* {{{ */ if ((which & FPM_CLEANUP_CHILD) == 0 && fpm_globals.parent_pid == getpid()) { fpm_scoreboard_free(wp->scoreboard); } - free(wp->config); - free(wp->user); - free(wp->home); - free(wp); + fpm_worker_pool_free(wp); } fpm_worker_all_pools = NULL; } diff --git a/sapi/fpm/fpm/fpm_worker_pool.h b/sapi/fpm/fpm/fpm_worker_pool.h index 6688e6d3b..05c993de4 100644 --- a/sapi/fpm/fpm/fpm_worker_pool.h +++ b/sapi/fpm/fpm/fpm_worker_pool.h @@ -45,6 +45,7 @@ struct fpm_worker_pool_s { }; struct fpm_worker_pool_s *fpm_worker_pool_alloc(); +void fpm_worker_pool_free(struct fpm_worker_pool_s *wp); int fpm_worker_pool_init_main(); extern struct fpm_worker_pool_s *fpm_worker_all_pools; diff --git a/tests/basic/req60524-win.phpt b/tests/basic/req60524-win.phpt new file mode 100644 index 000000000..b2e7cfdab --- /dev/null +++ b/tests/basic/req60524-win.phpt @@ -0,0 +1,13 @@ +--TEST-- +Req #60524 (Specify temporary directory) +--INI-- +sys_temp_dir=C:\Windows +--SKIPIF-- +<?php +if( substr(PHP_OS, 0, 3) != "WIN" ) + die('skip Run only on Windows'); +?> +--FILE-- +<?php echo sys_get_temp_dir(); ?> +--EXPECT-- +C:\\Windows diff --git a/tests/basic/req60524.phpt b/tests/basic/req60524.phpt index 6803e1fd8..7cc3edfab 100644 --- a/tests/basic/req60524.phpt +++ b/tests/basic/req60524.phpt @@ -2,6 +2,12 @@ Req #60524 (Specify temporary directory) --INI-- sys_temp_dir=/path/to/temp/dir +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip non-windows only test'); +} +?> --FILE-- <?php echo sys_get_temp_dir(); ?> --EXPECT-- diff --git a/win32/build/libs_version.txt b/win32/build/libs_version.txt index 81c25720a..096d723a9 100644 --- a/win32/build/libs_version.txt +++ b/win32/build/libs_version.txt @@ -20,6 +20,6 @@ libtidy-20090325 libtidy-20090406 libxslt-1.1.27 libxml-2.7.8 -libxml-2.9.0 +libxml-2.9.1 openssl-0.9.8y openssl-1.0.1e |
