-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Array to String conversion error on checkout page when changin country - how to debug #12612
Comments
I also have the same error message for the logged in users. |
@fwolfst , thank you for your report. |
@magento-engcom-team I guess its a difficult task to pinpoint it down. Of course this might have to do with extensions, configuration or migrated data. But I am happy if somebody shares a few tipps on how to debug this further (stacktrace etc). |
@fwolfst , thank for you update. |
I also ran into this issue. When Magento fetches an address object from db it seems to turn the region data into an array ( If later on vat validation is performed ( As the data is getting persisted into This does not look like an error caused by extensions or migrated data. |
We also run into this problem on a Magento 2.1.11 installation. If someone is interested in the full stacktrace:
@patchee500: have you already found a fix for this problem? @magento-engcom-team: somehow I have the power to reopen this ticket, so I'm doing so since I believe this is a core bug. Although there aren't any good steps provided yet to reproduce this issue. If I'm in error, feel free to close again. And this is a duplicate of #11654 btw, but this issue seems to have more interesting information. |
Here are the exact steps to reproduce, I tested it multiple times to make sure I didn't make any mistakes Preconditions
Steps to reproduce
Expected result
Actual result
Fix which hasn't been tested very wellI wrote a small module with a preference for the @@ -63,6 +34,20 @@
$merchantVatNumber
);
+ if (is_array($quoteAddress->getRegion()))
+ {
+ $regionData = $quoteAddress->getRegion();
+ if (array_key_exists('region_code', $regionData))
+ {
+ $quoteAddress->setRegionCode($regionData['region_code']);
+ }
+ if (array_key_exists('region_id', $regionData))
+ {
+ $quoteAddress->setRegionId($regionData['region_id']);
+ }
+ $quoteAddress->setRegion(null);
+ }
+
// Store validation results in corresponding quote address
$quoteAddress->setVatIsValid((int)$validationResult->getIsValid());
$quoteAddress->setVatRequestId($validationResult->getRequestIdentifier()); This is most likely not the correct solution, but it seems to work... @magento-engcom-team: can you double check and verify and then add the |
@hostep Since the region data was of no importance in our case, we fixed this by simply unsetting the region data before vat validation was performed in a Plugin. I'm also unsure if this method is the correct place to add the region splitting, this is something @magento-engcom-team needs to decide. Hopefully they now acknowledge the existence of this issue. |
@hostep , thank for you update with detal steps to reproduce. We've acknowledged the issue and added to our backlog |
@magento-engcom-team: why did you add the tags Because I just tested this to be certain:
Can you remove those two labels and add the Thanks! |
@hostep , sorry for mistake, we rechecked this issue and added all correct labeles |
Any progress on this issue?
|
I checked the problem. Error messages are displayed because some invalid data is saved in the input validation phase. See
When saving, the P.S: |
The solution from @hostep worked for me. |
Also had this problem in 2.2.5, @hostep's solution worked for me to. |
same here in 2.1.9 and Braintree Gateway, |
@UrbanSurfers : sorry, at the moment I can't remember and can't find the project where we've fixed this. Or maybe one of the other people in here can help you further. |
Well my scenario, seem like the shipping Address and Billing Address has street was an array. Here is the patch for 2.1.9
|
Same issue in 2.2.x (latest version). @hostep's solution worked for me to. |
Hi @fwolfst. Thank you for your report.
The fix will be available with the upcoming 2.3.3 release. |
In my 2.3.3-p1 I have a couple of incidents where customers were charged but Magento was not able to create order. In the log I see this:
I can change the country just fine. My biggest problem is that I cannot reproduce this. Can anyone guide me in here? Customer explained that after hitting the place order button, the checkout page froze but then PayPal sent them a successful payment email. |
Preconditions
Steps to reproduce
The payment methods are set available for all allowed countries. There are shipping tablerates for the respictive countries too.
Expected result
Actual result
var/log/exception.log
:[2017-12-08 03:48:23] main.CRITICAL: Report ID: webapi-5a2a0b8746dca; Message: Notice: Array to string conversion in /var/www/XXX/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 2999 {"exception":"[object] (Exception(code: 0): Report ID: webapi-5a2a0b8746dca; Message: Notice: Array to string conversion in /var/www/XXX/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 2999 at /var/www/XXX/vendor/magento/framework/Webapi/ErrorProcessor.php:205, Exception(code: 0): Notice: Array to string conversion in /var/www/XXX/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 2999 at /var/www/XXX/vendor/magento/framework/App/ErrorHandler.php:61)"} []
The corresponding (shipping, tax, payment) values do not always change.
Sometimes the error is not shown in frontend, then the log message differs slightly. In between configuration changes or separete tests I flush caches and clear the browser session (FF, Ctrl+F5).
[2017-12-07 23:57:04] main.CRITICAL: Notice: Array to string conversion in /var/www/XXX/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 2999 {"exception":"[object] (Exception(code: 0): Notice: Array to string conversion in /var/www/XXX/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 2999 at /var/www/XXX/vendor/magento/framework/App/ErrorHandler.php:61)"} []
I am sorry not to be able to be more precise here but any help on getting a more detailed stacktrace or more information on where the error actually comes from would be greatly appreciated.
I hacked the corresponding Mysql.php file and printed the "array" contents into a file. It showed up an empty list ("()" afair).
The text was updated successfully, but these errors were encountered: