Bug #74779 [PATCH]: x() and y() truncating floats to integers
Edit report at https://bugs.php.net/bug.php?id=74779&edit=1
ID: 74779
Patch added by: cmb@php.net
Reported by: yunosh@php.net
Summary: x() and y() truncating floats to integers
Status: Verified
Type: Bug
Package: MySQLi related
Operating System: Linux
PHP Version: 7.0Git-2017-06-19 (Git)
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
The following pull request has been associated:
Patch Name: Fix #74779: x() and y() truncating floats to integers
On GitHub: https://github.com/php/php-src/pull/6665
Patch: https://github.com/php/php-src/pull/6665.patch
Previous Comments:
------------------------------------------------------------------------
[2017-09-22 18:57:46] seb35 at seb35 dot fr
Related To: Bug #69348
------------------------------------------------------------------------
[2017-06-19 08:54:31] yunosh@php.net
Description:
------------
When retrieving spatial coordinates from a point column using the x() and y() sql functions, the
mysqli fetch_array(MYSQLI_ASSOC) method return integers instead of floats if using the
MYSQLI_OPT_INT_AND_FLOAT_NATIVE option and locale that don't have a fullstop as decimal
separator.
Test script:
---------------
setlocale(LC_ALL, "de_DE.UTF-8");
$m = new mysqli();
$m->options(MYSQLI_OPT_INT_AND_FLOAT_NATIVE, true);
$result = $m->query("SELECT Y(Point(56.7, 53.34))");
var_dump($result->fetch_array(MYSQLI_ASSOC));
Expected result:
----------------
array(1) {
'Y(Point(56.7, 53.34))' =>
double(53.34)
}
Actual result:
--------------
array(1) {
'Y(Point(56.7, 53.34))' =>
double(53)
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74779&edit=1
Thread (4 messages)