google-code-export / google-checkout-oscommerce

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

Incorrect handling of now() sql function #102

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. OSCommerce store installed on a windows server
2. In the Google Checkout 1.5 payment module, click install

What is the expected output? What do you see instead?
I expected it to install. Instead I got a tep_error, invalid data provided 
for a datetime field.

What version of the product are you using? On what operating system?
1.5, Windows Server

Please provide any additional information below.
The issue is due to the value now() being encapsulated in quotes, so that 
when the SQL server (I assume it is an MSSQL server) reads the values, it 
sees it as a string, not a command.
In catalog/includes/modules/payments/googlecheckout.php
Line 229: This is where the now() value is added to the value_array
Line 233: The array is turned into a string, with each value encapsualted 
with a ' 

Suggested fix 1:
Line 229. Change "'now()'" to "date("Y-m-d H:m:s")" 

Suggested fix 2:
Line 233: Add above this line "$value_array[6] = date("Y-m-d H:m:s");"

Possible Problem with that fix:
Other SQL servers may not like the fix 1, so fix 2 with an appropriate 
check for the type of hosting environment may be more robust

Original issue reported on code.google.com by BenFr...@gmail.com on 23 Apr 2010 at 9:37