WebSite X5Help Center

 
Craig G.
Craig G.
User

Generic Error After Clicking Buy on Shopping Cart  en

Auteur : Craig G.
Visité 2111, Followers 2, Partagé 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

Posté le
19 RéPONSES - 1 UTILES - 1 CORRECT
Craig G.
Craig G.
User
Auteur

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

Lire plus
Posté le de Craig G.
Craig G.
Craig G.
User
Auteur

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;

Lire plus
Posté le de Craig G.
Axel  
Axel  
User

try to change your PHP version on XAMPP

7.x ???

Lire plus
Posté le de Axel  
Craig G.
Craig G.
User
Auteur

I'm using version 7.3.9 of PHP, this is the version distributed with the current version of XAMPP.

Lire plus
Posté le de Craig G.
Aleksej H.
Aleksej H.
Moderator

Try to test site on a shared hosting.Try PHP 7.2.

Lire plus
Posté le de Aleksej H.
Craig G.
Craig G.
User
Auteur

Same issue with PHP 7.2.2

Lire plus
Posté le de Craig G.
Craig G.
Craig G.
User
Auteur

Issue is occurs in 2019.3.4 Preview as well.

Lire plus
Posté le de Craig G.
Aleksej H.
Aleksej H.
Moderator

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.

Lire plus
Posté le de Aleksej H.
Craig G.
Craig G.
User
Auteur

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

Lire plus
Posté le de Craig G.
Paul M.
Paul M.
Moderator

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)

Lire plus
Posté le de Paul M.
Craig G.
Craig G.
User
Auteur

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

Lire plus
Posté le de Craig G.
Craig G.
Craig G.
User
Auteur

Hmmm... My description of the problem didn't get posted.  

Lire plus
Posté le de Craig G.
Paul M.
Paul M.
Moderator

Glad you've sorted it.

Lire plus
Posté le de Paul M.
Craig G.
Craig G.
User
Auteur

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

Lire plus
Posté le de Craig G.
Craig G.
Craig G.
User
Auteur

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?

Lire plus
Posté le de Craig G.
Aleksej H.
Aleksej H.
Moderator

I sent a request to the developers.Expect an answer from them here in the comments.

Lire plus
Posté le de Aleksej H.
Incomedia
Stefano G.
Incomedia

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

Lire plus
Posté le de Stefano G.
Craig G.
Craig G.
User
Auteur

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.

Lire plus
Posté le de Craig G.