Home » Database » DB » Bug #3413
Pear DB/ibase.php crash with SIGSEGV after query
Details
| Submitted | 2005-02-09 13:01 UTC |
|---|---|
| From | or at miton dot cz |
| Assigned | danielc |
| Status | Bogus |
| Package | DB |
| PHP Version | 4.3.10 |
| OS | Linux RHEL 3 |
| Roadmaps | (Not assigned) |
Comments
[2005-02-09 13:01 UTC] or at miton dot cz
Description:
------------
Hi
I have problem with using pear/DB.php for ibase. I have latest stable pear, php-3.4.10 compiled with ibase, firebird-1.5.
After query php ends with SIGSEGV.
I've made dirty workaround in ibase.php with array_pop. Problem is with NULL on the end of array.
function connect($dsninfo, $persistent = false)
{
if (!DB::assertExtension('interbase')) {
return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
}
$this->dsn = $dsninfo;
$dbhost = $dsninfo['hostspec'] ?
($dsninfo['hostspec'] . ':' . $dsninfo['database']) :
$dsninfo['database'];
$connect_function = $persistent ? 'ibase_pconnect' : 'ibase_connect';
$params = array();
$params[] = $dbhost;
$params[] = $dsninfo['username'] ? $dsninfo['username'] : null;
$params[] = $dsninfo['password'] ? $dsninfo['password'] : null;
$params[] = isset($dsninfo['charset']) ? $dsninfo['charset'] : null;
$params[] = isset($dsninfo['buffers']) ? $dsninfo['buffers'] : null;
$params[] = isset($dsninfo['dialect']) ? $dsninfo['dialect'] : null;
$params[] = isset($dsninfo['role']) ? $dsninfo['role'] : null;
// or@miton.cz workaround
array_pop($params);
array_pop($params);
array_pop($params);
array_pop($params);
Reproduce code:
---------------
<?php
include('DB.php');
$db = DB::connect("ibase://SYSDBA:masterkey@localhost/var/lib/firebird/employee.fdb");
print_r($db);
$db->query('SELECT * FROM employee');
?>
Actual result:
--------------
[root@jaja2 dalen]# php er.php
Content-type: text/html
X-Powered-By: PHP/4.3.10
db_ibase Object
(
[connection] => Resource id #6
[phptype] => ibase
[dbsyntax] => ibase
[autocommit] => 1
[manip_query] => Array
(
)
[_debug] =>
[_default_error_mode] =>
[_default_error_options] =>
[_default_error_handler] =>
[_error_class] => DB_Error
[_expected_errors] => Array
(
)
[features] => Array
(
[prepare] => 1
[pconnect] => 1
[transactions] => 1
[limit] =>
)
[errorcode_map] => Array
(
[-104] => -2
[-150] => -26
[-151] => -26
[-155] => -18
[88] => -18
[-157] => -19
[-158] => -22
[-170] => -7
[-171] => -7
[-172] => -8
[-204] => -8
[-205] => -19
[-206] => -19
[-208] => -8
[-219] => -18
[-297] => -3
[-530] => -3
[-607] => -18
[-803] => -3
[-551] => -26
[-552] => -26
[-922] => -27
[-923] => -24
[-924] => -24
)
[prepare_tokens] =>
[prepare_types] =>
[prepared_queries] =>
[prepare_maxstmt] => 0
[last_query] =>
[fetchmode] => 1
[fetchmode_object_class] => stdClass
[options] => Array
(
[persistent] =>
[ssl] =>
[debug] => 0
[seqname_format] => %s_seq
[autofree] =>
[portability] => 0
[optimize] => performance
)
[dbh] =>
[dsn] => Array
(
[phptype] => ibase
[dbsyntax] => ibase
[username] => SYSDBA
[password] => masterkey
[protocol] => tcp
[hostspec] => localhost
[port] =>
[socket] =>
[database] => var/lib/firebird/employee.fdb
)
)
(SIGSEGV)
[2005-02-09 13:10 UTC] smith at backendmedia dot com
From what I have heard from Lorenzo working on the ibase MDB drivers it seems like the PHP4 version of the ibase extension is still quite a mess and real stability can only be attained by using PHP5.
So it might make sense to either provide a cut down version for PHP4, or end up adding some PHP4/PHP5 conditional code.