[aur-dev] [PATCH 1/2] Removed unused mysql_num_rows result, changed while-loop check from lazy-one to default one

Lukas Fleischer archlinux at cryptocrack.de
Mon Sep 17 20:06:23 EDT 2012


On Mon, Sep 17, 2012 at 11:19:33AM -0400, canyonknight at gmail.com wrote:
> On Mon, Sep 17, 2012 at 8:11 AM,  <mario at xenji.com> wrote:
> > From: "Mario (xenji) Mueller" <mario at xenji.com>
> >
> > Signed-off-by: Mario (xenji) Mueller <mario at xenji.com>
> > ---
> >  web/lib/acctfuncs.inc.php | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php
> > index d58c759..6f7c98a 100644
> > --- a/web/lib/acctfuncs.inc.php
> > +++ b/web/lib/acctfuncs.inc.php
> > @@ -327,9 +327,8 @@ function search_results_page($UTYPE,$O=0,$SB="",$U="",$T="",
> >         }
> >
> >         $result = db_query($q, $dbh);
> > -       $num_rows = mysql_num_rows($result);
> 
> Is this really unused? I can't check right now, but I have a feeling
> this breaks account searching. The account search results page is
> finicky and needs a lot of work (pagination more like package results
> page, GET requests rather than POST, etc).

I hope it's unused -- you removed it in the PDO patch (which also
supersedes this one) :)

> 
> >
> > -       while ($row = mysql_fetch_assoc($result)) {
> > +       while (($row = mysql_fetch_assoc($result)) != false) {
> 
> I don't know Lukas' preference here. A style for this should probably
> be established and used.

The original version is obviously easier to read... I agree that we need
to improve our coding style guidelines and add some more
principles/examples.

> 
> >                 $userinfo[] = $row;
> >         }
> >
> > --
> > 1.7.12
> >


More information about the aur-dev mailing list