|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5452 Problem about php and oracle with chinese text
Submitted: 2000-07-08 10:15 UTC Modified: 2006-07-17 08:41 UTC
From: inetwolf at at 63 dot net Assigned:
Status: Not a bug Package: OCI8 related
PHP Version: 4.0.1pl2 OS: solaris 2.6
Private report: No CVE-ID: None
 [2000-07-08 10:15 UTC] inetwolf at at 63 dot net
Sorry,I can't modify the bug id 5341
repost in details

Version Affected : both 3.0.16 & 4.0.1 & 4.0.1pl2
Oracle version : 8.1.5
OS : Solaris 2.6 105181-20
WEB server : NES 3.6

PHP can't work fine with chinese string in the query, both insert and select.It seems that
PHP trunck the 8bit chinese text string to 7bit ascii text.The cgi program  set the
NLS_LANG parametre the sam as db server.
But sqlplus work well.

attention: there are some chinese text,you must have some software that can display it.

source code:

$conn = OCILogon("scott","tiger");  
$stmt = OCIParse($conn,"insert into emp (empno,ename) values (3,'&#20013;&#25991;&#23383; 
&#20307;')  returning ename into :name");  
while (OCIFetch($stmt)) {  
    echo "ename:".$name."\n<br>";  


error message:
OCIDebug: oci_parse "insert into emp (empno,ename) values (3,'&#20013;&#25991;&#23383;&#20307; 
') returning ename into :name" id=4 conn=3 

Warning: OCIStmtExecute: ORA-24365: error in character conversion in / 
usr/netscape/suitespot/docs/q.php on line 13 

Warning: OCIFetch: ORA-24374: define not done before fetch or execute  
and fetch in /usr/netscape/suitespot/docs/q.php on line 14 
OCIDebug: START _oci_stmt_list_dtor: id=4 last_query="insert into emp  
(empno,ename) values (3,'&#20013;&#25991;&#23383;&#20307;') returning ename into :name" 
OCIDebug: _oci_bind_hash_dtor: 
OCIDebug: END _oci_stmt_list_dtor: id=4 
OCIDebug: START php_rshutdown_oci 
OCIDebug: END php_rshutdown_oci 
OCIDebug: START _oci_conn_list_dtor: id=3 
OCIDebug: END _oci_conn_list_dtor: id=3 
OCIDebug: _oci_close_session: logging-off sess=2 
OCIDebug: START _oci_close_server: detaching conn=1 dbname= 

About the database:
$ sqlplus 

SQL*Plus: Release - Production on Fri Jul 7 13:15:16 2000 

(c) Copyright 1999 Oracle Corporation.  All rights reserved. 

Enter user-name: scott 
Enter password: 

Connected to: 
Oracle8i Enterprise Edition Release - Production 
With the Partitioning and Java options 
PL/SQL Release - Production 

SQL> select * from emp; 

     EMPNO ENAME      JOB              MGR HIREDATE         SAL        
---------- ---------- --------- ---------- --------- ---------- ------ 
         3 VPNDWVLe 

SQL> insert into emp (empno,ename) values (1,'&#20013;&#25991;&#23383;&#20307;'); 

1 row created. 

SQL> select * from emp; 

     EMPNO ENAME      JOB              MGR HIREDATE         SAL        
---------- ---------- --------- ---------- --------- ---------- ------ 
         3 VPNDWVLe 

         1 &#20013;&#25991;&#23383;&#20307; 



The character set of oracle is simplified chinese,
There is no problem when manipulating database with sqlplus,
The problem is the interface with php and oracle.

$ oerr ora 24365 
24365, 00000, "error in character conversion" 
// *Cause:  This usually occurs during conversion of a multibyte 
//          character data when the source data is abnormally terminat 
//          in the middle of a multibyte character. 
// *Action: Make sure that all multibyte character data is properly te 
Without the second error message,the first will not display,
but the data it insert into the database is asccii ,too.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-09 13:11 UTC] thies at cvs dot php dot net
closed on behalf of reporting user
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Jan 29 08:01:25 2020 UTC