Hello,

I am recieving the following error;

Recoverable fatal error: Method DatabaseCondition::__toString() must return a string value in i18n_select_check_query() (line 118 of D:\.....\sites\all\modules\i18n\i18n_select\i18n_select.module).

I have i18n 7.x-1.0-alpha2, variable 7.x-1.0-alpha3 and views 7.x-3.x-dev installed with all submodules enabled ...

I can reproduce this error with these steps;

- Enable views module,
- Enable taxonomy_term view,
- Visit a term page taxonomy/term/5,
- Error.

Thanks.

CommentFileSizeAuthor
#5 i18n_select_module.patch523 bytesJerome F

Comments

amalaer’s picture

same here with views 7.x-3.0-alpha1

MrRoxy’s picture

same here with views 7.x-3.0-alpha1

erdembey’s picture

Let me share a possible solution to this problem;

Change the code below in "modules\i18n\i18n_select\i18n_select.module" line 118;

if (is_array($condition) && isset($condition['field']) && ($condition['field'] == $field_name || $condition['field'] == $table_field)) {

with

if (is_array($condition) && isset($condition['field']) && is_string($condition['field']) && ($condition['field'] == $field_name || $condition['field'] == $table_field)) {

it seems it's working without a problem.

Can anyone confirm this ?

janeks’s picture

It worked for me.

Jerome F’s picture

Status: Active » Needs review
StatusFileSize
new523 bytes

I ran a patch with #3 because it worked for me too, I finally can preview my views again :-) thanks.

ytsurk’s picture

same here - #3 solves the error

nils_r’s picture

#3 works for me too.

Blooniverse’s picture

Version: 7.x-1.0-alpha2 » 7.x-1.x-dev

Tested patch#5 respectively #3 with 'i18n 7.x-1.x-dev (2011-Feb-14), v1.1.2.3' in combination with ~80 additional/optional modules: This works fine!

Remark: Line of mutation/modification has changed in this version from 115 to 118!

Blooniverse’s picture

Status: Reviewed & tested by the community » Needs review

[EDIT:del] ... by the way, the language switcher block doesn't want to show up after activation.

Blooniverse’s picture

Status: Needs review » Reviewed & tested by the community
erdembey’s picture

Version: 7.x-1.x-dev » 7.x-1.0-alpha3
Status: Needs review » Reviewed & tested by the community

This problem still exist in 7.x-1.0-alpha3 release ...

I've applied the patch to the line 209 in the same file of 7.x-1.0-alpha3 release ... Problem moved from line 118 to line 209.

betz’s picture

patch on #5 did work out for me

jose reyero’s picture

Status: Reviewed & tested by the community » Fixed

Fixed on github. Will be in next alpha.

Thanks.

However I'd like to know why when enabling Views, that 'field' is not a string anymore, maybe we should file an issue for Views?

Blooniverse’s picture

@Jose Reyero: Great, thank you! Please don't forget to update the coming dev version as well.

Concerning the array content of $condition['field'] -- I don't get your question, sorry. Do you mean, when you enable the 'Views' module, field is not a string anymore? Is that really possible?

jose reyero’s picture

@the_phi,

Yes, that's what was causing the error, it seems to happen only with views

Blooniverse’s picture

... in this case I would issue/file a bug report, yes.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Version: 7.x-1.0-alpha3 » 7.x-1.4
Component: Code » Miscellaneous
Status: Closed (fixed) » Needs work

Still getting the same problem in 7.x-1.4. with patch http://drupal.org/files/i18n-clean_select_api-1437932-25.patch

Cannot directly apply the patch in this thread as line:

if (is_array($condition) && isset($condition['field']) && ($condition['field'] == $field_name || $condition['field'] == $table_field)) {

has changed in 7.x-1.4 to:

$conditions =& $query->conditions();
foreach ($conditions as $index => $condition) {
if (is_array($condition) && isset($condition['field'])) {
if (strpos($condition['field'], '.') === FALSE) {
if ($table_alias) {
// Change the condition to include a table alias.
$conditions[$index]['field'] = $table_alias . '.' . $condition['field'];
}
else {
// We won't risk joining anything here.
return FALSE;
}

Note: Choosing "Only the listed pages" instead of "All pages except those listed" in Module Multilingual select removes error.

jose reyero’s picture

Priority: Major » Normal

Do you mean this is happening with latest -dev version? (which has all that patches applied)

Anonymous’s picture

Hi Jose: I am using a patched 7.x-1.4 as per my earlier note. I'll go ahead & try the dev version. Site is not operational yet anyway. Thanks again for all the hard work on this module!

jose reyero’s picture

Status: Needs work » Closed (fixed)

Then please let's leave this closed until you test latest version.

grozozo’s picture

Hi!
It seem that the patch commited for this issue: http://drupal.org/node/1437932 lead to this error again.
I had the issue from the link, I passed to dev version with the patch, that fixed the issue but recreate this one.

Recoverable fatal error: Method DatabaseCondition::__toString() must return a string value en i18n_select_check_query() (lÃnea 270 demyhost/drupal/sites/all/modules/i18n/i18n_select/i18n_select.module).

And as the code as changed, the solution is not applicable.

BTW I'm on drupal 7.12 with internationalization 7.x-1.4+5-dev

grozozo’s picture

Version: 7.x-1.4 » 7.x-1.x-dev
Status: Closed (fixed) » Active

I have to add that this error appear when I make a search on my drupal.
I reopen the issue, it seem relevant as I'm not the only one to have it...

jose reyero’s picture

Status: Active » Fixed

Right, there was a wrong operator when checking the query.

Fixed again.

grozozo’s picture

now working with 7.x-1.4+6-dev
Thx Jose, you're doing great work :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.