]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-5.5' into PHP-5.6
authorKeyur Govande <keyur@php.net>
Fri, 15 Aug 2014 23:47:06 +0000 (23:47 +0000)
committerKeyur Govande <keyur@php.net>
Fri, 15 Aug 2014 23:47:06 +0000 (23:47 +0000)
* 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

1  2 
ext/mysqli/tests/mysqli_change_user.phpt
ext/mysqli/tests/mysqli_change_user_oo.phpt
ext/mysqlnd/config9.m4
ext/mysqlnd/mysqlnd_ps_codec.c

index 7a4530f0d543c6d049a40dab629c62eab3ef34bb,3bfb9ebf7d11a83afe16319b8acd32ddca17d35b..09009a1368bed2d2da8ff075580c4c9a9414301b
@@@ -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 (!$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 (!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 (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);
  
index 0e08b977af94db43f29c8dd6af3afd2248c70d83,deda4414c4642e30b9fb0e26efd0af488e75fcda..78e1bf1df0e795ef45d8940e7f8525e6dc2c66fc
@@@ -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 <sys/types.h>
 -#endif
 -#ifdef HAVE_STDINT_H
 -#include <stdint.h>
 -#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 <stdio.h>
+ 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
Simple merge