- Posts: 220
- Thank you received: 8
During checkout: Object of class stdClass could not be converted to string
4 years 6 months ago - 4 years 6 months ago #340028
by Udo
-- HikaShop version -- : 4.3.0
-- Joomla version -- : 3.10.6
-- PHP version -- : 7.4.28
-- Error-message(debug-mod must be tuned on) -- : Object of class stdClass could not be converted to string
Hi,
Suddenly checkout in the shop is blocked.
No problem in the first checkout step, the login.
In the second step the customer selects addresses. Clicking the button Next step results in a white page, 500 Internal Server Error, showing the text
This is in PHP 7.4.
When downgrading to PHP 7.3 the white page already comes right after the first step.
Then the error text is
Just before I upgraded Joomla 3.9.28 to Joomla 3.10.6
So that's probably related to the problem.
Please advice how to solve this problem.
Udo
EXTRA INFORMATION !
In error_log I discovered older notifications that might give a clue:
At that time I was still using Joomla 3.9.28 en PHP 7.3
-- Joomla version -- : 3.10.6
-- PHP version -- : 7.4.28
-- Error-message(debug-mod must be tuned on) -- : Object of class stdClass could not be converted to string
Hi,
Suddenly checkout in the shop is blocked.
No problem in the first checkout step, the login.
In the second step the customer selects addresses. Clicking the button Next step results in a white page, 500 Internal Server Error, showing the text
Code:
Object of class stdClass could not be converted to string
This is in PHP 7.4.
When downgrading to PHP 7.3 the white page already comes right after the first step.
Then the error text is
Code:
Recoverable fatal error: Object of class stdClass could not be converted to string in /PRIVATE/public_html/libraries/joomla/database/driver/mysqli.php on line 254
Just before I upgraded Joomla 3.9.28 to Joomla 3.10.6
So that's probably related to the problem.
Please advice how to solve this problem.
Udo
EXTRA INFORMATION !
In error_log I discovered older notifications that might give a clue:
At that time I was still using Joomla 3.9.28 en PHP 7.3
Code:
PHP Warning: mysqli_real_escape_string() expects parameter 2 to be string, object given in /PRIVATE/public_html/libraries/joomla/database/driver/mysqli.php on line 254
Last edit: 4 years 6 months ago by Udo.
Please Log in or Create an account to join the conversation.
4 years 6 months ago #340029
by nicolas
Replied by nicolas on topic During checkout: Object of class stdClass could not be converted to string
Hi,
It's hard to say because that error is in a Joomla file and the error message you provided doesn't contain the callstack which would display which file used the mysqli.php file.
Could you activate the "debug system" option of the Joomla configuration ? That should hopefully give more information when you reproduce the problem.
If not then I don't know. It's possible that the error is not even in HikaShop but in something else used on the page (a 3rd party extension, a custom plugin, etc). So even updating HikaShop might not help.
It's hard to say because that error is in a Joomla file and the error message you provided doesn't contain the callstack which would display which file used the mysqli.php file.
Could you activate the "debug system" option of the Joomla configuration ? That should hopefully give more information when you reproduce the problem.
If not then I don't know. It's possible that the error is not even in HikaShop but in something else used on the page (a 3rd party extension, a custom plugin, etc). So even updating HikaShop might not help.
Please Log in or Create an account to join the conversation.
4 years 6 months ago #340044
by Udo
Replied by Udo on topic During checkout: Object of class stdClass could not be converted to string
Hi,
I just discovered on my local test website that there is no problem in Joomla 3.10.5
When upgrading 3.10.5 to 3.10.6 the problem arises.
So the issue is Joomla 3.10.6 related.
Udo
I just discovered on my local test website that there is no problem in Joomla 3.10.5
When upgrading 3.10.5 to 3.10.6 the problem arises.
So the issue is Joomla 3.10.6 related.
Udo
Please Log in or Create an account to join the conversation.
4 years 6 months ago #340053
by nicolas
Replied by nicolas on topic During checkout: Object of class stdClass could not be converted to string
Hi,
I tried a checkout on my end on a local test environment with Joomla 3.10.6 but I didn't get the error either.
From what I understand, the error happens on line:
in the file /libraries/joomla/database/driver/mysqli.php because $text isn't a string but an object.
So what you can do to change that code to:
That should display the callstack leading to that error so that we better understand where the problem comes from.
And to circumvent the problem, you can try to use:
that way, you should not get an error but this might lead to unexpected issues on your website... The best would be to figure out the source of the problem.
I tried a checkout on my end on a local test environment with Joomla 3.10.6 but I didn't get the error either.
From what I understand, the error happens on line:
Code:
$result = mysqli_real_escape_string($this->getConnection(), (string) $text);
So what you can do to change that code to:
Code:
if(is_object($text)) {
echo '<pre>';
var_dump(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS));
echo '</pre>';
exit;
}
$result = mysqli_real_escape_string($this->getConnection(), (string) $text);
And to circumvent the problem, you can try to use:
Code:
if(is_object($text)) {
$text = '';
}
$result = mysqli_real_escape_string($this->getConnection(), (string) $text);
Please Log in or Create an account to join the conversation.
4 years 6 months ago #340063
by Udo
Replied by Udo on topic During checkout: Object of class stdClass could not be converted to string
Hi,
Thanks for your information, that comes in handy with new notifications.
Just before I read your reply I tested if upgrading Hikashop might help, although it seems to be a Joomla issue.
And it did help!
After upgrading to Hikashop 4.5.0 the issue is gone, the checkout is okay again and customers can order.
So an Hikashop issue after all?
By the way, I didnot receive any notifications of reply to this topic.
Regards,
Udo
Thanks for your information, that comes in handy with new notifications.
Just before I read your reply I tested if upgrading Hikashop might help, although it seems to be a Joomla issue.
And it did help!
After upgrading to Hikashop 4.5.0 the issue is gone, the checkout is okay again and customers can order.
So an Hikashop issue after all?
By the way, I didnot receive any notifications of reply to this topic.
Regards,
Udo
Please Log in or Create an account to join the conversation.
4 years 6 months ago #340066
by nicolas
Replied by nicolas on topic During checkout: Object of class stdClass could not be converted to string
Hi,
Well, with an old version of HikaShop, you risk having issues with recent versions of Joomla and PHP.
It doesn't mean there was a bug in HikaShop 4.3.0. It's just that something HikaShop relied on in Joomla or PHP changed. The modifications we make in HikaShop in every release are also meant to properly support these changes since we can't support them before we know about them.
Well, with an old version of HikaShop, you risk having issues with recent versions of Joomla and PHP.
It doesn't mean there was a bug in HikaShop 4.3.0. It's just that something HikaShop relied on in Joomla or PHP changed. The modifications we make in HikaShop in every release are also meant to properly support these changes since we can't support them before we know about them.
Please Log in or Create an account to join the conversation.
Time to create page: 0.182 seconds