Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ZF2] placeholder, value attributes in form doesn't show cyrillic #6

Open
weierophinney opened this issue Dec 31, 2019 · 7 comments
Open

Comments

@weierophinney
Copy link
Member

This issue has been moved from the zendframework repository as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html


Original Issue: https://api.github.com/repos/zendframework/zendframework/issues/7681
User: @mkEmperor
Created On: 2016-03-03T15:20:23Z
Updated At: 2016-03-07T02:09:36Z
Body
$this->add(array( 'name' => 'name', 'attributes' => array( 'type' => 'text', ), 'options' => array( 'label' => 'Имя', ), 'attributes' => array( 'required' => 'required', 'placeholder' => 'Имя' ), ));
$this->add(array( 'name' => 'submit', 'attributes' => array( 'type' => 'submit', 'value' =>'Зарегестрироваться' ) ));

in form
<input name="name" required="required" placeholder="&#xD098;&#xD0BC;&#xD18F;" type="text" value="">
<input name="submit" type="submit" value="&#xD097;&#xD0B0;&#xD180;&#xD0B5;&#xD0B3;&#xD0B5;&#xD181;&#xD182;&#xD180;&#xD0B8;&#xD180;&#xD0BE;&#xD0B2;&#xD0B0;&#xD182;&#xD18C;&#xD181;&#xD18F;">


Comment

User: @mkEmperor
Created On: 2016-03-03T15:22:46Z
Updated At: 2016-03-03T15:22:46Z
Body
Project and all files in utf-8


Comment

User: @mkEmperor
Created On: 2016-03-03T16:10:36Z
Updated At: 2016-03-03T16:11:01Z
Body
public function escapeHtmlAttr($string) { $string = $this->toUtf8($string); if ($string === '' || ctype_digit($string)) { return $string; } $result = preg_replace_callback('/[^a-z0-9,\.\-_]/iSu', $this->htmlAttrMatcher, $string); return $this->fromUtf8($result); }

correct '/[^a-zа-яА-я0-9,.-_]/iSu'



Originally posted by @GeeH at zendframework/zend-escaper#16

@weierophinney
Copy link
Member Author

I have the same problem.
I try to debug ZF. I think that problem is here
https://github.com/zendframework/zendframework/blob/d8adfe90da23af119ae5732195ad50af0009d672/library/Zend/Escaper/Escaper.php#L256

Function bin2hex('a') (Char "a" is a cyrillic char) returns d0b0 but not 0430 (UTF-8 code for this char).

My test configuration is php 5.3 and php 7.0.

Please, help me.


Originally posted by @bigbyben at zendframework/zend-escaper#16 (comment)

@weierophinney
Copy link
Member Author

Hello, I have the same problem. Do you use docker? Are you solved this problem?


Originally posted by @3ech7oul at zendframework/zend-escaper#16 (comment)

@weierophinney
Copy link
Member Author

Добрый, мы не используем докер, потому что у нас битрикс окружение и нагруженный проект. Решили проблему тем, что установили зенд фреймворк более старой версии 2.2.5, которая кажется корректно работает (давно дело было). Также мы отказались от использования встроенного хелпера для рендеринга input-ов. Не помню уже точно, но у нас было так, что на одной версии php 5.3.x работало, а на другой 5.3.x1 - нет. Кажется, не работало на более новой версии. 5.3

В общем, попробуйте 2.2.5 установить.
Если не сложно, напишите, что у вас получилось.


Originally posted by @bigbyben at zendframework/zend-escaper#16 (comment)

@weierophinney
Copy link
Member Author

Я использовал контейнер от битрикса не проверил конфигурацию php.ini. Получилось решить проблему установив в php.ini mbstring.func_overload = 0

I used php.ini file from Bitrix where setted mbstring.func_overload = 2
I solved this problem changed mbstring.func_overload = 0


Originally posted by @3ech7oul at zendframework/zend-escaper#16 (comment)

@weierophinney
Copy link
Member Author

@3ech7oul, @bigbyben
Please write in English, otherwise nobody can follow you. Thanks!


Originally posted by @froschdesign at zendframework/zend-escaper#16 (comment)

@weierophinney
Copy link
Member Author

Sorry, my english is very bad, but we understod each other. :)

I think, that this bug could be reproduced by setting php.ini mbstring.func_overload = 2.
For example, a russian CMS bitrix use this setting for work.

3ech7oul speak, that setting php.ini mbstring.func_overload = 0 is the fix to the problem. But bitrix is not working with this setting. :(


Originally posted by @bigbyben at zendframework/zend-escaper#16 (comment)

@weierophinney
Copy link
Member Author

@3ech7oul, thank you


Originally posted by @bigbyben at zendframework/zend-escaper#16 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant