kiranpatil353 / google-checkout-php-sample-code

Automatically exported from code.google.com/p/google-checkout-php-sample-code
0 stars 0 forks source link

CheckoutServer2Server Munges the URL and Break URL Parameters #37

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Using the code downloaded today (2008-11-08), 1.2.5c (but extracts to
directory named 1.2.5b)

Server Apache 2.2.9, PHP 5.2.6, Gentoo 2008.0

1. Make a new GoogleCart();
2. Add some GoogleItems();
3. Call $gc->CheckoutServer2Server();

I expect to see the Checkout page, showing my item and the regular checkout
process, instead I see and error page with this: 
-----
Oops!
There was an error processing your request. Please go back and try again.
-----

The issues is that the constructed URL from CheckoutServer2Server() is
putting this:

https://sandbox.google.com/checkout/view/buy?o=shoppingcartshoppingcart=97608991
4741774

But it should be:
https://sandbox.google.com/checkout/view/buy?o=shoppingcart&shoppingcart=9760899
14741774

See that? It's missing the & that separates the parameters.  Fundamental
rules of the internet, & separates the URL parameters in a query string

To workaround this I had to hack the checkout code, find where that URL was
created and then repair it after it comes out of the processor.  Seems like
a double-de/encoding bug or maybe related to magic_quotes? IDK

My dirty hack is in googlerequest.php at or around line 135, like this:

$data[$root]['redirect-url']['VALUE'] =
str_replace('shoppingcartshoppingcart','shoppingcart&shoppingcart',$data[$root][
'redirect-url']['VALUE']);

Original issue reported on code.google.com by edoceo....@gmail.com on 10 Nov 2008 at 8:42

GoogleCodeExporter commented 8 years ago
I ran into this problem as well. Thanks for the workaround.

Original comment by rgustine...@gmail.com on 7 Jan 2009 at 5:17

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
This is a PHP/libxml2 bug. Either upgrade to a fixed version, or use libexpat 
instead.

See:
* http://bugs.php.net/bug.php?id=45996
* http://bugs.gentoo.org/show_bug.cgi?id=249703

See also http://blog.code-head.com/fixing-libxml-php-bug-and-issues-with-html-
entities-libexpat, but I haven't tested out this fix method.

Thanks TML from ##php for pointing this out to me.

Original comment by yuval.ha...@gmail.com on 23 Jan 2009 at 9:56

GoogleCodeExporter commented 8 years ago

Original comment by peng.y...@gmail.com on 29 Jan 2009 at 12:52

GoogleCodeExporter commented 8 years ago
Will try it.

http://www.carazoo.com/

Original comment by izmocars...@gmail.com on 4 Mar 2009 at 7:13

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
MUCHAS GRACIAS it save my life :P

Original comment by claudi...@gmail.com on 29 Jul 2009 at 3:08

GoogleCodeExporter commented 8 years ago
Parse error: syntax error, unexpected ';' in
xxxxxxxx/xxxxxx/xxxxxxx/payments/google/library/googlerequest.php on line 135

Original comment by karlnorm...@gmail.com on 25 Nov 2009 at 1:29

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
should be fixed in 1.3.0

Original comment by peng.y...@gmail.com on 13 Sep 2010 at 9:29