[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Help me:Rename DN with childrens in PHP.



Tony Earnshaw wrote:

> The answer is, as always, RTFM. But this time: RTFPHPM.

Tell me about it.  I spent a whole DAY trying to make this work:

switch(ldap_compare(stuff)) {
case LDAP_COMPARE_TRUE:
   one thing
case LDAP_COMPARE_FALSE:
   another thing
default:
   a third thing
}

(answer: in PHP).  Guess what.  PHP doesn't have any such constants
as LDAP_COMPARE_TRUE or LDAP_COMPARE_FALSE.  The FPHPM says to just
compare against TRUE or FALSE.  Because LDAP_COMPARE_TRUE is not
anything special to PHP, it is a string "LDAP_COMPARE_TRUE" which is
TRUE (the only thing that is FALSE is 0 or "").  So the above code
is syntactically equivalent to:

switch(ldap_compare(stuff)) {
case true:
   one thing
case true:
   another thing
default:
   a third thing
}

So when the compare was true everything was just fine, one thing
got done.  But when the compare was false it did a third thing
instead of another thing.   Sheesh.   There is too little
Hamming distance between valid statements in these damn
interpreter languages like PHP and Perl...

-- 

Charles B. (Ben) Cranston
mailto:zben@umd.edu
http://www.wam.umd.edu/~zben