#94 [NEW]: segmentation fault when connecting to database
| From: | nikolaj dot jansen at telfort dot nl | Date: | Mon, 13 Oct 2003 13:38:02 +0000 |
| Subject: | #94 [NEW]: segmentation fault when connecting to database | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-22646@lists.php.net to get a copy of this message | ||
From: nikolaj dot jansen at telfort dot nl
Operating system: redhat linux
PHP version: 4.3.2
PHP Bug Type: DB_DataObject
Bug description: segmentation fault when connecting to database
Description:
------------
segmentation fault when connecting to db.
This happens only on our production server, not on my development machine
(debian, php 4.3.3RC3). Both use latest DataObject version.
Using exit(); at several points I found the offending line in function
_connect():
// it's not currently connected!
// try and work out what to use for the dsn !
$options= &$_DB_DATAOBJECT['CONFIG'];
$dsn = @$this->_database_dsn;
if (!$dsn) {
if (!$this->_database) {
#Offending line############
$this->_database = @$options["table_{$this->__table}"];
######################
}
if (@$this->_database &&
@$options["database_{$this->_database}"]) {
$dsn = $options["database_{$this->_database}"];
} else if ($options['database']) {
$dsn = $options['database'];
}
}
Reproduce code:
---------------
This is a dump of the $options
array(17) {
["dont_die"]=>
string(1) "0"
["database"]=>
string(29) "mysql://root@localhost/websms"
["#schema_location"]=>
string(15) "../../../../etc"
["schema_location"]=>
string(35) "/home/sta01/www/testsite/etc/websms"
["class_location"]=>
string(9) "generated"
["require_prefix"]=>
string(12) "DataObjects/"
["class_prefix"]=>
string(11) "WEBSMS_DBO_"
["ignore_sequence_keys"]=>
string(0) ""
["extends_location"]=>
string(18) "grap_dbo.class.php"
["extends"]=>
string(8) "GRAP_DBO"
["generator_class_rewrite"]=>
string(0) ""
["debug"]=>
int(3)
["debug_force_updates"]=>
string(1) "0"
["production"]=>
string(1) "0"
["table_VoucherLog"]=>
string(6) "websms"
["table_Statistics"]=>
string(6) "websms"
["database_websms"]=>
string(40) "mysql://websms:XXXXXXX@localhost/websms"
}
Expected result:
----------------
I expected it to happily connect ;)
Actual result:
--------------
Through a webbrowser a zero sized result, through command line a
segmentation fault (no core dump)
--
Edit bug report at http://pear.php.net/bugs/bug.php?id=94&edit=1
--