clau Posted March 7, 2018 Share Posted March 7, 2018 (edited) Hi all, i`m running into a problem with PS again ... When a customer tries to return a product and doesn`t give any comment in the comment field, PS gives an error; Warning: preg_match() expects parameter 2 to be string, array given in /home/XXXXX/domains/XXXXXXl/public_html/classes/Validate.php on line 739 [Debug] This page has moved Please use the following URL instead: https://xxxxxx/?id_order=10 the link goes back to order history and no return is shown in the BO (or to the customer) When a customer (only) adds a single character, it`s working as expected and i can see the return in the BO. I can`t find any other (recent) posts about this error, could somebody point me in the right direction how to solve this ? is it because of the : (disallowed empty string) ? In europe we dont have to give a reason to return products and i cant force customers to write something in the comment field.. Validate.php line 731 to 739 /** * Check url validity (disallowed empty string) * * @param string $url Url to validate * @return bool Validity is ok or not */ public static function isUrl($url) { return preg_match(Tools::cleanNonUnicodeSupport('/^[~:#,$%&_=\(\)\.\? \+\-@\/a-zA-Z0-9\pL\pS-]+$/u'), $url); Can anybody point me in the right direction or even better, have a solution ? Many thanks in advance !! regards, Claudia Edited March 8, 2018 by clau i and i (see edit history) Link to comment Share on other sites More sharing options...
musicmaster Posted March 7, 2018 Share Posted March 7, 2018 I would expect this functionality to be in controllers/front/OrderReturnController.php. You should look there. Validate.php contains only general functions like checking that something is a number. Link to comment Share on other sites More sharing options...
clau Posted March 8, 2018 Author Share Posted March 8, 2018 (edited) thanks for your answer Musicmaster. When looking at oderreturncontroller i cant find anything related to the problem, just 'Cannot find the order return.' but thats not the case. this morning i did some testing again and even 1 character is enough to create the return, an empty comment field gives an error. is there a way to put a standard text into the field, as a workaround ? btw im using PS 1.6.1.17 with default theme addition; referer: https://xxxxxx/index.php?controller=history Edited March 8, 2018 by clau (see edit history) Link to comment Share on other sites More sharing options...
musicmaster Posted March 8, 2018 Share Posted March 8, 2018 You should inspect the code in the browser and look for the fieldname. And with that fieldname you can search in the php files. Link to comment Share on other sites More sharing options...
clau Posted March 8, 2018 Author Share Posted March 8, 2018 (edited) after reading numerous PHP forums and testing i think its related to; return preg_match(Tools::cleanNonUnicodeSupport('/^[~:#,$%&_=\(\)\.\? \+\-@\/a-zA-Z0-9\pL\pS-]+$/u'), $url); it must contain a character (a-zA-Z0-9) Maybe the PS developers can help; in europe customers dont have to give a reason to return a product. i will file a bug question Edited March 8, 2018 by clau (see edit history) Link to comment Share on other sites More sharing options...
clau Posted March 11, 2018 Author Share Posted March 11, 2018 there is nobody that can help me solving this ? Link to comment Share on other sites More sharing options...
clau Posted March 14, 2018 Author Share Posted March 14, 2018 when i adjust the regex to allow "empty" theres a constant warning in the top of the page showing "empty regex", so thats a no-go i think. can somebody help me to put in a text in the field that should contain the text ? its located in themes\default-bootstrap\order-follow.tpl i think this is the right file to adjust, but could be wrong... how can i add a default text in the box ? treid some already but i doesnt make a difference. Link to comment Share on other sites More sharing options...
cassandra8 Posted March 10, 2019 Share Posted March 10, 2019 Did you ever find a solution to this problem? I too am having this issue now with the same fields. I have no idea how to fix. Link to comment Share on other sites More sharing options...
musicmaster Posted March 13, 2019 Share Posted March 13, 2019 Changing the "+" into a "*" should be enough to allow empty strings Link to comment Share on other sites More sharing options...
cassandra8 Posted March 14, 2019 Share Posted March 14, 2019 I tried this and yesterday and today I finally have no errors in my error log! Thanks!!!! this worked. I'ts been a long time since I have had that happen. Link to comment Share on other sites More sharing options...
clau Posted March 15, 2019 Author Share Posted March 15, 2019 Hello Cassandra, did you change it in line 739? Link to comment Share on other sites More sharing options...
clau Posted March 15, 2019 Author Share Posted March 15, 2019 hopefully, after more than a year i have a solution! will test it tomorrow. many thanks musicmaster, you are my hero!! Link to comment Share on other sites More sharing options...
cassandra8 Posted March 16, 2019 Share Posted March 16, 2019 Clau, Mine was on a different line but had the same wording. I just changed it there. Seems to still be working. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now