PEAR is archived and read-only

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

Home » Database » DB_Table » Bug #1855

QuickForm: Error "$type not defined" because piece of code is wrong positioned

Details

Submitted2004-07-12 15:10 UTC
Fromherojoker at nexgo dot de
Assignedpmjones
StatusClosed
PackageDB_Table
PHP Version4.3.7
OSAll
Roadmaps(Not assigned)

Comments

[2004-07-12 15:10 UTC] herojoker at nexgo dot de

Description:
------------
Hello!
I've found out a new error in DB_Table 0.21.1 and also a solution.
In line 485 is a check whether $type is in the array $tmp, but $type is not defined/set yet.
I think it should be sufficient to move the check into the next foreach loop.

The other informations demanded by the bugsystem (Note:) are not necessary.

I put the code pieces in the box below.

I think you just moved the piece of code (the if(...){...} ) accidently out of the foreach.
I hope this helps you with the development of DB_Table.

Although, great package!
Hero Wanders

Reproduce code:
---------------
Old code:

$tmp = array('filename', 'maxfilesize', 'mimetype', 'uploadedfile');
if (in_array($type, $tmp)) {
$validate = 'server';
}

// loop through the rules and add them
foreach ($col['qf_rules'] as $type => $opts) {

switch ($type) {
...
}
...
}

New code:

$tmp = array('filename', 'maxfilesize', 'mimetype', 'uploadedfile');

// loop through the rules and add them
foreach ($col['qf_rules'] as $type => $opts) {

if (in_array($type, $tmp)) {
$validate = 'server';
}

switch ($type) {
...
}
...
}

[2004-07-12 15:13 UTC] herojoker at nexgo dot de

(just changed the title)

[2004-07-12 15:14 UTC] herojoker at nexgo dot de

Forgot to mention the error is in Quickform.php..