php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28561 Cannot insert nor update a 'LONG' column with value more than 4000 characters
Submitted: 2004-05-28 18:23 UTC Modified: 2004-06-02 14:12 UTC
Votes:5
Avg. Score:5.0 ± 0.0
Reproduced:5 of 5 (100.0%)
Same Version:3 (60.0%)
Same OS:5 (100.0%)
From: xavier at c-est-simple dot com Assigned:
Status: Not a bug Package: OCI8 related
PHP Version: 4.3.6 OS: LINUX
Private report: No CVE-ID: None
 [2004-05-28 18:23 UTC] xavier at c-est-simple dot com
Description:
------------
When trying to update or insert a 'LONG' column on an Oracle database, a "OCIStmtExecute: ORA-01704: string literal too long" error occurs when the value is more than 4000 characters.

This has been checked with PHP Version 4.3.7RC2-dev
as well.

config options:
'--enable-dio' '--with-mcrypt' '--without-mysql' '--with-oci8=/opt/oracle/817' '--with-apxs=/home/user/php/apache/bin/apxs' '--enable-debug' 

The bug #17063 was related but rather old, with no feedback and on a different OS, so I thought it better to open a new one.


Reproduce code:
---------------
After creating an Oracle table such as :
CREATE TABLE OCI_BUG ( 
  TEXT  LONG, 
  ID    NUMBER)
Insert 

run the script above :

<?
$conn = OCIpLogon("user","passwd","schema");

$texte = str_pad("", 3990, 'a');
do
{
   $texte .=  'a';
   $longueur = strlen($texte);
   print "$longueur\n";
   $query = "update OCI_BUG set TEXT='$texte' where id=1" ;
   //$query = "insert into OCI_BUG (TEXT, ID) VALUES ('$texte', $longueur)" ;
   $parsed = OCIParse($conn, $query);
   OCIExecute($parsed);
   $err = ocierror($parsed) ;
} while(!$err && ($longueur < 4050)) ;

OCIFreeStatement($parsed);
OCILogoff($conn);
?>

The query can be changed to either update or insert by switching the comments with no other modification.
NB : the problem occurs on the update query even when there is no row to update.

Expected result:
----------------
A list of lines showing numbers from 3991 to 4050, as shown below :
3991
3992
3993
3994
3995
...
...
4044
4045
4046
4047
4048
4049
4050

Actual result:
--------------
An error occurs for a 4001 character value.

3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
PHP Warning:  ociexecute(): OCIStmtExecute: ORA-01704: string literal too long
 in /home/xavier/FMK/ocibug.php on line 13

Warning: ociexecute(): OCIStmtExecute: ORA-01704: string literal too long
 in /home/xavier/FMK/ocibug.php on line 13

The value is not inserted (or updated) in the table.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-02 14:12 UTC] tony2001@php.net
Try to execute this query using sqlplus or another query tool. You'll get the same error.

Not a PHP bug -> bogus.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 20:01:31 2024 UTC