Warning: htmlspecialchars() expects parameter 1 to be string, array given in
/vendor/magento/framework/Data/Form/Element/AbstractElement.php on line 286
Internal ticket MAGETWO-60143 has been created to track this issue.
Same problem here on Magento 2.1.2.
Any workaround to delete a term that's been created?
I'd like to remove it, but can't, because editing is not possible :)
sorry, found the entry in the database.
Table "checkout_agreement".
I was able to fix it by changing Line 302 in /vendor/magento/framework/Data/Form/Element/AbstractElement.php from
return $this->_escape($value);
to
if(is_string($value)) {
return $this->_escape($value);
}
don't know if this causes any other issues though :)
I encountered the same issue on magento 2.1.0 and found that the issue lies withing https://github.com/magento/magento2/blob/develop/app/code/Magento/CheckoutAgreements/Block/Adminhtml/Agreement/Edit/Form.php#L139. Megento expects that the value of hidden field is string but existing aggreement stores property is always array containing all the store ids it it associated with and is overwrites the default store id on https://github.com/magento/magento2/blob/develop/app/code/Magento/CheckoutAgreements/Block/Adminhtml/Agreement/Edit/Form.php#L186.
The fix is pretty easy - just change the line https://github.com/magento/magento2/blob/develop/app/code/Magento/CheckoutAgreements/Block/Adminhtml/Agreement/Edit/Form.php#L144 to
$model->setStores($this->_storeManager->getStore(true)->getId());
@rbostan, the fix will be provided under MAGETWO-63840 (MAGETWO-60143 is closed as duplicate).
@rbostan, thank you for your report.
We've created internal ticket(s) MAGETWO-63840 to track progress on the issue.
I just encountered this on 2.2.1 too. Can someone please give me a diff/patch to fix that?
edit: switched to another system. so i can not give any more information.
Do we have a fix yet?
edit: single store is the cause of most of this, i had an issue with a module switching back to multi-store fixed it. My guess is their should be some logic switch from multi to single to fix this for everything. This issue is going to linger until that's fixed.
It still happens in Magento 2.2.4.
Guys, this ticket opened Oct 25, 2016, so it is 1.5 years old.
Confirm that error still happening in Magento 2.2.4
And still exists in 2.2.5
following therool . I added this below this line in function _prepareForm
of class vendor/magento/module-checkout-agreements/Block/Adminhtml/Agreement/Edit/Form.php
but i did over-ride to avoid lossing it after upgrade.
$model->setStores($this->_storeManager->getStore(true)->getId());
and it worked on Magento 2.2.4 with me.
Can confirm, editing the _escape function work around by pmsteil resolves this.
Not sure if it the call to escape should have multiple argument types in same function?
_escape($string : string)
_escape($string : array)
Microsoft Office Word text quotes get lost in saving/editing however.
I'm not sure if that is related to this or the way the string is stored/processed.
“Test”
Gets returned in this encoding.
âTestâ
It does render okay on the front end, but the back end editor does not show correctly.
Hello @rbostan
Thank you for your report.
The issue was fixed and delivered with commits:
Most helpful comment
It still happens in Magento 2.2.4.
Guys, this ticket opened Oct 25, 2016, so it is 1.5 years old.