PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » DB_DataObject » Bug #94

segmentation fault when connecting to database

Details

Submitted2003-10-13 13:38 UTC
Fromnikolaj dot jansen at telfort dot nl
StatusBogus
PackageDB_DataObject
PHP Version4.3.2
OSredhat linux
Roadmaps(Not assigned)

Comments

[2003-10-13 13:38 UTC] nikolaj dot jansen at telfort dot nl

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)

[2003-10-13 13:44 UTC] datenpunk at php dot net

Do you have Zend Optimizer enabled?
Zend Optimizer has some problems with oeverload() AFAIK.

Try to lower your optimization level in php.ini:
zend_optimizer.optimization_level=14

hth

Daniel Khan

[2003-10-13 13:49 UTC] nikolaj dot jansen at telfort dot nl

nope, no optimizer installed...

[2003-10-13 14:01 UTC] datenpunk at php dot net

Have you tried upgrading to the latest php version?
You say you are using 4.3.2 on one host and 4.3.3RC3 on the other.
A segfault usually is caused by php itself and not by PEAR but it makes no sense to file a bug for php if you don't use the most recent version.