PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB_DataObject » Bug #5484

dispensing with class_prefix leads to segmentation fault

Details

Submitted2005-09-22 03:30 UTC
Fromroger at ecstatic dot com
Assignedalan_k
StatusSuspended
PackageDB_DataObject
PHP Version4.3.11
Roadmaps(Not assigned)

Comments

[2005-09-22 03:30 UTC] roger at ecstatic dot com

Description:
------------
I want my persistent classes to have the same names as
the underlying tables, so I set 'class_prefix' to the
empty string. This works great...except that I happen
to have a table called 'Factory'. Calling
DB_DataObject::Factory() with an argument of 'Factory'
causes a segmentation fault. :-(

In the discussion for bug #3256, I see a reference to
this being a design decision. Fair enough; I'll report
this as a documentation bug. I've reported it here,
though, in case it affects the implementation of any
changes, such as those being discussed in #3256.

Test script:
---------------
<?php

require_once 'PEAR.php';
require_once 'DB/DataObject.php';

$options = &PEAR::getStaticProperty('DB_DataObject','options');
$options = array(
'database' => 'mysql://user:password@localhost/vending',
'schema_location' => '/home/me/Projects/myapplication/DataObjects',
'class_location' => '/home/me/Projects/myapplication/DataObjects',
'require_prefix' => 'DataObjects/',
'class_prefix' => '',
);

$obj = DB_DataObject::Factory('Factory');

?>

Expected result:
----------------
Nothing.

Actual result:
--------------
A long pause, then a Segmentation fault.

[2005-11-06 09:41 UTC] roger at ecstatic dot com

I'm not in a position to use the latest code on my
project--my client stipulates that I use a stable,
released version of the package. I just stuck a prefix
on and went about my work.