[ZBX-10316] ZABBIX 2.4 on RHEL - Unable to add step to Web Monitor Scenario Created: 2016 Jan 27 Updated: 2017 May 30 Resolved: 2016 Mar 16 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Frontend (F) |
Affects Version/s: | 2.4.7 |
Fix Version/s: | 2.0.17rc1, 2.2.12rc1, 3.0.2rc1, 3.2.0alpha1 |
Type: | Incident report | Priority: | Critical |
Reporter: | Brian Dougherty | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 0 |
Labels: | webmonitoring | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
rhel 6 - apache httpd - php5.3.3 |
Description |
Created: Application "Web checks" on "MicroStrategy Web Production". |
Comments |
Comment by Brian Dougherty [ 2016 Jan 27 ] |
Also got this error - preg_match(): Compilation failed: range out of order in character class at offset 11 [popup_httpstep.php:55 → check_fields() → check_field() → calc_exp() → calc_exp2() → eval() → preg_match() in /wawa_mnt1/apache_httpd/httpd-2.2.31/htdocs/zabbix/include/validate.inc.php(105) : eval()'d code:1] |
Comment by Aleksandrs Saveljevs [ 2016 Jan 28 ] |
It seems to complain about the following regular expression:
preg_grep('/([^\x{00}-\x{1F}]+?)?/i', $stepNames)
Have you installed Zabbix for the first time? Has it ever worked in prior versions? Have you upgraded Web server or PHP packages recently? |
Comment by Aleksandrs Saveljevs [ 2016 Jan 28 ] |
While we still need to figure out your original problem, there is something to be fixed anyway. In particular, there is the following code in CHttpTest.php: $stepNames = zbx_objectValues($httpTest['steps'], 'name'); if (!empty($stepNames) && !preg_grep('/'.ZBX_PREG_PARAMS.'/i', $stepNames)) { self::exception(ZBX_API_ERROR_PARAMETERS, _('Web scenario step name should contain only printable characters.')); } This is true - Web scenario step name should only contain printable characters. However, it verifies the name using the regular expression in the previous comment, but not all ASCII characters from 0 to 127 are printable! Also, why ^ symbol is needed there? That regular expression is defined in the following way: define('ZBX_PREG_PRINT', '^\x{00}-\x{1F}'); Apparently, this is a misnomer. iivs The ^ means not in the range. The particular example doesn't say that, but we have to look at it this way [^\x{00}-\x{1F}] . But the problem might with curly braces. They are optional since there are only two hexadecimal digits. Not sure whether it's a bug in PCRE library or what, because [^\x{00}-\x{1F}] and [^\x00-\x1F] are both correct syntaxes. I think the curly braces are used only because we use eval() function in frontend while checking through check_fields() all that complex chain of other functions. If we remove them, we need to change return 'preg_match("/'.ZBX_PREG_PARAMS.'/",{'.$var.'})&&'; to this return 'preg_match(\'/'.ZBX_PREG_PARAMS.'/\',{'.$var.'})&&'; in KEY_PARAM() /([^\x00-\x1F]+?)?/i , but it somehow passes through the validation. I'm not quite sure why. But there is another function checkNames() that uses same expression. We could use the same regular expression for step names used in scenario names and it will look like this /^([^\x00-\x1F])+$/u Or maybe just add ^ and $? It could look like this ^([^\x00-\x1F]+?)?${noformat} Any thoughts on this matter? I'm still puzzled by this. iivs In the end we have decided to remove the non-printable character restriction for scenario names and change the regular expression so that it doesn't use curly braces. |
Comment by Brian Dougherty [ 2016 Jan 28 ] |
Hello Aleksandrs, Quick update on this - the main error I receive repedtly now is the following - I have been unable to reproduce the initial error that I posted with this bug. preg_match(): Compilation failed: range out of order in character class at offset 11 [popup_httpstep.php:55 → check_fields() → check_field() → calc_exp() → calc_exp2() → eval() → preg_match() in /wawa_mnt1/apache_httpd/httpd-2.2.31/htdocs/zabbix/include/validate.inc.php(105) : eval()'d code:1] To answer your questions - This is a brand new install of Zabbix installed from source - 2.4.7. I have never been able to get this work and also have not upgraded or changed apache or php. |
Comment by Ivo Kurzemnieks [ 2016 Mar 02 ] |
Hello, Brian! I'm just curious what is the version of PCRE library? I doubt that the problem is due to old version, but still would be interesting to know since I could only reproduce the error with that regular expression on PHP 5.0.4 and PHP 5.0.5. And the PCRE library for those PHP versions is very, very old (4.5 01-December-2003). Also I'm, 99.99% positive that the same error might be also in tr_logform.php, because it uses same regular expression there. I cannot check if that's true, since Zabbix requires PHP >= 5.1.6 (for v2.0). |
Comment by Brian Dougherty [ 2016 Mar 02 ] |
Ivo, Here you go - PCRE version 7.8 2008-09-05 |
Comment by Ivo Kurzemnieks [ 2016 Mar 03 ] |
(1) Removed translation strings:
gunarspujats CLOSED |
Comment by Ivo Kurzemnieks [ 2016 Mar 03 ] |
RESOLVED in svn://svn.zabbix.com/branches/dev/ZBX-10316 |
Comment by Gunars Pujats (Inactive) [ 2016 Mar 15 ] |
Successfully tested! |
Comment by Ivo Kurzemnieks [ 2016 Mar 16 ] |
Fixed in:
|
Comment by Ivo Kurzemnieks [ 2016 Mar 16 ] |
(2) API changelogs: 2.0, 2.2 and 3.0 updated. Please, review. sasha CLOSED |