chinese support bug
Closed this issue · 3 comments
this reg used for check chinese words.
3> php:eval("preg_match('/^[\x{4e00}-\x{9fa5}a-zA-Z0-9_]+$/u', 'aaaaaa');").
=ERROR REPORT==== 11-Oct-2010::11:55:41 ===
** Generic server phpeval_2 terminating
** Last message in was {eval,[112,114,101,103,95,109,97,116,99,104,40,39,47,
94,91,19968,45,40869,97,45,122,65,45,90,48,45,
57,95,93,43,36,47,117,39,44,32,39,97,97,97,97,
97,97,39,41,59],
infinity,undefined}
** When Server state == {state,#Port<0.665>,[{maxmem,10240000}],21207,[]}
** Reason for termination ==
** {badarg,[{erlang,list_to_binary,
[[112,114,101,103,95,109,97,116,99,104,40,39,47,94,91,
19968,45,40869,97,45,122,65,45,90,48,45,57,95,93,43,36,
47,117,39,44,32,39,97,97,97,97,97,97,39,41,59]]},
{php_eval,exec_php,3},
{php_eval,handle_call,3},
{gen_server,handle_msg,5},
{proc_lib,init_p_do_apply,3}]}
i use Port ! {self(), {command, unicode:characters_to_binary(Code)}}, instead of Port ! {self(), {command, list_to_binary(Code)}},, but the result is wrong:
3> php:eval("preg_match('/[\x{4e00}-\x{9fa5}a-zA-Z0-9_]+$/u', 'aaaaaa');").
{ok,<<>>,null,<<>>,continue}
Your patch is correct. The result seems wrong because you have not returned anything. If you use "return preg_match" the value is 1. I have applied your patch. Thanks!
thanks for your good job