[dev] Re: [cvs] commit: horde/templates/admin/user add.inc approve.inc horde/admin user.php horde/lib Signup.php

Chuck Hagenbuch chuck at horde.org
Mon Jul 21 08:44:23 PDT 2003


Quoting John Morrissey <jwm at horde.net>:

> I tried that in desperation; it wasn't working as expected when passing by
> value. I'll have another look and see if I can figure out what's going on.

It *is* being passed by reference; you specify that in the function definition,
not in the call.

> A couple questions:
>
>   if ((condition1) || (condition2) || (condition3) ||
>       (condition4)) {
>       action1;
>   }
>
> is the appropriate way to brace multi-line if statements?

Yes.

> Also, I see you added a couple newlines before the closing class brace,
> i.e.:
>
> class Foo
> {
>   function()
>   {
>
>   }
>   // <-- this newline
> }
>
> I didn't see this in CODING_STANDARDS - should I add it?

If it's necessary - it's just balancing whitespace. Note that there's a blank
line before the function definition, too:

class Foo {

    function bar()
    {
    }

}

> Next, I saw you changed:
>
> -$addForm = new Horde_Form($vars, _("Add a new user:"), 'adduser');
> +$addForm = &new Horde_Form($vars, _("Add a new user:"), 'adduser');
>
> How do you tell when the reference should be taken when instantiating a
> class?

Basically, with PHP4, unless you really need a copy, you always want to get back
a reference of an object.

> Lastly, I have a question about PEAR_Error handling. The PEAR::isError I
> have checks whether the passed object is_subclass_of(, 'PEAR_Error'). Why
> use is_a()?

Because it does the same thing with a single native call:
http://us2.php.net/is-a

-chuck

--
Charles Hagenbuch, <chuck at horde.org>
They're just looking at a wall of meat.


More information about the dev mailing list