update always returns true

RESOLVED FIXED

Status

RESOLVED FIXED
18 years ago
14 years ago

People

(Reporter: mozbugs, Assigned: leif)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

18 years ago
Update always seems to return false, shouldn't it return true if the update was 
successful and false only if it failed?

With this code:

    if ( $ld{conn}->update($entry) ) {
        if ( $ld{conn}->getError() ) {
            print("\n\nREASON FOR FAILURE: \n");
            $ld{conn}->printError("LDAP Error:");
            print("\n");
            &croak("Failed.");
        }
    }

It never prints or detects an error (even if there is one). It appears
that the update always returns 0.

If I use this code instead:

    $ld{conn}->update($entry);
    if ( $ld{conn}->getError() ) {
        print("\n\nREASON FOR FAILURE: \n");
        $ld{conn}->printError("LDAP Error:");
        print("\n");
        &croak("Failed.");
    }

It properly detects and reacts to write errors to the LDAP server.
 
This is with 1.4.
Reversing database corruption.  Pay no attention to the man behind the curtain.
QA Contact: mystery.user
(Assignee)

Updated

16 years ago
Status: NEW → ASSIGNED
(Assignee)

Comment 2

14 years ago
I think what happens is that when there are no actual changes to be made,
update() returns FALSE (indicating error), while getError() of course is going
to return success. I've changed it so that TRUE is returned if the update
succeeded, or if there were no changes to be made. I think this makes most sense
most of the time.

This is fixed in the dev-branch (devel-branch-1_4_2), and will most likely go
into the next (and final) PerLDAP release (1.5)
Status: ASSIGNED → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.