Bug #74779 [Ver->Csd]: x() and y() truncating floats to integers

From: Date: Fri, 05 Feb 2021 12:13:08 +0000
Subject: Bug #74779 [Ver->Csd]: x() and y() truncating floats to integers
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231957@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74779&edit=1

 ID:                 74779
 Updated by:         cmb@php.net
 Reported by:        yunosh@php.net
 Summary:            x() and y() truncating floats to integers
-Status:             Verified
+Status:             Closed
 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:

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


Previous Comments:
------------------------------------------------------------------------
[2021-02-04 13:54:27] 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

------------------------------------------------------------------------
[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)

« previous php.bugs (#231957) next »