|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-11-11 01:44 UTC] felipe@php.net
-Status: Open
+Status: Assigned
-Assigned To:
+Assigned To: sixd
[2012-10-26 05:57 UTC] sixd@php.net
-Assigned To: sixd
+Assigned To:
[2014-01-01 12:49 UTC] felipe@php.net
-Package: PDO related
+Package: PDO OCI
[2022-11-23 05:35 UTC] sheyda dot babi5161 at gmail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 22:00:01 2025 UTC |
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)" } }