Bug #69590 [NEW]: OCI extension: oci_field_scale returns 0 for float expression

From: Date: Thu, 07 May 2015 06:55:03 +0000
Subject: Bug #69590 [NEW]: OCI extension: oci_field_scale returns 0 for float expression
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-192545@lists.php.net to get a copy of this message
From:             vavra at 602 dot cz
Operating system: Windows7 32bit
PHP version:      5.6.8
Package:          *General Issues
Bug Type:         Bug
Bug description:OCI extension: oci_field_scale returns 0 for float expression

Description:
------------
Lets consider this table
 create table test_division(a number, b number);
with values
 insert into test_division values (21, 2);  
and this query
 select a, b, a/b division, 21/2 constant_division from test_division
leads to result in our system
{
  'A' =>
  double(21)
  'B' =>
  double(2)
  'DIVISION' =>
  int(10)
  'CONSTANT_DIVISION' =>
  double(10.5)
}

The problem is that oci_field_scale(., 'DIVISION') returns 0. (Note: for
'CONSTANT_DIVISION' returns -127). In our system we decide according to
the oci_field_scale result, if to call intval or floatval on column
value. OCI driver returns always string values and we need to convert
them.

Oracle version is Oracle Database 11g Enterprise Edition Release
11.2.0.1.0 - 64bit Production, Windows.

Expected result:
----------------
oci_field_scale(., 'DIVISION') should return 1, or -127 (as says
documentation: For FLOAT columns, precision is nonzero and scale is
-127.)

Actual result:
--------------
0

-- 
Edit bug report at https://bugs.php.net/bug.php?id=69590&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=69590&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=69590&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=69590&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=69590&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=69590&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=69590&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=69590&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=69590&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=69590&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=69590&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=69590&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=69590&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=69590&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69590&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=69590&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=69590&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=69590&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69590&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=69590&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=69590&r=mysqlcfg



Thread (4 messages)

« previous php.bugs (#192545) next »