#122 ✓resolved
Jamieson Christian

<xt:sql> fails when query returns records

Reported by Jamieson Christian | March 12th, 2009 @ 07:13 PM | in 5.0.3 (closed)

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; }

Comments and changes to this ticket

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

The Sitellite web content management system.

People watching this ticket

Pages