Jump to content

Warning: preg_match() expects parameter 2 to be string, array given in


clau

Recommended Posts

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 by clau
i and i (see edit history)
Link to comment
Share on other sites

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 by clau (see edit history)
Link to comment
Share on other sites

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 by clau (see edit history)
Link to comment
Share on other sites

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

  • 11 months later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...