|
| 1 | +--TEST-- |
| 2 | +Bug #74779 (x() and y() truncating floats to integers) |
| 3 | +--SKIPIF-- |
| 4 | +<?php |
| 5 | +require_once('skipif.inc'); |
| 6 | +require_once('skipifconnectfailure.inc'); |
| 7 | +if (!setlocale(LC_NUMERIC, "de_DE", "de_DE.UTF-8", "de-DE")) die('skip locale not available'); |
| 8 | +?> |
| 9 | +--FILE-- |
| 10 | +<?php |
| 11 | +require_once("connect.inc"); |
| 12 | + |
| 13 | +if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { |
| 14 | + printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", |
| 15 | + $host, $user, $db, $port, $socket); |
| 16 | +} |
| 17 | + |
| 18 | +if (!setlocale(LC_NUMERIC, "de_DE", "de_DE.UTF-8", "de-DE")) { |
| 19 | + echo "[002] Cannot set locale\n"; |
| 20 | +} |
| 21 | + |
| 22 | +if (!$link->options(MYSQLI_OPT_INT_AND_FLOAT_NATIVE, true)) { |
| 23 | + printf("[003] [%d] %s\n", $link->errno, $link->error); |
| 24 | +} |
| 25 | + |
| 26 | +if (!$result = $link->query("SELECT Y(Point(56.7, 53.34))")) { |
| 27 | + printf("[004] [%d] %s\n", $link->errno, $link->error); |
| 28 | +} |
| 29 | + |
| 30 | +if (!$array = $result->fetch_array(MYSQLI_ASSOC)) { |
| 31 | + printf("[005] [%d] %s\n", $link->errno, $link->error); |
| 32 | +} |
| 33 | + |
| 34 | +var_dump($array); |
| 35 | + |
| 36 | +mysqli_close($link); |
| 37 | +?> |
| 38 | +--EXPECT-- |
| 39 | +array(1) { |
| 40 | + ["Y(Point(56.7, 53.34))"]=> |
| 41 | + float(53,34) |
| 42 | +} |
0 commit comments