Finally, i've localised the problem. This code
[spoiler:db950bdfdd]variable tmp, tmp2;
tmp2:="bin%gle";
tmp:=string_split(tmp2, "%");
display_msg(""+len_array(tmp)); //Prints 2, as expected[/spoiler:db950bdfdd]
works fine, unless procedure, containing it, called from AddButtonProc()...