[ZBX-9700] zabbix-2.4.5 and php7 Created: 2015 Jul 13  Updated: 2017 May 30  Resolved: 2016 Mar 08

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A)
Affects Version/s: 2.4.5
Fix Version/s: 3.0.2rc1, 3.2.0alpha1

Type: Incident report Priority: Trivial
Reporter: Thomas Stein Assignee: Unassigned
Resolution: Fixed Votes: 3
Labels: php, php7
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by ZBX-10423 when logout error 500 Closed

 Description   

Hello Devs.

Another php7 errror:

[12-Jul-2015 20:30:01 Europe/Berlin] PHP Fatal error:  Uncaught TypeError: Argument 2 passed to CFrontendApiWrapper::callMethod() must be of the type array, boolean given, called in /var/www/zabbix.domain.de/htdocs/include/classes/api/wrappers/CApiWrapper.php on line 82 and defined in /var/www/zabbix.domain.de/htdocs/include/classes/api/wrappers/CFrontendApiWrapper.php:61
Stack trace:
#0 /var/www/zabbix.domain.de/htdocs/include/classes/api/wrappers/CApiWrapper.php(82): CFrontendApiWrapper->callMethod('logout', false)
#1 /var/www/zabbix.domain.de/htdocs/include/classes/user/CWebUser.php(88): CApiWrapper->__call('logout', Array)
#2 /var/www/zabbix.domain.de/htdocs/index.php(49): CWebUser::logout()
#3 {main}
  thrown in /var/www/zabbix.domain.de/htdocs/include/classes/api/wrappers/CFrontendApiWrapper.php on line 61


 Comments   
Comment by richlv [ 2015 Jul 13 ]

could you please specify zabbix version as well ?
also note that php7 is not even released yet

zalex_ua Issue summary contains "zabbix-2.4.5".
I've just added it to Affect version.

Comment by Thomas Stein [ 2015 Jul 14 ]

> also note that php7 is not even released yet

I opened the bug with that in mind. Just for the record so to speak.

cheers
t.

Comment by richlv [ 2015 Dec 04 ]

with the final php7 out yesterday (december 3rd), this issue might be worth re-evaluating

Comment by Oleksandr Natalenko [ 2016 Jan 07 ]

Confirm the issue with PHP 7.0.2 and Zabbix 2.4.7:

2016/01/07 18:51:40 [error] 16311#0: *234847 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught TypeError: Argument 2 passed to CFrontendApiWrapper::callMethod() must be of the type array, boolean given, called in /usr/share/webapps/zabbix/include/classes/api/wrappers/CApiWrapper.php on line 82 and defined in /usr/share/webapps/zabbix/include/classes/api/wrappers/CFrontendApiWrapper.php:61
Stack trace:
#0 /usr/share/webapps/zabbix/include/classes/api/wrappers/CApiWrapper.php(82): CFrontendApiWrapper->callMethod('logout', false)
#1 /usr/share/webapps/zabbix/include/classes/user/CWebUser.php(88): CApiWrapper->__call('logout', Array)
#2 /usr/share/webapps/zabbix/index.php(49): CWebUser::logout()
#3 {main}
  thrown in /usr/share/webapps/zabbix/include/classes/api/wrappers/CFrontendApiWrapper.php on line 61" while reading response header from upstream, client: 1.2.3.4, server: zabbix.example.com, request: "GET /index.php?reconnect=1&sid=57669cb2f7ce4885 HTTP/1.1", upstream: "fastcgi://127.0.0.1:65011", host: "zabbix.example.com", referrer: "https://zabbix.example.com/dashboard.php"
Comment by Stefan de Konink [ 2016 Jan 24 ]
CApiWrapper.php
        /**
         * A magic method for calling the public methods of the API client.
         *
         * @param string        $method         API method name
         * @param array         $params         API method parameters
         *
         * @return CApiClientResponse
         */
        public function __call($method, array $params) {
                $a = reset($params);
                if ($a === FALSE) {
                        $a = $params;
                }       
                return $this->callMethod($method, $a);
        }

Hopefully someone commits something prettier.

Comment by Oleksandr Natalenko [ 2016 Jan 24 ]

@Stefan de Konink, this does not fix logout.

Comment by Stefan de Konink [ 2016 Jan 24 ]

It does. I have just deployed it.

Comment by Oleksandr Natalenko [ 2016 Jan 24 ]

Umm, sorry, missed changed return statement. Works for me as well, thanks!

Comment by Ivo Kurzemnieks [ 2016 Mar 01 ]

RESOLVED in svn://svn.zabbix.com/branches/dev/ZBX-9700

Comment by Ivo Kurzemnieks [ 2016 Mar 01 ]

(1) Translation strings added:

  • Cannot call method "%1$s.%2$s" without parameters.

gunarspujats CLOSED

Comment by Gunars Pujats (Inactive) [ 2016 Mar 08 ]

Successfully tested!

Comment by Ivo Kurzemnieks [ 2016 Mar 08 ]

Fixed in:

  • pre-3.0.2rc1 r58902
  • pre-3.1.0 (trunk) r58903
Comment by Ivo Kurzemnieks [ 2016 Mar 08 ]

(2) API changelog updated

gunarspujats CLOSED

Comment by richlv [ 2016 Mar 09 ]

the changelog entry says "fixed API receiving null and false instead of an array in method parameters"

this issue was about zabbix frontend + php7.

is zabbix frontend now officially working & supported with php7 ? if so, should that be mentioned in the changelog, maybe ?

iivs It's not about all php7 related problems in the frontend. If such problems occur, it should be split into multiple tasks. There could be numerous things for improvements and so on. The issue was about user trying to log out on php7 and got a fatal error. The main problem occurred deeply in API core. There were more ways to generate fatal errors breaking the API, just by simply not giving "params" in request. In other words - function arguments. The thing that was fixed, was that API received "null" and "false" instead of an array. I cannot say for sure that it fully supports php7, I haven't run the tests. Bugs could be hidden deeply in the code. We just haven't found them yet. Claiming to fully support php7 and getting a new issue the next day would be silly. Most of the frontend should work on php7, but I'm very suspicious.

iivs I ran some tests. So far sniffers couldn't find anything useful. But unit tests don't work.

Fatal error: Uncaught Error: Call to undefined method Mock_CConverter_985a22a8::method() in C:\Development\zabbix\frontends\php\tests\unit\include\classes\import\converters\CConverterChainTest.php on line 53

Generated at Sun Jul 06 00:46:01 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.