Since PHP 7.0, a new Zend API was implemented for faster parameter parsing.
For example, if your function accepts an integer parameter
foo, then the code may look like this.
However, if your extension is written in C++, the compiler will complain and refuse to compile.
You’ll get error message like:
Confused? Let’s take a look at the macro definition, which is located in zend_API.h
We can see on line 8 Zend’s trying to initialize an enum
zend_expected_type with value 0, which is forbidden in C++. In C++, you should either explicitly cast it with
static_cast or initialize using a corresponding enum value.
Fortunately the value 0 is defined in macro
IS_UNDEF (why this??), you can just redefine it instead of
sed zend_API.h in your config.m4 script.
Now your code may look like this.
Ugly, but your code will compile. Cheers :)
P.S. The latest PHP 7.2 still have this problem. Perhaps I should report this issue to the PHP internals guys.