I updated to 7.x - 1.3

When i go to the listing message page (/messages), i obtain a blank page with this issue:

Catchable fatal error: Object of class stdClass could not be converted to string in /usr/local/drupal/includes/theme.inc on line 2594

I rerolled back to 7.x-1.2 and apply each patch until i get this error.

Applying patch from http://drupal.org/node/1282108 make this error

theses two lines seems to be the cause:

$user_ids = privatemsg_user_load_multiple(array($uid));
if ((int)$uid > 0 && ($account = array_shift($user_ids))) {

Important notice: i use PostgreSQL 8

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Berdir’s picture

Thanks for tracking this down.

You really want to learn about git bisect: http://www.palantir.net/blog/using-git-bisect-fun-and-profit. That makes a task like this much faster.

Jibus’s picture

Status: Active » Needs review
FileSize
613 bytes

Hi Berdir,

Thanks for your answer ! I didn't know about bisect. As you say, it seems to be very helpful !

I tryed to look into this problem. I am not an expert, but below is what i found.

When i have Catchable fatal error, i did a "return browser" (sorry for my bad english). And this error appers:

PDOException: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: "" LINE 4: WHERE (base.uid IN ('')) ^: SELECT base.uid AS uid, base.name AS name, base.pass AS pass, base.mail AS mail, base.theme AS theme, base.signature AS signature, base.signature_format AS signature_format, base.created AS created, base.access AS access, base.login AS login, base.status AS status, base.timezone AS timezone, base.language AS language, base.picture AS picture, base.init AS init, base.data AS data FROM {users} base WHERE (base.uid IN (:db_condition_placeholder_0)) ; Array ( [:db_condition_placeholder_0] => ) in DrupalDefaultEntityController->load() (line 196 of /usr/local/drupal/includes/entity.inc).

It seems that there is an empty value passed into a query which make PostgreSQL generate an error.

I looked into the foreach set line 86 in privatemsg.module:

foreach ($users as $uid) {
    // If it is an integer, it is a user id.
    $user_ids = privatemsg_user_load_multiple(array($uid));

I added a condition which verify that $uid is not empty

  foreach ($users as $uid) {
    // If it is an integer, it is a user id.
    if(!empty($uid)){
	$user_ids = privatemsg_user_load_multiple(array($uid));
}

And it worked.

I made a patch (for 7.x-1.x) ... but in my opinion it resolves the issue, but it does not explain why $uid is sometimes empty (during the foreach).

I hope this will help in resolving this issue

Jibus’s picture

Sorry to re-up this issue but at this time i cannot upgrade to the latest version of privatemsg.

Would be great if someone can just take a look at this =)

Thanks

Jibus’s picture

Status: Needs review » Reviewed & tested by the community

Since this is a minor modification and there is no feedback since almost two months, i set this to RTBC. Update the status, if you think this need more testing

Jibus’s picture

Title: Catchable fatal error on the messages list page » PostgreSQL Error: catchable fatal error on the messages list page

Update title, this is a PG issue

Jibus’s picture

Any update on this ?

ranvir.prasad’s picture

In all queries in PostgreSQL, there should be check if any value being passed on as integer is actually integer, that can be checked with

where uid similar to '\d+'

Jibus’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
764 bytes

Yes, it seems more appropriate than just verifiying if it's not empty.

Reroll patch against the current dev.

Patch should resolve also some problems on Oracle too. See https://drupal.org/node/1840428

Would be nice if some PG users can review this in order to make this module play nice with PG again :)

Status: Needs review » Needs work

The last submitted patch, ensure_that_userid_is_integer-1714176-8.patch, failed testing.

Jibus’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, ensure_that_userid_is_integer-1714176-8.patch, failed testing.

Berdir’s picture

Version: 7.x-1.3 » 7.x-1.x-dev

You need to specify a dev version when uploading a patch. Patches are always applied against those.

Berdir’s picture

Status: Needs work » Needs review
Jibus’s picture

Status: Needs review » Reviewed & tested by the community

5 weeks without any comment.

In my Drupal site, i didn't have any problem

Set this to RTBC.

Jibus’s picture

Any chance to get this commited ? :=)

Berdir’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 7.x-1.x and 7.x-2.x.

Status: Fixed » Closed (fixed)

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