PEAR is archived and read-only

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

Home » HTML » HTML_QuickForm » Bug #1212

Database entries in select

Details

Submitted2004-04-15 04:28 UTC
Fromdjpenton at cs dot mu dot oz dot au
Assignedavb
StatusClosed
PackageHTML_QuickForm
PHP Version5CVS-2004-04-15 (dev)
OSSolaris 2.9
Roadmaps(Not assigned)

Comments

[2004-04-15 04:28 UTC] djpenton at cs dot mu dot oz dot au

Description:
------------
line 447:
case (get_class($options) == "db_result" || is_subclass_of($options, "db_result")):

Should read:
case (is_a($options, "db_result") || is_subclass_of($options, "db_result")):

The case of the class is represented differently in php5 and hence it doesn't match DB_result with db_result.

(Works fine in php4)

Reproduce code:
---------------
$user = DBASE_USER;
$pass = DBASE_PASS;
$host = MYSQL_HOST;
$db_name = MYSQL_DBNAME;
$dsn = "mysql://$user:$pass@$host/$db_name";

$db = DB::connect($dsn);

$form = new HTML_QuickForm('firstForm');

$form->addElement('header', null, 'QuickForm tutorial example');
$form->addElement('select',"elementname","label",$db->query("SELECT optionName, birthdateConfidence FROM BirthdateConfidenceSet"));

$form->addElement('submit', null, 'Send');
if ($form->validate()) {
echo '<h1>Hello, ' . htmlspecialchars($form->exportValue('elementname')) . '!</h1>';
exit;
}

$form->display();

Expected result:
----------------
a dropdown select

Actual result:
--------------
empty select box