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 #2786

Error on ->validate() documentation page

Details

Request #2786Error on ->validate() documentation page
Submitted2004-11-18 15:49 UTC
Fromlaura at unique-media dot com
StatusClosed
PackageDB_DataObject
PHP Version4.3.8
OSFedora Core
Roadmaps(Not assigned)

Comments

[2004-11-18 15:49 UTC] laura at unique-media dot com

Description:
------------
http://pear.php.net/manual/en/package.database.db-dataobject.db-dataobject.validate.php

In example 26-1 the code omits an !

If this ! is not present, it will print all of the variables which DID validate correctly, which may confuse some people as the text says there was a problem with them. Alternatively, you could change the text.

Reproduce code:
---------------
// Add a !
foreach ($val as $k=>$v) {
if (!$v) { // Note the extra ! here
echo "there was something wrong with ($k)";
}
}

// Or... Alternative text suggestion ;)
echo "($k) validated OK";

[2004-12-15 15:21 UTC] laura at unique-media dot com

Sorry to be a pedant 'cos I know you fixed it when I reported it previously, but you've now missed a bracket ;) I guess I'm just lazy and I paste from that page a lot.

foreach ($val as $k=>$v) {
if ($v == false) {
echo "There was something wrong with ($k)\n";
} else {
echo "($k) validated OK\n";
}
} // this one is missing :)

Sooorrrryy!!