From:             arhip at goldentele dot com
Operating system: Linux
PHP version:      5.0.2
PHP Bug Type:     OCI8 related
Bug description:  oci_fetch_* set's filed value to "false"

Description:
------------
I have Oracle 8.1.7 working on linux. Some Oracle params:
NLS_RDBMS_VERSION => 8.1.7.2.0
NLS_CHARACTERSET => CL8ISO8859P5

I have table named utf8_test.
SQL> desc utf8_test;
Name Type         Nullable Default Comments 
---- ------------ -------- ------- -------- 
ID   NUMBER       Y                         
NAME VARCHAR2(10) Y                         

SQL> select * from utf8_test;

        ID NAME
---------- ----------
         1 ����
         2 ��������

The result of fetching data is depended from NLS_LANG.

When I fetched data from this table a result is depended from NLS_LANG
variable.

1) When I fetch data with NLS_LANG=RUSSIAN_CIS.CL8MSWIN1251 character set,
I receive 2 rows with correct data.

2) When I fetch data with NLS_LANG=RUSSIAN_CIS.UTF8 character set, I
receive 2 rows,  with incorrect data. Data in NAME field in 2-nd row is
incorrect (FALSE instead of '��������'). But 1-st row is correct.


I think the problem maybe in the folowing:
This field is defined in database as varchar2(10);
Length of the 1-st row NAME in UTF8 character set is 4*2=8 byte. (8<10)
Length of the 2-nd row NAME in UTF8 character set is 8*2=16 byte.
(16>10).


Reproduce code:
---------------
<?
// oracle client NLS_LANG=RUSSIAN_CIS.UTF8
$conn = oci_new_connect( 'scott', 'tiger', 'DB' );
$cursor = oci_parse( $conn, 'select id, name from utf8_test' ); // tested
with all oci_fetch_* functions
oci_execute( $cursor, OCI_DEFAULT );
oci_fetch_all( $cursor, $result, 0, -1, OCI_FETCHSTATEMENT_BY_ROW );
print "<pre>";
var_dump($result);
?>

Expected result:
----------------
array(2) {
  [0]=>
  array(2) {
    ["ID"]=>
    string(1) "1"
    ["NAME"]=>
    string(8) "����"
  }
  [1]=>
  array(2) {
    ["ID"]=>
    string(1) "2"
    ["NAME"]=>
    string(16) "��������"
  }
}

Actual result:
--------------
array(2) {
  [0]=>
  array(2) {
    ["ID"]=>
    string(1) "1"
    ["NAME"]=>
    string(8) "����"
  }
  [1]=>
  array(2) {
    ["ID"]=>
    string(1) "2"
    ["NAME"]=>
    bool(false)
  }
}

-- 
Edit bug report at http://bugs.php.net/?id=31042&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=31042&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=31042&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=31042&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=31042&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=31042&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=31042&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=31042&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=31042&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=31042&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=31042&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=31042&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=31042&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=31042&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=31042&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=31042&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=31042&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=31042&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=31042&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=31042&r=mysqlcfg

Reply via email to