Bug #73085 [NEW]: oci_execute segfault
| From: | sergei dot solomonov at gmail dot com | Date: | Thu, 15 Sep 2016 05:07:25 +0000 |
| Subject: | Bug #73085 [NEW]: oci_execute segfault | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-204052@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.0RC1
Package: OCI8 related
Bug Type: Bug
Bug description:oci_execute segfault
Description:
------------
PHP v7.1.0RC1 on Ubuntu 15.04.
Looks like all 7.* versions affected, but works fine with php 5.5 and
5.6 versions.
Default php.ini-development config was used.
Test script demonstrates some strange oci_execute / oci_bind_by_name
behaviour.
Code intentionally simplified and may look strange.
Example below leads to segfault after
$stmt->execute();.
Some slight changes or reordering lines / commands may lead to other
result.
Also it may be related to https://bugs.php.net/bug.php?id=73080
Test script:
---------------
<?php
class Statement
{
private $stmt;
function __construct($sql) {
$this->connection = oci_connect('user', 'password', 'db',
'UTF8');
$this->stmt = oci_parse($this->connection, $sql);
}
function execute() {
oci_execute($this->stmt);
}
function runOciFunctionAndHandleResult($funcName, array $funcArgs)
{
call_user_func_array("oci_$funcName", $funcArgs);
}
function bind($name, &$variable) {
$args = func_get_args(); // without this assigning result to
variable works fine!
// $args not used here, because original code a bit simplified
to demonstration strange behaviour
$this->runOciFunctionAndHandleResult(
'bind_by_name',
[$this->stmt, ":$name", &$variable]
);
}
function bindParams(array $bindParams = []) {
foreach ($bindParams as $bvName => &$bvValue) {
$this->bind($bvName, $bvValue[0]);
}
}
}
$stmt = new Statement(
'declare
lp1 varchar2(1000); lp2 varchar2(1000);
begin
lp1 := :p1; lp2 := :p2;
end;'
);
$stmt->bindParams(['p1' => ['xxxxxxxxxxxxxxxxxxxxxxxx']]); // 24 or more
chars would lead to segfault
$stmt->bind('p2', $code);
$stmt->execute();
Actual result:
--------------
Segmentation fault (core dumped)
--
Edit bug report at https://bugs.php.net/bug.php?id=73085&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73085&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73085&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73085&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73085&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73085&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73085&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73085&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73085&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73085&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73085&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73085&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73085&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73085&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73085&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73085&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73085&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73085&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73085&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73085&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73085&r=mysqlcfg