Bug #73080 [Com]: oci_execute doesn't work properly
| From: | sergei dot solomonov at gmail dot com | Date: | Wed, 14 Sep 2016 04:23:21 +0000 |
| Subject: | Bug #73080 [Com]: oci_execute doesn't work properly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-204024@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73080&edit=1
ID: 73080
Comment by: sergei dot solomonov at gmail dot com
Reported by: sergei dot solomonov at gmail dot com
Summary: oci_execute doesn't work properly
Status: Open
Type: Bug
Package: OCI8 related
Operating System: Ubuntu 15.04
PHP Version: 7.1.0RC1
Block user comment: N
Private report: N
New Comment:
Test script works fine with the such function definition:
public function execute(array &$bindParams = [])
...
But during my experiments I've got segfaults couple of times.
Also works with the following snippet:
public function bindParams(array $bindParams = []) {
if (count($bindParms))
foreach ($bindParams as $bvName => &$bvValue)
...
Previous Comments:
------------------------------------------------------------------------
[2016-09-14 04:21:27] sergei dot solomonov at gmail dot com
Description:
------------
Tested with 7.09 and 7.1.0RC1 on Ubuntu 15.04 and MacOSX10.11 operating systems.
Looks like all 7.* versions affected. Works fine with php v5.5, v5.6.
Default php.ini-development config was used.
Configure command:
'./configure' '--enable-zip' '--enable-intl' '--with-oci8'
'--enable-dbase' '--disable-cgi'
'--with-apxs2=/usr/local/apache/bin/apxs' '--enable-opcache'
'--enable-sigchild' '--enable-mbstring' '--with-xsl'
'--with-gd' '--with-config-file-scan-dir=/usr/local/apache/conf'
'--with-openssl' '--with-curl' '--with-zlib'
'--enable-timezonedb'
Test script:
---------------
<?php
class Statement
{
private $stmt;
function __construct($query) {
$conn = oci_connect('autotest', '6de9439834c914756974',
'cascade.erkc.ru', 'UTF8');
$this->stmt = oci_parse($conn, $query);
}
public function execute(array $bindParams = [])
{
$this->bindParams($bindParams);
return oci_execute($this->stmt); // Line 14
}
public function bindParams(array $bindParams = []) {
foreach ($bindParams as $bvName => &$bvValue)
oci_bind_by_name($this->stmt, $bvName, $bvValue);
}
public function fetch() {
return oci_fetch_array($this->stmt, OCI_ASSOC);
}
}
$stmt = new Statement("SELECT * FROM dual WHERE :p1 = 'xxx'");
$params = ['p1' => 'xxx'];
$stmt->bindParams($params);
$stmt->execute();
var_dump($stmt->fetch());
Expected result:
----------------
array(1) {
["DUMMY"]=>
string(1) "X"
}
Actual result:
--------------
PHP Notice: Array to string conversion in /usr/local/apache/htdocs/module/Db/1.php on line 14
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73080&edit=1