[ZBX-4218] Cannot add and update item at type of log with multi byte character in key. Created: 2011 Oct 10 Updated: 2017 May 30 Resolved: 2014 Jan 18 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | API (A) |
Affects Version/s: | 1.8.6, 1.8.7, 1.8.8 |
Fix Version/s: | 2.0.11rc1, 2.2.2rc1, 2.3.0 |
Type: | Incident report | Priority: | Minor |
Reporter: | Ryuji Ebine | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 2 |
Labels: | api, items, multibyte | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
CentOS release 5.4 (Final) mysql-server-5.0.77-4.el5_5.3 zabbix-1.8.7-1.el5.JP |
Attachments: |
![]() ![]() |
||||||||||||
Issue Links: |
|
Description |
When item with multi byte character in key is created or updated ,Error messages display. == Error messages == Title: ERROR: Cannot add item Title: ERROR: Cannot update item Item Detail is below. == Item details == Host: Zabbix server I found detail message at ./api/classes/class.citemkey.php in 319. == class.citemkey.php == 104 private function parseKeyParameters(){ 195 == Try to find a cause == Affecting Apache configration is found.
== A provisional avoiding == Modify class.citemkey.php Regards. |
Comments |
Comment by Kodai Terashima [ 2011 Oct 12 ] |
We need to set 'mbstring.func_overload=6' to use frontend in Japanese. |
Comment by richlv [ 2011 Oct 12 ] |
i believe frontend was supposed to be utf-8 ready w/o mbstring function overloading since 1.8.2 or so - does it not work in japanese without overloading ? |
Comment by Kodai Terashima [ 2011 Oct 12 ] |
I haven't known that |
Comment by richlv [ 2011 Oct 18 ] |
any luck without mbstring overloading ? |
Comment by José Roberto Prado [ 2011 Nov 16 ] |
I have the same problem but in Web Monitoring. I used the solution above reported and solved the problem. Modify class.citemkey.php < $this->keyByteCnt = strlen($this->key); Zabbix 1.8.8 |
Comment by Kodai Terashima [ 2011 Dec 06 ] |
I tested multibyte character (Japanese) on 1.8.9 frontend without mbstring.func_overload.
It seems that no problem on above situations at least, but I have not checked multibyte character on all situation. |
Comment by Alexander Vladishev [ 2014 Jan 02 ] |
Fixed in the development branch svn://svn.zabbix.com/branches/dev/ZBX-4218 |
Comment by Ivo Kurzemnieks [ 2014 Jan 09 ] |
(1) please remove @package API
in CItemKey.php: 31. We don't really use @package sasha RESOLVED in r41517 iivs CLOSED. |
Comment by Ivo Kurzemnieks [ 2014 Jan 09 ] |
(2) constants should come before private and protected variables sasha RESOLVED in r41518 iivs CLOSED. |
Comment by Ivo Kurzemnieks [ 2014 Jan 09 ] |
(3) function description sentences require a dot at the end of line, new line after description and new line before @return
/**
* Function description.
*
* @param some_parameter
*
* @return some_value
*/
and @return void
is not required and can be removed sasha RESOLVED in r41521, r41530 iivs CLOSED. |
Comment by Ivo Kurzemnieks [ 2014 Jan 09 ] |
(4) giving a message like "error at position 158" for a 255 character long string will be very tough for user. Previously it had error message like "Incorrect syntax near ..." Would be good to return this approach just like we have it in trigger expressions. sasha RESOLVED in r41530 I use zbx_substr() and zbx_strlen() to create error message. It should be discussed. iivs Discussed with devs and support. Usage of functions zbx_substr() and zbx_strlen() is OK. But we still can improve the error message. Also, please, see (5) about qoutes. For example we enter a key "abcd:efghij" and get an error Error in item key: incorrect syntax near "abcd:efghi ..." at position 5.
In this case we still need to count which simbol is incorrect. We discussed this and decided that it would be better to start from the incorrect symbol. In this case the more correct error would be Error in item key: incorrect syntax near ":efghij".
Also position is not necessary, because we always start from first wrong symbol. If incorrect symbol is last, it would be better to have an error message like Error in item key: unexpected end of key. Just like before we don't need position. The incorrect string can be not only 10, but 30 symbols long. Another example when we have a string with repeating symbols "aaaaaa:aa:a:aa:a" it will give Error in item key: incorrect syntax near "... aaaaa:aa:a ..." at position 7.
and we are not sure what to count. It would be better to show the first wrong symbol. For example more correct error message would be Error in item key: incorrect syntax near ":aa:a:aa:a".
Also CItemKey.php: 61 opening bracket should be on line 60. sasha It will be better. Thanks! RESOLVED in r41638. iivs Great work and nice algorithm! Thanks! CLOSED. |
Comment by Ivo Kurzemnieks [ 2014 Jan 09 ] |
(5) would be good to unify error messages where $itemKey->getError() is called. discoveryconf.php: 109 has correct example. sasha WAITING... will be fixed in 2.2 and trunk only iivs Sorry, my mistake about correct example. Error description should be without quotes. For example: Error in item key: incorrect syntax near ":abdefghijkl ...".
sasha I agree this, but not in 2.0. May be full error message should be like this: Invalid item key "invalid,key[param1, param2]": incorrect syntax near ",key[ ...". iivs Yes, let's leave 2.0 as it is and for trunk we decided that we could show key, item name and host. It's long, but very accurate. Invalid item key %key% for item %item% on %host%: incorrect syntax near ":abde ..." sasha RESOLVED in r41853. iivs CLOSED. |
Comment by Ivo Kurzemnieks [ 2014 Jan 10 ] |
(6) code piece in CITemKey.php: 91 $state == 1 probably should be $state == self::STATE_END since we have 'state' as constant. sasha RESOLVED in r41524 iivs CLOSED. |
Comment by Ivo Kurzemnieks [ 2014 Jan 10 ] |
(7) before: if we entered a key which begins with, for example, a cyrillic char, it throwed an error "Invalid item key format." sasha RESOLVED in r41530 iivs CLOSED. |
Comment by Ivo Kurzemnieks [ 2014 Jan 22 ] |
TESTED. But don't forget to close (5) |
Comment by Alexander Vladishev [ 2014 Jan 23 ] |
Fixed in pre-2.0.11 r41821 |
Comment by Alexander Vladishev [ 2014 Jan 24 ] |
The fix for 2.2 is ready for testing. Available in the development branch svn://svn.zabbix.com/branches/dev/ZBX-4218-22 |
Comment by Ivo Kurzemnieks [ 2014 Jan 24 ] |
2.2 TESTED |
Comment by Alexander Vladishev [ 2014 Jan 24 ] |
Fixed in pre-2.2.2 r41867 and pre-2.3.0 (trunk) r41869. |