<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
-
Jamieson Christian March 12th, 2009 @ 07:15 PM
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; }
-
lux April 6th, 2009 @ 01:16 PM
- State changed from new to resolved
This is fixed in the following commit:
-
Charles Brunet August 7th, 2009 @ 09:41 AM
- Milestone set to 5.0.3
[milestone:id#47011 bulk edit command]
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.
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.