Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

<xt:sql> fails when query returns records

#122

The <xt:sql> feature of XT fails with a PHP runtime error when the SQL query successfully returns records.

The problem is that after the <xt:sub> block is evaluated for each record, _sql_end() attempts to clear the "result" object by calling XTExpression::setObject (false, 'result'). This function defines parameter 1, $obj, as a pass-by-reference parameter. Per the PHP specification (http://www.php.net/manual/en/lan..., attempting to use a constant as a pass-by-reference is illegal and will generate a fatal run-time error.

The following corrects the problem (based on git 3/12/09, commit cd42383b916aedce92376237cb432365127f572e):

sitellite / saf / lib / XML / XT.php

@@ -2719,7 +2719,7 @@ function _sql_end ($node) {

  $this->exp->setObject ($row, 'result');
  $out .= $this->fill ($this->wrap ($sql['sub']), $this->exp->register['object'], true);
}

  • $this->exp->setObject (false, 'result');
  • //$this->exp->setObject (false, 'result'); $this->rows = $db->rows; return $out; }

Reported by Jamieson Christian · March 12th, 2009 @ 07:13 PM

State: resolved
Milestone: 5.0.3
Assigned to: lux lux

Activity

  1. Jamieson Christian
    Jamieson Christian

    Fix reposted with proper code formatting (fingers crossed):

    
    @@ -2719,7 +2719,7 @@ function _sql_end ($node) {
          $this->exp->setObject ($row, 'result');
          $out .= $this->fill ($this->wrap ($sql['sub']), $this->exp->register['object'], true);
        }
    -    $this->exp->setObject (false, 'result');
    +    //$this->exp->setObject (false, 'result');
        $this->rows = $db->rows;
        return $out;
      }
    

    March 12th, 2009 @ 07:15 PM

  2. lux
    lux
    • State changed from new to resolved

    This is fixed in the following commit:

    http://github.com/lux/sitellite/...

    April 6th, 2009 @ 01:16 PM

  3. Charles Brunet
    Charles Brunet
    • Milestone set to 5.0.3

    [milestone:id#47011 bulk edit command]

    August 7th, 2009 @ 09:41 AM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.