When I have a product with an attribute associated with a view for products in a taxonomy and and I finish the checkout everything works.
But when I go to review the content I receive an error for each attribute in the product.
* warning: preg_match() expects parameter 2 to be string, array given in /var/www/html/drupal/includes/bootstrap.inc on line 771.
* warning: preg_match() expects parameter 2 to be string, array given in /var/www/html/drupal/includes/bootstrap.inc on line 771.
* warning: preg_match() expects parameter 2 to be string, array given in /var/www/html/drupal/includes/bootstrap.inc on line 771.
* warning: preg_match() expects parameter 2 to be string, array given in /var/www/html/drupal/includes/bootstrap.inc on line 771.
* warning: preg_match() expects parameter 2 to be string, array given in /var/www/html/drupal/includes/bootstrap.inc on line 771.
Am I not dong something right or is this a bug? Is there a wordkaround or better way to accomplish this?
Thanks in advanced and love the module.
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | before.jpg | 11.5 KB | bisonbleu |
| #16 | after.jpg | 11.11 KB | bisonbleu |
| #10 | uc_node_checkout_theme.patch | 529 bytes | jeffam |
| uc_node_checkout_error.jpg | 73.68 KB | blagrone |
Comments
Comment #1
blagrone commentedOn further work on this I found it was caused by what I think is some bad code in the bootstrap.inc file.
I posted my solution here:
http://drupal.org/node/225211#comment-1934784
Comment #2
blagrone commentedSorry to keep hijacking my own thread:
Here is an update as I posted this in the Ubercart forums, can anyone help me find where to fix this. I'll keep looking and post answers since I've already talked to a few others who have the same problem.
I'm using node checkout with ads, and everything works great except when it's passed to the order and views I get this error. Also the attributes do not show.
* warning: preg_match() expects parameter 2 to be string, array given in /var/www/html/drupal/includes/bootstrap.inc on line 771.
* warning: preg_match() expects parameter 2 to be string, array given in /var/www/html/drupal/includes/bootstrap.inc on line 771.
* warning: preg_match() expects parameter 2 to be string, array given in /var/www/html/drupal/includes/bootstrap.inc on line 771.
* warning: preg_match() expects parameter 2 to be string, array given in /var/www/html/drupal/includes/bootstrap.inc on line 771.
* warning: preg_match() expects parameter 2 to be string, array given in /var/www/html/drupal/includes/bootstrap.inc on line 771.
The problem it seems to me is that either Ubercart or node checkout is passing an array through the bootstrap.inc utf8 preg_match filters and failing.
I tried editing the filter to implode the array which removed the error, HOWEVER I received a proper lashing on that forum for hacking core.
I get the point, 'NO HACKING CORE' is a rule to be followed, so I'm chasing the error to find what module generates the array. I hope to be able to find where I can implode the error to the string in Ubercart, or if anyone know where I should in node checkout.
Any advice, links?
Thanks and pints in advance.
Ben
Comment #3
wesjones commentedI am getting the same message:
warning: preg_match() expects parameter 2 to be string, array given in xxx\includes\bootstrap.inc on line 771.
I have narrowed this issue to UC Node Checkout. It is not handling attributes correctly. I don't see any problems until the order is completed. Once order is completed, whenever I view a node created by uc node checkout that has been purchased, I get the message above.
Attributes are handled a little differently now that checkboxes have been included in ubercart attributes. UC Node Checkout needs updating so it will know how to handle attributes correctly. Patch is not likely from me. Would love to get some help on this.
Comment #4
wesjones commentedI think I figured out where the problem lies. In uc_node_checkout.module on line 734 the $options variable turns out to be an array. So I added a foreach loop to cycle through the items in the array.
Before:
After:
Comment #5
benstallings commentedThank you for this solution, wesoccer2003! I can confirm that it solves the problem.
Comment #6
codenamerhubarb commentedThis fixed the problem for me too. Thanks heaps.
Comment #7
echoz commentedFixed it for me too, although a note for those searching, on drupal 6.15 the error is line 777 of bootstrap.inc
Comment #8
matthewn commentedJust another "me too" with a thanks for wesoccer2003 for the working solution at #4.
Comment #9
echoz commentedAs I wrote in #7 I applied the override successfully (in template.php), but I think an issue I have is related, and hoping this fix can be adjusted.
The ul class product-description prints out to the order record + customer email, with one list item for my one option, plus an empty list item. For a product that has no options, it outputs an empty list item. It prints the bullet followed by the colon that would come between the attribute name and the option.
It seems this is produced from function theme_uc_product_attributes, in uc_attribute.admin.inc, but since what I'm seeing is not reported elsewhere, I'm wondering if the code from #4 is causing this. Is anyone who has applied this seeing an empty list item in ul class product-description (in the order record + customer email)?
A list appears correctly with no extra empty bullet on cart, cart/checkout, cart/checkout/review or the cart block.
Comment #10
jeffamHi,
I just bumped into this bug, too, and made my own patch before noticing that there was already an open issue. For what it's worth, here's my fix.
Jeff
Comment #11
echoz commentedI tested #10 instead of #4 and no errors, except I still get the same as I described in my #9 post, the extra empty bullet and colon. Viewing the order, the empty bullet proceeds the real attribute: option, and on the invoice, it's after it. Is anyone else getting this, to help debug if this is about uc_node_checkout or unique to something else I'm doing?
Comment #12
qinwubi commentedsame issue, but #10 fixed mine perfectly. thanks!
Comment #13
echoz commentedI figured out my issue in #9 and #11, and is unrelated to the patches offered. It was caused by deleting the defaults in the fields of the last item in uc_node_checkout settings, even though checkbox "Add to the default node cart teaser using these settings" is unchecked. I think this is a bug, I'll open its own issue.
Comment #14
pkiff commentedPatch #10 fixed the described problem on my install also (Drupal 6.16, UC Node Checkout 6.x-2.0-beta4, IIS 7).
Thanks!
Phil.
Comment #15
nathanjo commentedConfirmed this is a bug.
#10 patch just works fine.
Comment #16
bisonbleu commentedApplied patch in #10.
And Alleluia brothers & sisters! :-)
This one has been nagging me for months.
Nodes created by uc_node_checkout were showing "Original product attributes" as empty.
The attribute is back & properly displayed.
Bravo!
Comment #17
tchurch commentedI have also tested #10 (manually updated my module file as not in position to run a patch from where I am currently) and it worked.
This also fixes my issues #851084: Product attributes cause errors and #900336: htmlspecialchars error (which I will now close).
When will this be added to a new version (-dev or otherwise)?
Comment #18
baff commented#10 removed warning "html special character ..." and in addition attribute options are showing up now on node view -thank you jeffam
Comment #19
aidanlis commentedFixed in http://drupal.org/sandbox/aidan/1114812
Comment #20
aidanlis commentedFixed: Commit 46f89cc on 6.x-2.x