|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58398 ' ' strings as nulls
Submitted: 2008-10-29 05:04 UTC Modified: 2009-05-29 03:56 UTC
From: gonzalo123 at gmail dot com Assigned:
Status: Closed Package: PDO_OCI (PECL)
PHP Version: 5.2.9 OS: Linux 32(Suse)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: gonzalo123 at gmail dot com
New email:
PHP Version: OS:


 [2008-10-29 05:04 UTC] gonzalo123 at gmail dot com
When I try to insert a space ' ' in a table with a not null value PDO_OCI throws an ORA-01400: cannot insert NULL exception. I know Oracle uses blank spaces as nuls but in this example there is not a blank space. I realice that the same problem occurs not only with a ' '. Even with more spaces. It looks that trims the value before send it to the database ('1 ' => '1').

Reproduce code:
// create table WEB.TBLDUMMY (COL1 VARCHAR2(3) not null)
$db = new PDO(
    $dsn, // my DB dsn
    $user, // database username
    $password); // database password
try {
    $db->setAttribute(PDO::ATTR_AUTOCOMMIT, false);
    $stmt = $db->prepare("INSERT INTO WEB.TBLDUMMY (COL1) VALUES (:COL1)");
    $stmt->bindValue(':COL1', ' ');
} catch (Exception $e) {
    echo $e->getMessage();

Expected result:
Nothing. The script must finish without output

Actual result:
SQLSTATE[HY000]: General error: 1400 OCIStmtExecute: ORA-01400: cannot insert NULL into ("WEB"."TBLDUMMY"."COL1")


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-28 17:39 UTC] christopher dot jones at oracle dot com
Thank you for taking the time to report a problem with the package.
Unfortunately you are not using a current version of the package -- 
the problem might already be fixed. Please download a new
version from

If you are able to reproduce the bug with one of the latest
versions, please change the package version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PECL.


I can't reproduce this with PHP 5.2.9.  PHP doesn't throw an exception.  After it completes, I can see the inserted data in SQL*Plus:

SQL> select ':'||COL1||':' from TBLDUMMY;

: :
 [2009-05-29 03:56 UTC] gonzalo123 at gmail dot com
I didn't test it again when I changed PHP version.
Now with 5.2.9 works perfectly as you say.

Many thanks
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 26 05:01:32 2024 UTC