From: symphony dot group at yahoo dot com
Operating system: Irrelevant
PHP version: 5.2.12
PHP Bug Type: PDO related
Bug description: ORA-03131: an invalid buffer was provided for the next
piece(Same as Bug#39820)
Description:
------------
When binding out variables, you have to specify the data type and length
manually with PDO_OCI.
If not you receive an oracle error:
ORA-03131: an invalid buffer was provided for the next piece
This bug exists in both PHP 5.2.12 and 5.3.1
Reproduce code:
---------------
the following simple code easily re-produces the bug:
try {
$dbConn = new PDO('oci:dbname=.....);
$dbConn->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
$sql = $dbConn->prepare("
BEGIN
SELECT username
INTO :chkId
FROM USERS
WHERE username = 'fred';
END;
");
$sql->bindParam('chkId', $chkId);
$sql->execute();
var_dump($chkId);
} catch (Exception $e) {
var_dump($e);
}
obviously I've censored our connection info.
as the other user mentioned in bug #39820 if I alter the bindParam to:
$sql->bindParam('chkId', $chkId, PDO::PARAM_STR, 10);
it works. however even missing off the variable length causes a error
Expected result:
----------------
string ('fred');
Actual result:
--------------
object(PDOException)#3 (8) {
["message":protected]=>
string(173) "SQLSTATE[HY000]: General error: 3131 OCIStmtExecute:
ORA-03131: an invalid buffer was provided for the next piece
(....../php-5.3.1/ext/pdo_oci/oci_statement.c:146)"
["string":"Exception":private]=>
string(0) ""
["code":protected]=>
string(5) "HY000"
["file":protected]=>
string(20) "/root/pdoOciTest.php"
["line":protected]=>
int(14)
["trace":"Exception":private]=>
array(1) {
[0]=>
array(6) {
["file"]=>
string(20) "/root/pdoOciTest.php"
["line"]=>
int(14)
["function"]=>
string(7) "execute"
["class"]=>
string(12) "PDOStatement"
["type"]=>
string(2) "->"
["args"]=>
array(0) {
}
}
}
["previous":"Exception":private]=>
NULL
["errorInfo"]=>
array(3) {
[0]=>
string(5) "HY000"
[1]=>
int(3131)
[2]=>
string(136) "OCIStmtExecute: ORA-03131: an invalid buffer was provided
for the next piece
(...../php-5.3.1/ext/pdo_oci/oci_statement.c:146)"
}
}
--
Edit bug report at http://bugs.php.net/?id=50906&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=50906&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=50906&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=50906&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=50906&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=50906&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=50906&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=50906&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=50906&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=50906&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=50906&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=50906&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=50906&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=50906&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=50906&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50906&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50906&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=50906&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=50906&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=50906&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=50906&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=50906&r=mysqlcfg