[horde] Pretty sure I found Bug in Trean (Bookmarks)

Andy Dorman adorman at ironicdesign.com
Mon Oct 7 19:53:05 UTC 2013


On 10/07/2013 01:58 PM, Michael M Slusarz wrote:
> Quoting Andy Dorman <adorman at ironicdesign.com>:
>
>> On 10/03/2013 08:32 AM, Andy Dorman wrote:
>>> I have tested this fix as well and it works fine...
>>>
>>>>    public function listBookmarks($sortby = 'title', $sortdir = 0,
>>>> $from = 0, $count = 0)
>>>>    {
>>>>        $values = array($this->_userId);
>>>>        $sql = 'SELECT bookmark_id, user_id, bookmark_url,
>>>> bookmark_title, bookmark_description, bookmark_clicks,
>>>> bookmark_http_status, favicon_url, bookmark_dt
>>>>                FROM trean_bookmarks
>>>>                WHERE user_id = ?
>>>>                ORDER BY bookmark_' . ($sortby ? $sortby : 'title') .
>>>> ($sortdir ? ' DESC' : '');
>>>>        $sql = $GLOBALS['trean_db']->addLimitOffset($sql,
>>>> array('limit' => $count, 'offset' => $from));
>>>
>>> It still seems silly to me that PHP apparently considers the empty
>>> string or whatever is being passed for $sortby to be a valid value and
>>> does not invoke the default for it.
>
> Not silly at all.  This is basic PHP comparison logic - an empty string
> is considered a false value for purposes of a boolean comparison.  See:
>
> http://php.net/manual/en/function.empty.php
>
> michael
>

Exactly!  It is so nice to work with PHP experts like yourself.

Anyway, I submitted the bug report, #12733, and this proposed fix which 
is simple, but feels like a bandaid to me.  We have been testing this 
fix on our beta test site for over a week and it has worked fine.

Is there any other action I should take?

At some point I plan to register as a Horde developer so I can help 
more, but right now I am not yet good enough with PHP to submit patches 
directly.

Thanks for your help Michael.

-- 
Andy Dorman



More information about the horde mailing list