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: 2021-02-04 13:47 UTC
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: cmb (profile)
Status: Closed Package: MySQLi related
PHP Version: 7.0Git-2017-06-19 (Git) OS: Linux
Private report: No CVE-ID: None
 [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

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-02-04 13:47 UTC] cmb@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2021-02-04 13:54 UTC] cmb@php.net
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
 [2021-02-05 12:13 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=3f8d21b9226493365cbb9f913322f5da6965c974
Log: Fix #74779: x() and y() truncating floats to integers
 [2021-02-05 12:13 UTC] cmb@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 15:01:29 2024 UTC