Generic Error After Clicking Buy on Shopping Cart
Автор: Craig G.
Просмотрено 2451,
Подписчики 2,
Размещенный 0
I'm using XAMPP (the latest version as of September 26, 2019) and get a "Generic Error" after clicking the "Buy" button. I there seems to be data logged to the MySQL database and I even get a e-mail notice. Is the any way to generate information about the source of this error, "Generic Error" is a useless error message.
When I logged onto the Website X5 Help Center, I got a "Generic Error" after clicking on the login button. This "Generic Error" message seems to be a common issue.
I am using Website X5 2019.2.8
Craig
Размещено
Автор
The error.log file generates the following message during this transaction:
[Sat Sep 28 22:52:56.758572 2019] [php7:notice] [pid 23492:tid 1864] [client ::1:63378] PHP Notice: Undefined index: order in C:\\xampp\\htdocs\\res\\x5engine.php on line 2139, referer: http://localhost/cart/index.html
[Sat Sep 28 22:52:56.758572 2019] [php7:notice] [pid 23492:tid 1864] [client ::1:63378] PHP Notice: Undefined index: settings in C:\\xampp\\htdocs\\res\\x5engine.php on line 2140, referer: http://localhost/cart/index.html
[Sat Sep 28 22:52:59.113275 2019] [php7:notice] [pid 23492:tid 1864] [client ::1:63378] PHP Notice: Undefined index: order in C:\\xampp\\htdocs\\res\\x5engine.php on line 2139, referer: http://localhost/cart/index.html
[Sat Sep 28 22:52:59.114271 2019] [php7:notice] [pid 23492:tid 1864] [client ::1:63378] PHP Notice: Undefined index: settings in C:\\xampp\\htdocs\\res\\x5engine.php on line 2140, referer: http://localhost/cart/index.html
Автор
Line 2139 and 2140 in x5engine.php are:
2139: $orderData = $filters['order'] ? $this->applyFilter($this->orderData, $filters['order']) : $this->orderData;
2140: $settings = $filters['settings'] ? $this->applyFilter($this->settings, $filters['settings']) : $this->settings;
Hello.Read these posts.Maybe you will find the answer there.But I would recommend trying to test the site on real hosting.
https://helpcenter.websitex5.com/ru/post/210532
https://helpcenter.websitex5.com/ru/post/207437
https://helpcenter.websitex5.com/ru/post/210942
https://helpcenter.websitex5.com/ru/post/209978
https://helpcenter.websitex5.com/ru/post/210703
try to change your PHP version on XAMPP
7.x ???
Автор
I'm using version 7.3.9 of PHP, this is the version distributed with the current version of XAMPP.
Try to test site on a shared hosting.Try PHP 7.2.
Автор
Same issue with PHP 7.2.2
Автор
Issue is occurs in 2019.3.4 Preview as well.
You tested on a shared hosting or on XAMPP?
Look at the error logs on the server, if it is a shared hosting. Try contacting the technical support service of your hosting provider.
Автор
XAMPP, the error log still tells me:
[Thu Oct 03 23:55:53.011891 2019] [php7:notice] [pid 5768:tid 1888] [client ::1:59877] PHP Notice: Undefined index: order in C:\\xampp\\htdocs\\res\\x5engine.php on line 2139, referer: http://localhost/cart/index.html
[Thu Oct 03 23:55:53.011891 2019] [php7:notice] [pid 5768:tid 1888] [client ::1:59877] PHP Notice: Undefined index: settings in C:\\xampp\\htdocs\\res\\x5engine.php on line 2140, referer: http://localhost/cart/index.html
[Thu Oct 03 23:55:55.057462 2019] [php7:notice] [pid 5768:tid 1888] [client ::1:59877] PHP Notice: Undefined index: order in C:\\xampp\\htdocs\\res\\x5engine.php on line 2139, referer: http://localhost/cart/index.html
[Thu Oct 03 23:55:55.057462 2019] [php7:notice] [pid 5768:tid 1888] [client ::1:59877] PHP Notice: Undefined index: settings in C:\\xampp\\htdocs\\res\\x5engine.php on line 2140, referer: http://localhost/cart/index.html
Which in x5engine.php and is within the "sendOrderEmail" function:
$orderData = $filters['order'] ? $this->applyFilter($this->orderData, $filters['order']) : $this->orderData;
$settings = $filters['settings'] ? $this->applyFilter($this->settings, $filters['settings']) : $this->settings;
So it is an undefined it, I am assuming that would be the index for "$filter" because there is no other array.
Craig
Hello Craig,
The entries in the log are notices as opposed to errors... there is a significant difference in PHP.
Your XAMPP setup is incorrectly configured as notices should normally only be displayed during PHP development.
You will have to modify your XAMPP installation to suppress PHP notices and then WebSite X5 will run correctly.
Kind regards,
Paul
Search the WebSite X5 Help Center (multilingual)
Автор
Hi Paul,
These notices brought to light what looks like a bug. I recoded the x5engine.php as indicated previosly and my "Generic Error" went away. I may not be a PHP programmer but I have been programming in C/C++ for over 30+ years and accessing an undefined variable is a problem.
Craig
Автор
Hmmm... My description of the problem didn't get posted.
Glad you've sorted it.
Автор
Here is what I see as the problem:
private function sendOrderEmail($isOwner, $from, $to, $filters = array())
{
global $imSettings;
global $ImMailer;
$orderData = $filters['order'] ? $this->applyFilter($this->orderData, $filters['order']) : $this->orderData;
$settings = $filters['settings'] ? $this->applyFilter($this->settings, $filters['settings']) : $this->settings;
If there is no 4th parameter passed, "$filters" is assigned to "array()". That would mean that "$filters['order']" is undefined and the access to "$filters" via "$filters['order']" in the first executable line in function "sendOrderEmail" would fail.
If the code is replaced with:
$orderData = isset($filters['order']) ? $this->applyFilter($this->orderData, $filters['order']) : $this->orderData;
$settings = isset($filters['settings']) ? $this->applyFilter($this->settings, $filters['settings']) : $this->settings;
"isset" test if the variable "$filters['order']" is defined and not the value contained in it.
The function "sendOwnerEmail":
public function sendOwnerEmail()
{
global $imSettings;
return $this->sendOrderEmail(true, $imSettings['general']['use_common_email_sender_address'] ? $imSettings['general']['common_email_sender_addres'] : $this->settings['owner_email'], $this->settings['owner_email']);
}
This would mean that "sendOwnerEmail" would call "sendOrderEmail" with only 3 parameters, not 4, this would fail.
Updating the x5engine.php code with "isset" seems to correct the "Generic Error" issue.
Since x5engine.php is part of Website X5, it isn't solved because, the developers will have to correct it or every time I do a Website X5 Pro update my version of x5engine.php will be overwritten.
Craig
Автор
Since this is a bug, do developers mark this discussion as fixed when the bug is fixed?
Do I need to contact support to resolve this?
I sent a request to the developers.Expect an answer from them here in the comments.
Hello Craig
Thank you for your analysis of the situation. The issue is currently known and should be easily fixed for the moment by disabling the PHP warnings on your server. This will prevent error text to appear in the website thus causing the issue during the checkout process.
I have notified the developers of this again so that the issue might be analyzed further
Thank you
Stefano
Автор
I'm not sure if this would fully correct the issue because the corrected code that I inserted allows the email to be generated correctly, while the incorrect code does not generate the email. Turning off reporting of the error gets rid of the message but not the problem with sending out the email.