Bug #77181 [Com]: PDO Statement is not reusable after closing cursor on PDO OCI

From: Date: Fri, 04 Jan 2019 01:25:25 +0000
Subject: Bug #77181 [Com]: PDO Statement is not reusable after closing cursor on PDO OCI
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218784@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77181&edit=1 ID: 77181 Comment by: camporter1 at gmail dot com Reported by: morozov at tut dot by Summary: PDO Statement is not reusable after closing cursor on PDO OCI Status: Open Type: Bug Package: PDO OCI Operating System: Linux PHP Version: 7.2.12 Block user comment: N Private report: N New Comment: When testing on PHP 7.2.12, the PDO statement columns remaining set after closing the cursor seems to cause the issue. If instead closeCursor were to remove the stmt->columns (though this is probably incorrect to do), the result becomes correct because PDOStatement::execute gets past: if (stmt->dbh->alloc_own_columns && !stmt->columns) { so that pdo_stmt_describe_columns can be called, which will then populate the column and return 2. Previous Comments: ------------------------------------------------------------------------ [2018-11-20 14:59:33] morozov at tut dot by Description: ------------ According to the documentation PDOStatement::closeCursor() […] leaves the statement in a state that enables it to be executed again. The example below works at least with pdo_mysql, pdo_sqlite and pdo_pgsql but doesn't work with pdo_oci. Test script: --------------- $conn = new PDO( 'oci:dbname=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SID=XE)))', 'system', 'oracle' ); $stmt = $conn->prepare('SELECT ? FROM DUAL'); $stmt->execute([1]); $value = $stmt->fetchColumn(); var_dump($value); $stmt->closeCursor(); $stmt->execute([2]); $value = $stmt->fetchColumn(); var_dump($value); Expected result: ---------------- string(1) "1" string(1) "2" Actual result: -------------- string(1) "1" NULL ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77181&edit=1

« previous php.bugs (#218784) next »