When an anonymous user tries to add a product to his shopping cart, a PDOException occurs. Here is the actual error message:
PDOException: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: "5a1517558180de423e23eb37d570a38f" LINE 4: WHERE (base.uid IN ('5a1517558180de423e23eb37d570a38f')) ^: 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] => 5a1517558180de423e23eb37d570a38f ) in DrupalDefaultEntityController->load() (line 196 of /var/websites/zzzzzzzzzzzzzz/htdocs/includes/entity.inc).
PostgreSQL cannot cast the session hash string to an integer and generates a PDOException. I am attaching a patch which fixes the issue. It is not tested thoroughly but seems to work.
Comment | File | Size | Author |
---|---|---|---|
#7 | 1429010-anonymous-order-uid.patch | 3.52 KB | longwave |
#5 | 1429010-anonymous-order-uid.patch | 954 bytes | longwave |
#4 | 1429010-anonymous-order-uid.patch | 868 bytes | longwave |
ubercart.anonymous_cart.patch | 708 bytes | vesselin | |
Comments
Comment #1
stano.lacko CreditAttribution: stano.lacko commentedThanks for this patch, I can prove, that it's working on PostgreSQL
Comment #2
SilviuChingaru CreditAttribution: SilviuChingaru commentedComment #4
longwavePlease test this patch.
Comment #5
longwaveActually, this should be more reliable, as it uses the same test as uc_cart_cron(). ctype_digit() and preg_match() may give false positives in a small number of cases.
Comment #6
TR CreditAttribution: TR commented22? At the *very* least, that deserves a line or two of comments.
Comment #7
longwaveThis patch reworks the UcOrder constructor entirely, adding a docblock and removing duplicated code.
Comment #8
longwaveCommitted #7.
Comment #10
liezie_D CreditAttribution: liezie_D commentedDear,
I encountered the same error as the original poster.
I applied the last patch in this thread. Anonymous users are now able to send items to the cart and view the cart.
However, when I press the "remove" button on one of the items, i get the error:
Fatal error: Cannot use [] for reading in C:\inetpub\drupal-7.12\modules\taxonomy\taxonomy.module on line 215
Second question: will this patch be part of the next version release, or do we need to patch with each uc upgrade?
Comment #11
liezie_D CreditAttribution: liezie_D commentedComment #12
liezie_D CreditAttribution: liezie_D commentedi've been able to resolve the taxonomy error by emptying the cart and clearing the cache.