php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74779 x() and y() truncating floats to integers
Submitted: 2017-06-19 08:54 UTC Modified: -
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: yunosh@php.net Assigned:
Status: Open Package: MySQLi related
PHP Version: 7.0Git-2017-06-19 (Git) OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2017-06-19 08:54 UTC] 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)
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Aug 21 13:01:35 2019 UTC