Jumat, 23 Oktober 2015

Illegal string offset 'field' in DatabaseCondition->__clone() (line 1901 of /usr/local/www/drupal7/includes/database/query.inc

Fresh Install of drupal7-7.12 on freebsd 8.2 generic amd64 intel quad core with php5.4.3 msql-server 5.1.63
The following double warning is seen on the welcome page:
Warning: Illegal string offset 'field' in DatabaseCondition->__clone() (line 1901 of /usr/local/www/drupal7/includes/database/query.inc).
Warning: Illegal string offset 'field' in DatabaseCondition->__clone() (line 1901 of /usr/local/www/drupal7/includes/database/query.inc).
Some advice would be welcome

The Solution to this issue seems to be pretty straight-forward:
Just add a Conditional Logic within the FOREACH Loop (inside the __clone() Function).
The conditional logic checks if $condition["field"] is set before running the body of the Loop.
Here below is the Function with the new Conditional Logic but first follow these few steps:

1. Open up /includes/database/query.inc in your editor.
2. Find the Function __clone (probably on Line 1901 [in Your case]
3. Replace that Function with the One below and that's it....



<?php
function __clone() {
    $this->changed = TRUE;
    foreach ($this->conditions as $key => $condition) {
        if( isset($condition['field'])){     //THIS SHOULD TAKE CARE OF THE ERROR 
            if ($condition['field'] instanceOf QueryConditionInterface) {
                $this->conditions[$key]['field'] = clone($condition['field']);
            }
        }
    }
 }
?>

Tidak ada komentar:

Posting Komentar