Fixing notice errors caused by incorrect datatyping in php4.

This commit is contained in:
Mark Story 2010-01-11 09:44:51 -05:00
parent 896414e632
commit 4ada5b7eea
2 changed files with 2 additions and 2 deletions

View file

@ -1884,7 +1884,7 @@ class DboSource extends DataSource {
if ($count >= 1 && !in_array($fields[0], array('*', 'COUNT(*)'))) {
for ($i = 0; $i < $count; $i++) {
if (in_array($fields[$i], $virtual)) {
if (is_string($fields[$i]) && in_array($fields[$i], $virtual)) {
unset($fields[$i]);
continue;
}

View file

@ -2934,7 +2934,7 @@ class DboSourceTest extends CakeTestCase {
* @return void
*/
function testFieldsWithExpression() {
$expression =& $this->testDb->expression("CASE Sample.id WHEN 1 THEN 'Id One' ELSE 'Other Id' END AS case_col");
$expression = $this->testDb->expression("CASE Sample.id WHEN 1 THEN 'Id One' ELSE 'Other Id' END AS case_col");
$result = $this->testDb->fields($this->Model, null, array("id", $expression));
$expected = array(
'`TestModel`.`id`',