Hi!
We are using drupal ubercart 6.x-2.0 with File download (uc_file) module for virtual products.
Following error message, we are getting while the check out completed & after the paypal payment completes.
* recoverable fatal error: Object of class stdClass could not be converted to string in /home/dealback/public_html/includes/bootstrap.inc on line 774.
* warning: preg_match() expects parameter 2 to be string, object given in /home/dealback/public_html/includes/bootstrap.inc on line 777.
Thanks in advance.
IT Web - Q Solutions
Providing web solutions for open source communities
Comments
Comment #1
earthangelconsulting commentedi am getting the same error, in exactly the same situation, but with 6.x-2.2
it's a call to drupal_validate_utf8 that is being passed an object instead of a string
probably one of the calls to filter_xss or filter_xss_admin that are within Ubercart somewhere... and something that occurs only when there's downloadable files involved.
that's as far as i have managed to trace it.
HELP!
Peter 'Fish' Fisera
GoatVirus Technologies
Comment #2
earthangelconsulting commentedactually, could be a call to check_plain as well... though i haven't found out yet where this is happening in the uc_files module
Comment #3
earthangelconsulting commentedfound a potential fix... if you are having this problem, see this thread in the Ubercart forums:
http://www.ubercart.org/forum/development/12710/error_occurs_when_checki...
Comment #4
landry commentedBug still happens with 6.x-2.4. No more information can be gathered from the ubercart forum post.
If i dump $file_expiration in uc_file.ca.inc:uc_file_order_action_mail(), it's an array of file objects, definitely not strings. From my understanding, it needs to be an array of objects so that uc_file_token_values() calls theme_uc_file_downloads_token() with the correct parameters.
Looking at token_replace_multiple() code, the key in the 'replacements' array for $file_expiration is 'uc_file', which should be recognized as an object. According to the comment : "If an object is passed as value, the key should contain the object's type. For example, 'node', 'comment', or 'user'. The object will be used for building substitution values.". But then in our case it's an array of objects....
In the end, we have to find why is token_replace_multiple calling check_plain with each objects in the array ? It seems the more or less same code is present in uc_roles.ca.inc & uc_order.ca.inc..
Comment #5
landry commentedMore details.. i'm pretty sure validate_utf8 is called by check_plain and not by filter_xss, but there's no check_plain() call involved in the codepath taken in token. and the use of filter_xss in ubercart is not involved in the 'send user an email' case.
Comment #6
landry commentedokay, used the awesome trace module, and here's the php backtrace (i've stripped the thousands of line of file objects):
using addresses 6.x-1.05. Looking at the corresponding code in addresses_token_values() in this version of the module, the error now makes sense. updating to addresses 6.x-1.10 fixes the issue (well, i dunno if it works, but it doesn't break uc_file).
http://drupalcode.org/viewvc/drupal/contributions/modules/addresses/addr...
If someone encounters this issue, look at the other modules you have installed. Marking closed.