Bug #73206 [NEW]: oci_bind_by_name/oci_execute doesn't work properly
| From: | sergei dot solomonov at gmail dot com | Date: | Fri, 30 Sep 2016 02:58:30 +0000 |
| Subject: | Bug #73206 [NEW]: oci_bind_by_name/oci_execute doesn't work properly | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-204357@lists.php.net to get a copy of this message | ||
From: sergei dot solomonov at gmail dot com
Operating system: Ubuntu 15.04
PHP version: 7.1.0RC3
Package: OCI8 related
Bug Type: Bug
Bug description:oci_bind_by_name/oci_execute doesn't work properly
Description:
------------
Tested with 7.09 and 7.1.0RC3 on Ubuntu 15.04.
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'
Example below leads to incorrect result. In case bind value 8 or more
chars length returns
false, if less than 8 - returns correct result.
It may be related with https://bugs.php.net/bug.php?id=73085.
For now, its impossible to work with PHP 7 and Oracle DB looks very
unstable and buggy. Can't use any php7 version in prod.
Test script:
---------------
class Statement {
public $resource;
function __construct($sql) {
$conn = oci_connect(getenv('db_login'), getenv('db_pwd'),
getenv('db_host'));
$this->resource = oci_parse($conn, $sql);
}
public function errorHandler($severity, $message, $file = '', $line
= 0) {
var_dump($message, 0, $severity, $file, $line);
}
function execute() {
set_error_handler([$this, 'errorHandler']);
oci_execute($this->resource);
restore_error_handler();
}
function bindParams(array $bindParams = []) {
foreach ($bindParams as $bvn => &$bvv) {
oci_bind_by_name($this->resource, $bvn, $bvv);
}
}
function fetch() {
return oci_fetch_array($this->resource);
}
}
$stmt = new Statement("select * from dual where :param = 'xxxxxxxx'");
$stmt->bindParams(['param' => 'xxxxxxxx']);
$stmt->execute();
var_dump($stmt->fetch());
Expected result:
----------------
array(2) {
[0]=>
string(1) "X"
["DUMMY"]=>
string(1) "X"
}
Actual result:
--------------
bool(false)
--
Edit bug report at https://bugs.php.net/bug.php?id=73206&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73206&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73206&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73206&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73206&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73206&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73206&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73206&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73206&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73206&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73206&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73206&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73206&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73206&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73206&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73206&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73206&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73206&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73206&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73206&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73206&r=mysqlcfg