+#if PHP_VERSION_ID < 70000
+# define JSON_POST_LAST_ERROR() json_post_last_error(TSRMLS_C)
+static inline int json_post_last_error(TSRMLS_D)
+{
+ zend_long l;
+ zval *zv, **zv_ptr = &zv;
+
+ ALLOC_ZVAL(zv);
+ JSON_POST_G(json_last_error)->internal_function.handler(0, zv, zv_ptr, NULL, 1);
+ l = Z_LVAL_P(zv);
+ FREE_ZVAL(zv);
+
+ return l;
+}
+#else
+# define JSON_POST_LAST_ERROR() JSON_G(error_code)
+#endif
+