Bug #7616 [NEW]: nestGroups defaults to true, not false

From: Date: Fri, 12 May 2006 18:45:52 +0000
Subject: Bug #7616 [NEW]: nestGroups defaults to true, not false
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-7912@lists.php.net to get a copy of this message
From: truth at proposaltech dot com Operating system: Irrelevant Package version: PHP version: Irrelevant Package: Documentation Bug Type: Bug Bug description: nestGroups defaults to true, not false Description: ------------ Mail/RFC822.php speaks for itself. The member nestGroups is true by default and is only changed if a non-null parameter is passed. The code for the constructor and member variable is the same. I'll paste a bit of RFC822.php into the "Test script" section below. Actually, the behavior seems to be more complicated than true/false. We've been using the default (true) for years thinking the default was false because the results hadn't included nesting. It turns out that is because we'd never encountered a ":" in a "From" before. If there's no grouping to be done, it seems that it doesn't nest even though nestGroups is true. Tricky! I'm not sure whether this is a bug in the docs or a bug in the code. (BTW, php5 doesn't like the check for "$this" on line 164 of RFC822.php.) Test script: --------------- Here is a bit of the RFC822.php: var $nestGroups = true; ... function Mail_RFC822($address = null, $default_domain = null, $nest_groups = null, $validate = null, $limit = null) ... if (isset($nest_groups)) $this->nestGroups = $nest_groups; I'm not sure which part of the code decides not to test if there were no ":"s even though nestGroups is true. Maybe that should be a separate bug report. Here's the problem we hit: <?php require_once "Mail/RFC822.php"; $raw = " Melitta One:One<MelittaOneOne80337751@sunildada.com>\n"; class A { function f($raw) { $addresses = Mail_RFC822::parseAddressList ($raw, 'proposaltech.com'); var_dump($addresses); if(is_array($addresses) and count($addresses) != 0){ $adr = $addresses[0]; print "$adr->host\n"; } else { print "Huh?\n"; } } }; $a = new A; $a->f($raw); ?> Expected result: ---------------- The docs say nestGroups defaults to false, so I didn't expect nesting. Now that I know nestGroups actually defaults to true, I would expect nesting even if I removed the ":" from the address. Actual result: -------------- I got nesting with the example. If I remove the ":", the nesting goes away. -- Edit bug report at http://pear.php.net/bugs/bug.php?id=7616&edit=1 --

« previous php.pear.doc (#7912) next »