Skip to content

DB error like a constraint violation gives PHP error #1

Closed
yjeroen opened this Issue Aug 8, 2012 · 2 comments

1 participant

@yjeroen
Owner
yjeroen commented Aug 8, 2012

If the database returns an error (eg. constraint violation), then oci_execute creates a PHP error.

This is unexpected for a PDO behavior, since it should raise an exception.

@yjeroen yjeroen was assigned Aug 8, 2012
@yjeroen
Owner
yjeroen commented Aug 8, 2012

Fixed.

Changed Oci8PDO_Statement, line 104.

<?php
    return oci_execute($this->_sth, $mode);

To:

<?php
    if(@oci_execute($this->_sth, $mode)) {
        return true;
    } else {
        $e = oci_error($this->_sth);
        throw new PDOException($e['message']);
    }
@yjeroen yjeroen closed this Aug 8, 2012
@yjeroen yjeroen reopened this Aug 8, 2012
@yjeroen
Owner
yjeroen commented Aug 8, 2012

Fixed with commit 810f051

@yjeroen yjeroen closed this Aug 8, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.