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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: yunosh@php.net
New email:
PHP Version: OS:

 

 [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

Pull Requests

Pull requests:

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 Dec 21 16:01:28 2024 UTC