1
irmtfan
Xoops26 bug: Class Criteria render where() when nothing is added
  • 2013/4/17 8:41

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


It is not in XOOPS255 and XOOPS256.

In XOOPS26/class/criteria.php line 219:
public function render()
    {
        
$ret '';
        foreach (
$this->criteriaElements as $i => $element) {
            
/* @var $element CriteriaElement */
            
if ($i == 0) {
                
$ret $element->render();
            } else {
                if (!
$render $element->render()) {
                    continue;
                }
                
$ret .= ' ' $this->conditions[$i] . ' ' $render;
            }
            
$ret "({$ret})";
        }
        return 
$ret;
    }


It will return () when $ret is empty.
so finally we have a query error:
SELECT FROM `TABLEWHERE () ORDER BY id DESC LIMIT 010


solution:
public function render()
    {
        
$ret '';
        foreach (
$this->criteriaElements as $i => $element) {
            
/* @var $element CriteriaElement */
            
if ($i == 0) {
                
$ret $element->render();
            } else {
                if (!
$render $element->render()) {
                    continue;
                }
                
$ret .= ' ' $this->conditions[$i] . ' ' $render;
            }
            
$ret = empty($ret) ? '' "({$ret})"// irmtfan change this
        
}
        return 
$ret;
    }


PS: please somebody add this to sf.net bug tracker

2
Cesagonchu
Re: Xoops26 bug: Class Criteria render where() when nothing is added


Login

Who's Online

224 user(s) are online (147 user(s) are browsing Support Forums)


Members: 0


Guests: 224


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits