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

Thanks

David
CONTEXT NOTE:

See previous posting on Subject:
Notice: Array to string conversion in menu_link_save() (line 3155 of /usr/local/www/drupal7/includes/menu.inc)

Comments

vizion’s picture

The previously raised issue seems to be solved by the patch:
http://drupal.org/files/php54_can_die_in_a_fire.patch
Does anyone have a patch for the ddatabase/query.inc bug?

David

PS

Just upgraded drupal to 7.7.14 and that solves the query.inc bug

Thank you

David

egmont’s picture

collation utf8mb4_unicode_ci

drupal 7.67

Clean installation.
Alexander Allen’s picture

Replicated the issue using PHP 5.4.x, and also solved by updating to Drupal 7.14 and running update.php.

Thank you.

rccastilla’s picture

I had the same error and solved it by downloading the version 7.15 of drupal on my pc and replacing the file file.inc located in htdocs / xampp / ... / includes / database / query.inc of the 7.14 by the 7.15.

son_of_flynn’s picture

I had this problem amongst others while trying to install the "Using Drupal 2nd Edition" source (Drupal 7.12) on Windows 7 using Wamp 2.5.

If anyone else has this problem here's how I solved the first error encountered:

NOTE: This must be done BEFORE install.

1.) File: /drupal-7/includes/unicode.inc

Changed Line #76 from:

'\x{D800}-\x{F8FF}\x{FB29}\x{FD3E}-\x{FD3F}\x{FDFC}-\x{FDFD}' .

To:

'\x{E800}-\x{F8FF}\x{FB29}\x{FD3E}-\x{FD3F}\x{FDFC}-\x{FDFD}' .

As per the same file in Drupal 7.34, yes, really that simple, one letter changed.

NOTE: Below must be done DURING install (the configure site page when the error appears).

2.) File: /drupal-7/includes/menu.inc

Changed line #3155 from:

if (!$existing_item || (array_intersect_assoc($item, $existing_item)) != $existing_item) {

To:

if (!$existing_item || (array_intersect_key($item, $existing_item) != $existing_item)) {

Method change and brackets were in the wrong places.

Below is how I solved the error specific to THIS post...

NOTE: The below must be done AFTER install, after clicking visit your site and getting the error.

3.) File: drupal-7/includes/database/query.inc

Couldn't identify the error so replaced with same file from Drupal 7.34.

Hope this helps another Drupal newbie like me!

Rihab BJ’s picture

i replaced it with the same file from Drupal 7.34
but i show some error
when i Hand Over the original query.inc i show this error will appear

Warning: Illegal string offset 'field' in DatabaseCondition->__clone() (line 1817 of C:\wamp\www\drupal\drupal-7.7\includes\database\query.inc).
Warning: Illegal string offset 'field' in DatabaseCondition->__clone() (line 1817 of C:\wamp\www\drupal\drupal-7.7\includes\database\query.inc).

poiz’s picture

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....

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']);
		    }
	    }
    }
 }

Don't forget to let me know if this helps....

Cheers...
  
 

borismattijssen’s picture

Thanks, that worked for me!

aadil_hussain’s picture

I am new in Drupal. Thanks for your solution. Its working.

furroloco’s picture

amazing.
work perfectly
thanks

sagarchauhan’s picture

Worked like a charm. Thanks a lot.

gto1’s picture

This worked great.

Olawunmi’s picture

Thanks Alot,in fact the solution solved my problem. thanks very much

kouul’s picture

Thanks :)

radha29’s picture

Thanks .It works Great !

Cheers..

TheInfRiNgeROfCalmNeSs’s picture

Hey, poiz! It works! Thank you so much! =)

smartankur4u’s picture

it workeddddddddd

egmont’s picture

No help it. Linux mint php 7.0 drupal 7 Warning: Illegal string offset 'field' in DatabaseCondition->__clone() (line 1817 of /var/www/html/d7/includes/database/query.inc). This is searc any method to solved main problem with drupal 8 [ path url index.php, only possible to in with
http://localhost/d8_2/admin/content The requested URL /d8_2/admin/content was not found on this server.
localhost/d8_2/index.php/update.php/ ->http://localhost/d8_2/index.php/admin/modules -> it's possible. But
http://localhost/d8_2/index.php/ -> de nuevo - The requested URL /d8_2/admin/modules was not found on this server.
And I don't to do with it. my private email a89112715067@gmail.com Soy russo And I don't know englich reasonably bad. Thank your. Sergyo. 22.09.2017 22:36:34 msk good luck.

glmrenard’s picture

Hi guys,

Same for me, after having done all is written here AND https://www.drupal.org/node/1442876
I now have no error message but get to a 500
http://.../install.php?profile=ch03_jobs&locale=en&id=2&op=finished

curl "http://usingdrupal.guillaumerenard.fr/install.php?profile=ch03_jobs&loca..." -H "Pragma: no-cache" -H "Accept-Encoding: gzip, deflate, sdch" -H "Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4,de;q=0.2" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" -H "Referer: http://usingdrupal.guillaumerenard.fr/install.php?profile=ch03_jobs&loca..." -H "Cookie: SESS4140d02837532dbf25050fbcc42a752d=wtgaaoq1mLdI85kJCqY8sn7_D_yOvG9gGHlCkx0V0Oc; has_js=1" -H "Connection: keep-alive" -H "Cache-Control: no-cache" --compressed

--> 500

No idea what to do to have this drupal book working with 7.12

Happy easter !

gameofbuzz’s picture

function __clone() {
  $this->changed = TRUE;
  foreach ($this->conditions as $key => $condition) {
    if ($key !== '#conjunction') {
      if ($condition['field'] instanceOf QueryConditionInterface) {
        $this->conditions[$key]['field'] = clone($condition['field']);
      }
      if ($condition['value'] instanceOf SelectQueryInterface) {
        $this->conditions[$key]['value'] = clone($condition['value']);
      }
    }
  }
}
jigneshkumar’s picture

hi,
this is known bug using php5.4.* you can solve it by using patch
http:/ /drupal.org/files/php54_can_die_in_a_fire.patch
or you also can upgrade Drupal to 7.7.14 that solves query.inc bug. Or you can manually add condition to check $condition['field'] is available or set to use or not in clone function of query.inc file.

thanks

shreepa.bss@gmail.com’s picture

this is working for me