fix
This commit is contained in:
parent
c1f1888218
commit
4a5b9793ef
|
@ -30,3 +30,6 @@ script:
|
|||
- ./configure --enable-arma-operators --enable-arma-pch
|
||||
- make -j$(nproc)
|
||||
- make test
|
||||
|
||||
after_failure:
|
||||
- cat tests/*.out
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
#define PHP_ARMA_VERSION "0.0.1"
|
||||
|
||||
#if PHP_VERSION_ID >= 70400
|
||||
#define ZOBJ_WRITE_PROP_RET() return value
|
||||
#define ZOBJ_WRITE_PROP_RET(zv) return zv
|
||||
#define ZOBJ_WRITE_PROP_FAIL_RET() return &EG(error_zval)
|
||||
#else
|
||||
#define ZOBJ_WRITE_PROP_RET()
|
||||
#define ZOBJ_WRITE_PROP_RET(zv) return
|
||||
#define ZOBJ_WRITE_PROP_FAIL_RET() return
|
||||
#endif
|
||||
|
||||
|
|
|
@ -314,6 +314,7 @@ namespace php_arma
|
|||
template <typename T>
|
||||
zobj_write_prop_ret_t complex<T>::write_property(zval *obj, zval *member, zval *value, void**)
|
||||
{
|
||||
zend_object *zobj = Z_OBJ_P(obj);
|
||||
// Theoretically we won't get non-string values here, add type check just in case.
|
||||
if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) {
|
||||
throw_error("unexpected error, please contact developer.");
|
||||
|
@ -324,12 +325,12 @@ namespace php_arma
|
|||
ZOBJ_WRITE_PROP_FAIL_RET();
|
||||
}
|
||||
if (strcmp(Z_STRVAL_P(member), "real") == 0) {
|
||||
object_set_property(Z_OBJ_P(obj), 0, value);
|
||||
ZOBJ_WRITE_PROP_RET();
|
||||
object_set_property(zobj, 0, value);
|
||||
ZOBJ_WRITE_PROP_RET(OBJ_PROP_NUM(zobj, 0));
|
||||
}
|
||||
if (strcmp(Z_STRVAL_P(member), "imag") == 0) {
|
||||
object_set_property(Z_OBJ_P(obj), 1, value);
|
||||
ZOBJ_WRITE_PROP_RET();
|
||||
object_set_property(zobj, 1, value);
|
||||
ZOBJ_WRITE_PROP_RET(OBJ_PROP_NUM(zobj, 1));
|
||||
}
|
||||
|
||||
throw_error("bad property name for %s, expected 'real' or 'imag', '%s' given",
|
||||
|
|
Reference in New Issue