- zval *zrequest, *zprogress, *retval = NULL, *zclient;
- TSRMLS_FETCH_FROM_CTX(client->ts);
-
- MAKE_STD_ZVAL(zclient);
- ZVAL_OBJVAL(zclient, ((php_http_client_object_t *) arg)->zv, 1);
- MAKE_STD_ZVAL(zrequest);
- ZVAL_OBJVAL(zrequest, ((php_http_message_object_t *) e->opaque)->zv, 1);
- MAKE_STD_ZVAL(zprogress);
- object_init(zprogress);
- add_property_bool(zprogress, "started", progress->started);
- add_property_bool(zprogress, "finished", progress->finished);
- add_property_string(zprogress, "info", STR_PTR(progress->info), 1);
- add_property_double(zprogress, "dltotal", progress->dl.total);
- add_property_double(zprogress, "dlnow", progress->dl.now);
- add_property_double(zprogress, "ultotal", progress->ul.total);
- add_property_double(zprogress, "ulnow", progress->ul.now);
- with_error_handling(EH_NORMAL, NULL) {
- zend_call_method_with_2_params(&zclient, NULL, NULL, "notify", &retval, zrequest, zprogress);
- } end_error_handling();
+ zval zclient, args[2];
+ php_http_client_object_t *client_obj = arg;
+ zend_error_handling zeh;
+
+ ZVAL_OBJECT(&zclient, &client_obj->zo, 1);
+ ZVAL_OBJECT(&args[0], &((php_http_message_object_t *) e->opaque)->zo, 1);
+ object_init(&args[1]);
+ add_property_bool(&args[1], "started", progress->started);
+ add_property_bool(&args[1], "finished", progress->finished);
+ add_property_string(&args[1], "info", STR_PTR(progress->info));
+ add_property_double(&args[1], "dltotal", progress->dl.total);
+ add_property_double(&args[1], "dlnow", progress->dl.now);
+ add_property_double(&args[1], "ultotal", progress->ul.total);
+ add_property_double(&args[1], "ulnow", progress->ul.now);
+
+ zend_replace_error_handling(EH_NORMAL, NULL, &zeh);
+ php_http_object_method_call(&client_obj->notify, &zclient, NULL, 2, args);
+ zend_restore_error_handling(&zeh);
+