From: Keyur Govande Date: Fri, 15 Aug 2014 23:47:06 +0000 (+0000) Subject: Merge branch 'PHP-5.5' into PHP-5.6 X-Git-Tag: PRE_64BIT_BRANCH_MERGE~50^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=032dee4982f16363e648a52fa79073cb4519efa1;p=php Merge branch 'PHP-5.5' into PHP-5.6 * PHP-5.5: Update NEWS Fix another failing test Add NEWS Fix failing tests Patch for bug #67839 (mysqli does not handle 4-byte floats correctly) Conflicts: ext/mysqli/tests/mysqli_change_user.phpt --- 032dee4982f16363e648a52fa79073cb4519efa1 diff --cc ext/mysqli/tests/mysqli_change_user.phpt index 7a4530f0d5,3bfb9ebf7d..09009a1368 --- a/ext/mysqli/tests/mysqli_change_user.phpt +++ b/ext/mysqli/tests/mysqli_change_user.phpt @@@ -32,22 -32,49 +32,46 @@@ require_once('skipifconnectfailure.inc' printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); - if (false !== ($tmp = mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db))) + if (false !== ($tmp = @mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db))) printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp); - if (false !== ($tmp = mysqli_change_user($link, $user, $passwd . '_unknown_really', $db))) - printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[008] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); - if (false !== ($tmp = mysqli_change_user($link, $user, $passwd, $db . '_unknown_really'))) + if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd . '_unknown_really', $db))) printf("[009] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + // Reconnect because after 3 failed change_user attempts, the server blocks you off. if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) - printf("[010] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", ++ printf("[009a] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); + if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1')) + printf("[010] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var')) + printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + mysqli_free_result($res); + if (1 != $tmp['test_var']) + printf("[012] Cannot set test variable\n"); + + if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, $db))) + printf("[013] Expecting true, got %s/%s\n", gettype($tmp), $tmp); + + if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user')) + printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_assoc($res); + mysqli_free_result($res); + + if (substr($tmp['user'], 0, strlen($user)) !== $user) + printf("[015] Expecting user %s, got user() %s\n", $user, $tmp['user']); + if ($tmp['dbname'] != $db) + printf("[016] Expecting database %s, got database() %s\n", $db, $tmp['dbname']); + - if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var')) - printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - mysqli_free_result($res); - if (NULL !== $tmp['test_var']) - printf("[019] Test variable is still set!\n"); + if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd, $db . '_unknown_really'))) + printf("[011] Expecting false, got %s/%s\n", gettype($tmp), $tmp); mysqli_close($link); diff --cc ext/mysqlnd/config9.m4 index 0e08b977af,deda4414c4..78e1bf1df0 --- a/ext/mysqlnd/config9.m4 +++ b/ext/mysqlnd/config9.m4 @@@ -48,4 -48,42 +48,30 @@@ f if test "$PHP_MYSQLND" != "no" || test "$PHP_MYSQLND_ENABLED" = "yes" || test "$PHP_MYSQLI" != "no"; then PHP_ADD_BUILD_DIR([ext/mysqlnd], 1) - - dnl This creates a file so it has to be after above macros - PHP_CHECK_TYPES([int8 uint8 int16 uint16 int32 uint32 uchar ulong int8_t uint8_t int16_t uint16_t int32_t uint32_t int64_t uint64_t], [ - ext/mysqlnd/php_mysqlnd_config.h - ],[ -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_STDINT_H -#include -#endif - ]) fi + + dnl + dnl Check if the compiler supports Decimal32/64/128 types from the IEEE-754 2008 version + dnl References: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1657.pdf + dnl http://speleotrove.com/decimal/ + dnl + AC_CACHE_CHECK([whether whether compiler supports Decimal32/64/128 types], ac_cv_decimal_fp_supported,[ + AC_TRY_RUN( [ + #include + + int main(int argc, char **argv) { + typedef float dec32 __attribute__((mode(SD))); + dec32 k = 99.49f; + double d2 = (double)k; + return 0; + } + ],[ + ac_cv_decimal_fp_supported=yes + ],[ + ac_cv_decimal_fp_supported=no + ],[ + ac_cv_decimal_fp_supported=no + ])]) + if test "$ac_cv_decimal_fp_supported" = "yes"; then + AC_DEFINE(HAVE_DECIMAL_FP_SUPPORT, 1, [Define if the compiler supports Decimal32/64/128 types.]) + fi