zend_llist_add_element(&client->responses, &msg_obj);
if (e->closure.fci.size) {
- zval *retval = NULL;
+ zval retval;
zend_error_handling zeh;
- zend_fcall_info_argn(&e->closure.fci TSRMLS_CC, 1, &zresponse);
- zend_replace_error_handling(EH_NORMAL, NULL, &zeh TSRMLS_CC);
+ ZVAL_UNDEF(&retval);
+ zend_fcall_info_argn(&e->closure.fci, 1, &zresponse);
+ zend_replace_error_handling(EH_NORMAL, NULL, &zeh);
+ ++client->callback.depth;
- zend_fcall_info_call(&e->closure.fci, &e->closure.fcc, &retval, NULL TSRMLS_CC);
+ zend_fcall_info_call(&e->closure.fci, &e->closure.fcc, &retval, NULL);
+ --client->callback.depth;
- zend_restore_error_handling(&zeh TSRMLS_CC);
- zend_fcall_info_argn(&e->closure.fci TSRMLS_CC, 0);
+ zend_restore_error_handling(&zeh);
+ zend_fcall_info_argn(&e->closure.fci, 0);
- if (retval) {
- if (Z_TYPE_P(retval) == IS_BOOL) {
- dequeue = Z_BVAL_P(retval);
- }
- zval_ptr_dtor(&retval);
+ if (Z_TYPE(retval) == IS_TRUE) {
+ dequeue = 1;
}
+ zval_ptr_dtor(&retval);
}
zval_ptr_dtor(&zresponse);
static void handle_progress(void *arg, php_http_client_t *client, php_http_client_enqueue_t *e, php_http_client_progress_state_t *progress)
{
- zval *zrequest, *zprogress, *zclient, **args[2];
+ zval zclient, args[2];
php_http_client_object_t *client_obj = arg;
zend_error_handling zeh;
- TSRMLS_FETCH_FROM_CTX(client->ts);
-
- MAKE_STD_ZVAL(zclient);
- ZVAL_OBJVAL(zclient, client_obj->zv, 1);
-
- MAKE_STD_ZVAL(zrequest);
- ZVAL_OBJVAL(zrequest, ((php_http_message_object_t *) e->opaque)->zv, 1);
- args[0] = &zrequest;
-
- 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);
- args[1] = &zprogress;
-
- zend_replace_error_handling(EH_NORMAL, NULL, &zeh TSRMLS_CC);
+
+ 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);
+ ++client->callback.depth;
- php_http_object_method_call(&client_obj->notify, zclient, NULL, 2, args TSRMLS_CC);
+ php_http_object_method_call(&client_obj->notify, &zclient, NULL, 2, args);
+ --client->callback.depth;
- zend_restore_error_handling(&zeh TSRMLS_CC);
+ zend_restore_error_handling(&zeh);
zval_ptr_dtor(&zclient);
- zval_ptr_dtor(&zrequest);
- zval_ptr_dtor(&zprogress);
+ zval_ptr_dtor(&args[0]);
+ zval_ptr_dtor(&args[1]);
}
static void handle_debug(void *arg, php_http_client_t *client, php_http_client_enqueue_t *e, unsigned type, const char *data, size_t size)
{
- zval *ztype, *zdata, *zreq, *zclient;
+ zval ztype, zdata, zreq, zclient;
php_http_client_object_t *client_obj = arg;
zend_error_handling zeh;
- TSRMLS_FETCH_FROM_CTX(client->ts);
-
- MAKE_STD_ZVAL(zclient);
- ZVAL_OBJVAL(zclient, client_obj->zv, 1);
- MAKE_STD_ZVAL(zreq);
- ZVAL_OBJVAL(zreq, ((php_http_message_object_t *) e->opaque)->zv, 1);
- MAKE_STD_ZVAL(ztype);
- ZVAL_LONG(ztype, type);
- MAKE_STD_ZVAL(zdata);
- ZVAL_STRINGL(zdata, data, size, 1);
-
- zend_replace_error_handling(EH_NORMAL, NULL, &zeh TSRMLS_CC);
- if (SUCCESS == zend_fcall_info_argn(&client_obj->debug.fci TSRMLS_CC, 4, &zclient, &zreq, &ztype, &zdata)) {
- ++client_obj->client->callback.depth;
- zend_fcall_info_call(&client_obj->debug.fci, &client_obj->debug.fcc, NULL, NULL TSRMLS_CC);
- --client_obj->client->callback.depth;
+
+ ZVAL_OBJECT(&zclient, &client_obj->zo, 1);
+ ZVAL_OBJECT(&zreq, &((php_http_message_object_t *) e->opaque)->zo, 1);
+ ZVAL_LONG(&ztype, type);
+ ZVAL_STRINGL(&zdata, data, size);
+
+ zend_replace_error_handling(EH_NORMAL, NULL, &zeh);
+ if (SUCCESS == zend_fcall_info_argn(&client_obj->debug.fci, 4, &zclient, &zreq, &ztype, &zdata)) {
++ ++client->callback.depth;
+ zend_fcall_info_call(&client_obj->debug.fci, &client_obj->debug.fcc, NULL, NULL);
++ --client->callback.depth;
zend_fcall_info_args_clear(&client_obj->debug.fci, 0);
}
- zend_restore_error_handling(&zeh TSRMLS_CC);
+ zend_restore_error_handling(&zeh);
zval_ptr_dtor(&zclient);
zval_ptr_dtor(&zreq);