xref: /php-src/ext/curl/multi.c (revision edb9f65f)
1 /*
2    +----------------------------------------------------------------------+
3    | Copyright (c) The PHP Group                                          |
4    +----------------------------------------------------------------------+
5    | This source file is subject to version 3.01 of the PHP license,      |
6    | that is bundled with this package in the file LICENSE, and is        |
7    | available through the world-wide-web at the following url:           |
8    | https://www.php.net/license/3_01.txt                                 |
9    | If you did not receive a copy of the PHP license and are unable to   |
10    | obtain it through the world-wide-web, please send a note to          |
11    | license@php.net so we can mail you a copy immediately.               |
12    +----------------------------------------------------------------------+
13    | Author: Sterling Hughes <sterling@php.net>                           |
14    +----------------------------------------------------------------------+
15 */
16 
17 #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
18 
19 #ifdef HAVE_CONFIG_H
20 #include "config.h"
21 #endif
22 
23 #include "php.h"
24 #include "Zend/zend_smart_str.h"
25 
26 #include "curl_private.h"
27 
28 #include <curl/curl.h>
29 #include <curl/multi.h>
30 
31 #ifdef HAVE_SYS_SELECT_H
32 #include <sys/select.h>
33 #endif
34 
35 #ifdef HAVE_SYS_TIME_H
36 #include <sys/time.h>
37 #endif
38 
39 #ifdef HAVE_SYS_TYPES_H
40 #include <sys/types.h>
41 #endif
42 
43 #ifdef HAVE_UNISTD_H
44 #include <unistd.h>
45 #endif
46 
47 #define SAVE_CURLM_ERROR(__handle, __err) (__handle)->err.no = (int) __err;
48 
49 /* CurlMultiHandle class */
50 
51 zend_class_entry *curl_multi_ce;
52 
curl_multi_from_obj(zend_object * obj)53 static inline php_curlm *curl_multi_from_obj(zend_object *obj) {
54 	return (php_curlm *)((char *)(obj) - XtOffsetOf(php_curlm, std));
55 }
56 
57 #define Z_CURL_MULTI_P(zv) curl_multi_from_obj(Z_OBJ_P(zv))
58 
59 /* {{{ Returns a new cURL multi handle */
PHP_FUNCTION(curl_multi_init)60 PHP_FUNCTION(curl_multi_init)
61 {
62 	php_curlm *mh;
63 	CURLM *multi;
64 
65 	ZEND_PARSE_PARAMETERS_NONE();
66 	multi = curl_multi_init();
67 	if (UNEXPECTED(multi == NULL)) {
68 		zend_throw_error(NULL, "%s(): Could not initialize a new cURL multi handle", get_active_function_name());
69 		RETURN_THROWS();
70 	}
71 	object_init_ex(return_value, curl_multi_ce);
72 	mh = Z_CURL_MULTI_P(return_value);
73 	mh->multi = multi;
74 
75 	zend_llist_init(&mh->easyh, sizeof(zval), _php_curl_multi_cleanup_list, 0);
76 }
77 /* }}} */
78 
79 /* {{{ Add a normal cURL handle to a cURL multi handle */
PHP_FUNCTION(curl_multi_add_handle)80 PHP_FUNCTION(curl_multi_add_handle)
81 {
82 	zval      *z_mh;
83 	zval      *z_ch;
84 	php_curlm *mh;
85 	php_curl  *ch;
86 	CURLMcode error = CURLM_OK;
87 
88 	ZEND_PARSE_PARAMETERS_START(2,2)
89 		Z_PARAM_OBJECT_OF_CLASS(z_mh, curl_multi_ce)
90 		Z_PARAM_OBJECT_OF_CLASS(z_ch, curl_ce)
91 	ZEND_PARSE_PARAMETERS_END();
92 
93 	mh = Z_CURL_MULTI_P(z_mh);
94 	ch = Z_CURL_P(z_ch);
95 
96 	_php_curl_verify_handlers(ch, /* reporterror */ true);
97 
98 	_php_curl_cleanup_handle(ch);
99 
100 	Z_ADDREF_P(z_ch);
101 	zend_llist_add_element(&mh->easyh, z_ch);
102 
103 	error = curl_multi_add_handle(mh->multi, ch->cp);
104 	SAVE_CURLM_ERROR(mh, error);
105 
106 	RETURN_LONG((zend_long) error);
107 }
108 /* }}} */
109 
_php_curl_multi_cleanup_list(void * data)110 void _php_curl_multi_cleanup_list(void *data) /* {{{ */
111 {
112 	zval *z_ch = (zval *)data;
113 
114 	zval_ptr_dtor(z_ch);
115 }
116 /* }}} */
117 
118 /* Used internally as comparison routine passed to zend_list_del_element */
curl_compare_objects(zval * z1,zval * z2)119 static int curl_compare_objects( zval *z1, zval *z2 ) /* {{{ */
120 {
121 	return (Z_TYPE_P(z1) == Z_TYPE_P(z2) &&
122 			Z_TYPE_P(z1) == IS_OBJECT &&
123 			Z_OBJ_P(z1) == Z_OBJ_P(z2));
124 }
125 /* }}} */
126 
127 /* Used to find the php_curl resource for a given curl easy handle */
_php_curl_multi_find_easy_handle(php_curlm * mh,CURL * easy)128 static zval *_php_curl_multi_find_easy_handle(php_curlm *mh, CURL *easy) /* {{{ */
129 {
130 	php_curl 			*tmp_ch;
131 	zend_llist_position pos;
132 	zval				*pz_ch_temp;
133 
134 	for(pz_ch_temp = (zval *)zend_llist_get_first_ex(&mh->easyh, &pos); pz_ch_temp;
135 		pz_ch_temp = (zval *)zend_llist_get_next_ex(&mh->easyh, &pos)) {
136 		tmp_ch = Z_CURL_P(pz_ch_temp);
137 
138 		if (tmp_ch->cp == easy) {
139 			return pz_ch_temp;
140 		}
141 	}
142 
143 	return NULL;
144 }
145 /* }}} */
146 
147 /* {{{ Remove a multi handle from a set of cURL handles */
PHP_FUNCTION(curl_multi_remove_handle)148 PHP_FUNCTION(curl_multi_remove_handle)
149 {
150 	zval      *z_mh;
151 	zval      *z_ch;
152 	php_curlm *mh;
153 	php_curl  *ch;
154 	CURLMcode error = CURLM_OK;
155 
156 	ZEND_PARSE_PARAMETERS_START(2,2)
157 		Z_PARAM_OBJECT_OF_CLASS(z_mh, curl_multi_ce)
158 		Z_PARAM_OBJECT_OF_CLASS(z_ch, curl_ce)
159 	ZEND_PARSE_PARAMETERS_END();
160 
161 	mh = Z_CURL_MULTI_P(z_mh);
162 	ch = Z_CURL_P(z_ch);
163 
164 	error = curl_multi_remove_handle(mh->multi, ch->cp);
165 	SAVE_CURLM_ERROR(mh, error);
166 
167 	RETVAL_LONG((zend_long) error);
168 	zend_llist_del_element(&mh->easyh, z_ch, (int (*)(void *, void *))curl_compare_objects);
169 
170 }
171 /* }}} */
172 
173 /* {{{ Get all the sockets associated with the cURL extension, which can then be "selected" */
PHP_FUNCTION(curl_multi_select)174 PHP_FUNCTION(curl_multi_select)
175 {
176 	zval           *z_mh;
177 	php_curlm      *mh;
178 	double          timeout = 1.0;
179 	int             numfds = 0;
180 	CURLMcode error = CURLM_OK;
181 
182 	ZEND_PARSE_PARAMETERS_START(1,2)
183 		Z_PARAM_OBJECT_OF_CLASS(z_mh, curl_multi_ce)
184 		Z_PARAM_OPTIONAL
185 		Z_PARAM_DOUBLE(timeout)
186 	ZEND_PARSE_PARAMETERS_END();
187 
188 	mh = Z_CURL_MULTI_P(z_mh);
189 
190 	error = curl_multi_wait(mh->multi, NULL, 0, (unsigned long) (timeout * 1000.0), &numfds);
191 	if (CURLM_OK != error) {
192 		SAVE_CURLM_ERROR(mh, error);
193 		RETURN_LONG(-1);
194 	}
195 
196 	RETURN_LONG(numfds);
197 }
198 /* }}} */
199 
200 /* {{{ Run the sub-connections of the current cURL handle */
PHP_FUNCTION(curl_multi_exec)201 PHP_FUNCTION(curl_multi_exec)
202 {
203 	zval      *z_mh;
204 	zval      *z_still_running;
205 	php_curlm *mh;
206 	int        still_running;
207 	CURLMcode error = CURLM_OK;
208 
209 	ZEND_PARSE_PARAMETERS_START(2, 2)
210 		Z_PARAM_OBJECT_OF_CLASS(z_mh, curl_multi_ce)
211 		Z_PARAM_ZVAL(z_still_running)
212 	ZEND_PARSE_PARAMETERS_END();
213 
214 	mh = Z_CURL_MULTI_P(z_mh);
215 
216 	{
217 		zend_llist_position pos;
218 		php_curl *ch;
219 		zval	*pz_ch;
220 
221 		for (pz_ch = (zval *)zend_llist_get_first_ex(&mh->easyh, &pos); pz_ch;
222 			pz_ch = (zval *)zend_llist_get_next_ex(&mh->easyh, &pos)) {
223 			ch = Z_CURL_P(pz_ch);
224 
225 			_php_curl_verify_handlers(ch, /* reporterror */ true);
226 		}
227 	}
228 
229 	still_running = zval_get_long(z_still_running);
230 	error = curl_multi_perform(mh->multi, &still_running);
231 	ZEND_TRY_ASSIGN_REF_LONG(z_still_running, still_running);
232 
233 	SAVE_CURLM_ERROR(mh, error);
234 	RETURN_LONG((zend_long) error);
235 }
236 /* }}} */
237 
238 /* {{{ Return the content of a cURL handle if CURLOPT_RETURNTRANSFER is set */
PHP_FUNCTION(curl_multi_getcontent)239 PHP_FUNCTION(curl_multi_getcontent)
240 {
241 	zval     *z_ch;
242 	php_curl *ch;
243 
244 	ZEND_PARSE_PARAMETERS_START(1, 1)
245 		Z_PARAM_OBJECT_OF_CLASS(z_ch, curl_ce)
246 	ZEND_PARSE_PARAMETERS_END();
247 
248 	ch = Z_CURL_P(z_ch);
249 
250 	if (ch->handlers.write->method == PHP_CURL_RETURN) {
251 		if (!ch->handlers.write->buf.s) {
252 			RETURN_EMPTY_STRING();
253 		}
254 		smart_str_0(&ch->handlers.write->buf);
255 		RETURN_STR_COPY(ch->handlers.write->buf.s);
256 	}
257 
258 	RETURN_NULL();
259 }
260 /* }}} */
261 
262 /* {{{ Get information about the current transfers */
PHP_FUNCTION(curl_multi_info_read)263 PHP_FUNCTION(curl_multi_info_read)
264 {
265 	zval      *z_mh;
266 	php_curlm *mh;
267 	CURLMsg	  *tmp_msg;
268 	int        queued_msgs;
269 	zval      *zmsgs_in_queue = NULL;
270 	php_curl  *ch;
271 
272 	ZEND_PARSE_PARAMETERS_START(1, 2)
273 		Z_PARAM_OBJECT_OF_CLASS(z_mh, curl_multi_ce)
274 		Z_PARAM_OPTIONAL
275 		Z_PARAM_ZVAL(zmsgs_in_queue)
276 	ZEND_PARSE_PARAMETERS_END();
277 
278 	mh = Z_CURL_MULTI_P(z_mh);
279 
280 	tmp_msg = curl_multi_info_read(mh->multi, &queued_msgs);
281 	if (tmp_msg == NULL) {
282 		RETURN_FALSE;
283 	}
284 
285 	if (zmsgs_in_queue) {
286 		ZEND_TRY_ASSIGN_REF_LONG(zmsgs_in_queue, queued_msgs);
287 	}
288 
289 	array_init(return_value);
290 	add_assoc_long(return_value, "msg", tmp_msg->msg);
291 	add_assoc_long(return_value, "result", tmp_msg->data.result);
292 
293 	/* find the original easy curl handle */
294 	{
295 		zval *pz_ch = _php_curl_multi_find_easy_handle(mh, tmp_msg->easy_handle);
296 		if (pz_ch != NULL) {
297 			/* we must save result to be able to read error message */
298 			ch = Z_CURL_P(pz_ch);
299 			SAVE_CURL_ERROR(ch, tmp_msg->data.result);
300 
301 			Z_ADDREF_P(pz_ch);
302 			add_assoc_zval(return_value, "handle", pz_ch);
303 		}
304 	}
305 }
306 /* }}} */
307 
308 /* {{{ Close a set of cURL handles */
PHP_FUNCTION(curl_multi_close)309 PHP_FUNCTION(curl_multi_close)
310 {
311 	php_curlm *mh;
312 	zval *z_mh;
313 
314 	zend_llist_position pos;
315 	zval *pz_ch;
316 
317 	ZEND_PARSE_PARAMETERS_START(1,1)
318 		Z_PARAM_OBJECT_OF_CLASS(z_mh, curl_multi_ce)
319 	ZEND_PARSE_PARAMETERS_END();
320 
321 	mh = Z_CURL_MULTI_P(z_mh);
322 
323 	for (pz_ch = (zval *)zend_llist_get_first_ex(&mh->easyh, &pos); pz_ch;
324 		pz_ch = (zval *)zend_llist_get_next_ex(&mh->easyh, &pos)) {
325 		php_curl *ch = Z_CURL_P(pz_ch);
326 		_php_curl_verify_handlers(ch, /* reporterror */ true);
327 		curl_multi_remove_handle(mh->multi, ch->cp);
328 	}
329 	zend_llist_clean(&mh->easyh);
330 }
331 /* }}} */
332 
333 /* {{{ Return an integer containing the last multi curl error number */
PHP_FUNCTION(curl_multi_errno)334 PHP_FUNCTION(curl_multi_errno)
335 {
336 	zval        *z_mh;
337 	php_curlm   *mh;
338 
339 	ZEND_PARSE_PARAMETERS_START(1,1)
340 		Z_PARAM_OBJECT_OF_CLASS(z_mh, curl_multi_ce)
341 	ZEND_PARSE_PARAMETERS_END();
342 
343 	mh = Z_CURL_MULTI_P(z_mh);
344 
345 	RETURN_LONG(mh->err.no);
346 }
347 /* }}} */
348 
349 /* {{{ return string describing error code */
PHP_FUNCTION(curl_multi_strerror)350 PHP_FUNCTION(curl_multi_strerror)
351 {
352 	zend_long code;
353 	const char *str;
354 
355 	ZEND_PARSE_PARAMETERS_START(1,1)
356 		Z_PARAM_LONG(code)
357 	ZEND_PARSE_PARAMETERS_END();
358 
359 	str = curl_multi_strerror(code);
360 	if (str) {
361 		RETURN_STRING(str);
362 	} else {
363 		RETURN_NULL();
364 	}
365 }
366 /* }}} */
367 
368 
_php_server_push_callback(CURL * parent_ch,CURL * easy,size_t num_headers,struct curl_pushheaders * push_headers,void * userp)369 static int _php_server_push_callback(CURL *parent_ch, CURL *easy, size_t num_headers, struct curl_pushheaders *push_headers, void *userp) /* {{{ */
370 {
371 	php_curl 				*ch;
372 	php_curl 				*parent;
373 	php_curlm 				*mh 			= (php_curlm *)userp;
374 	size_t 					rval 			= CURL_PUSH_DENY;
375 	php_curl_callback 		*t 				= mh->handlers.server_push;
376 	zval					*pz_parent_ch 	= NULL;
377 	zval 					pz_ch;
378 	zval 					headers;
379 	zval 					retval;
380 	char 					*header;
381 	zend_result				error;
382 	zend_fcall_info 		fci 			= empty_fcall_info;
383 
384 	pz_parent_ch = _php_curl_multi_find_easy_handle(mh, parent_ch);
385 	if (pz_parent_ch == NULL) {
386 		return rval;
387 	}
388 
389 	if (UNEXPECTED(zend_fcall_info_init(&t->func_name, 0, &fci, &t->fci_cache, NULL, NULL) == FAILURE)) {
390 		php_error_docref(NULL, E_WARNING, "Cannot call the CURLMOPT_PUSHFUNCTION");
391 		return rval;
392 	}
393 
394 	parent = Z_CURL_P(pz_parent_ch);
395 
396 	ch = init_curl_handle_into_zval(&pz_ch);
397 	ch->cp = easy;
398 	_php_setup_easy_copy_handlers(ch, parent);
399 
400 	size_t i;
401 	array_init(&headers);
402 	for(i=0; i<num_headers; i++) {
403 		header = curl_pushheader_bynum(push_headers, i);
404 		add_next_index_string(&headers, header);
405 	}
406 
407 	ZEND_ASSERT(pz_parent_ch);
408 	zval call_args[3] = {*pz_parent_ch, pz_ch, headers};
409 
410 	fci.param_count = 3;
411 	fci.params = call_args;
412 	fci.retval = &retval;
413 
414 	error = zend_call_function(&fci, &t->fci_cache);
415 	zval_ptr_dtor_nogc(&headers);
416 
417 	if (error == FAILURE) {
418 		php_error_docref(NULL, E_WARNING, "Cannot call the CURLMOPT_PUSHFUNCTION");
419 	} else if (!Z_ISUNDEF(retval)) {
420 		if (CURL_PUSH_DENY != zval_get_long(&retval)) {
421 		    rval = CURL_PUSH_OK;
422 			zend_llist_add_element(&mh->easyh, &pz_ch);
423 		} else {
424 			/* libcurl will free this easy handle, avoid double free */
425 			ch->cp = NULL;
426 		}
427 	}
428 
429 	return rval;
430 }
431 /* }}} */
432 
_php_curl_multi_setopt(php_curlm * mh,zend_long option,zval * zvalue,zval * return_value)433 static bool _php_curl_multi_setopt(php_curlm *mh, zend_long option, zval *zvalue, zval *return_value) /* {{{ */
434 {
435 	CURLMcode error = CURLM_OK;
436 
437 	switch (option) {
438 		case CURLMOPT_PIPELINING:
439 		case CURLMOPT_MAXCONNECTS:
440 		case CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE:
441 		case CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE:
442 		case CURLMOPT_MAX_HOST_CONNECTIONS:
443 		case CURLMOPT_MAX_PIPELINE_LENGTH:
444 		case CURLMOPT_MAX_TOTAL_CONNECTIONS:
445 #if LIBCURL_VERSION_NUM >= 0x074300 /* Available since 7.67.0 */
446 		case CURLMOPT_MAX_CONCURRENT_STREAMS:
447 #endif
448 		{
449 			zend_long lval = zval_get_long(zvalue);
450 
451 			if (option == CURLMOPT_PIPELINING && (lval & 1)) {
452 #if LIBCURL_VERSION_NUM >= 0x073e00 /* Available since 7.62.0 */
453 				php_error_docref(NULL, E_WARNING, "CURLPIPE_HTTP1 is no longer supported");
454 #else
455 				php_error_docref(NULL, E_DEPRECATED, "CURLPIPE_HTTP1 is deprecated");
456 #endif
457 			}
458 			error = curl_multi_setopt(mh->multi, option, lval);
459 			break;
460 		}
461 		case CURLMOPT_PUSHFUNCTION:
462 			if (mh->handlers.server_push == NULL) {
463 				mh->handlers.server_push = ecalloc(1, sizeof(php_curl_callback));
464 			} else if (!Z_ISUNDEF(mh->handlers.server_push->func_name)) {
465 				zval_ptr_dtor(&mh->handlers.server_push->func_name);
466 				mh->handlers.server_push->fci_cache = empty_fcall_info_cache;
467 			}
468 
469 			ZVAL_COPY(&mh->handlers.server_push->func_name, zvalue);
470 			error = curl_multi_setopt(mh->multi, CURLMOPT_PUSHFUNCTION, _php_server_push_callback);
471 			if (error != CURLM_OK) {
472 				return false;
473 			}
474 			error = curl_multi_setopt(mh->multi, CURLMOPT_PUSHDATA, mh);
475 			break;
476 		default:
477 			zend_argument_value_error(2, "is not a valid cURL multi option");
478 			error = CURLM_UNKNOWN_OPTION;
479 			break;
480 	}
481 
482 	SAVE_CURLM_ERROR(mh, error);
483 
484 	return error == CURLM_OK;
485 }
486 /* }}} */
487 
488 /* {{{ Set an option for the curl multi handle */
PHP_FUNCTION(curl_multi_setopt)489 PHP_FUNCTION(curl_multi_setopt)
490 {
491 	zval       *z_mh, *zvalue;
492 	zend_long        options;
493 	php_curlm *mh;
494 
495 	ZEND_PARSE_PARAMETERS_START(3,3)
496 		Z_PARAM_OBJECT_OF_CLASS(z_mh, curl_multi_ce)
497 		Z_PARAM_LONG(options)
498 		Z_PARAM_ZVAL(zvalue)
499 	ZEND_PARSE_PARAMETERS_END();
500 
501 	mh = Z_CURL_MULTI_P(z_mh);
502 
503 	if (_php_curl_multi_setopt(mh, options, zvalue, return_value)) {
504 		RETURN_TRUE;
505 	} else {
506 		RETURN_FALSE;
507 	}
508 }
509 /* }}} */
510 
511 /* CurlMultiHandle class */
512 
curl_multi_create_object(zend_class_entry * class_type)513 static zend_object *curl_multi_create_object(zend_class_entry *class_type) {
514 	php_curlm *intern = zend_object_alloc(sizeof(php_curlm), class_type);
515 
516 	zend_object_std_init(&intern->std, class_type);
517 	object_properties_init(&intern->std, class_type);
518 
519 	return &intern->std;
520 }
521 
curl_multi_get_constructor(zend_object * object)522 static zend_function *curl_multi_get_constructor(zend_object *object) {
523 	zend_throw_error(NULL, "Cannot directly construct CurlMultiHandle, use curl_multi_init() instead");
524 	return NULL;
525 }
526 
curl_multi_free_obj(zend_object * object)527 static void curl_multi_free_obj(zend_object *object)
528 {
529 	php_curlm *mh = curl_multi_from_obj(object);
530 
531 	zend_llist_position pos;
532 	php_curl *ch;
533 	zval	*pz_ch;
534 
535 	if (!mh->multi) {
536 		/* Can happen if constructor throws. */
537 		zend_object_std_dtor(&mh->std);
538 		return;
539 	}
540 
541 	for (pz_ch = (zval *)zend_llist_get_first_ex(&mh->easyh, &pos); pz_ch;
542 		pz_ch = (zval *)zend_llist_get_next_ex(&mh->easyh, &pos)) {
543 		if (!(OBJ_FLAGS(Z_OBJ_P(pz_ch)) & IS_OBJ_FREE_CALLED)) {
544 			ch = Z_CURL_P(pz_ch);
545 			_php_curl_verify_handlers(ch, /* reporterror */ false);
546 		}
547 	}
548 
549 	curl_multi_cleanup(mh->multi);
550 	zend_llist_clean(&mh->easyh);
551 	if (mh->handlers.server_push) {
552 		zval_ptr_dtor(&mh->handlers.server_push->func_name);
553 		efree(mh->handlers.server_push);
554 	}
555 
556 	zend_object_std_dtor(&mh->std);
557 }
558 
curl_multi_get_gc(zend_object * object,zval ** table,int * n)559 static HashTable *curl_multi_get_gc(zend_object *object, zval **table, int *n)
560 {
561 	php_curlm *curl_multi = curl_multi_from_obj(object);
562 
563 	zend_get_gc_buffer *gc_buffer = zend_get_gc_buffer_create();
564 
565 	if (curl_multi->handlers.server_push) {
566 		zend_get_gc_buffer_add_zval(gc_buffer, &curl_multi->handlers.server_push->func_name);
567 	}
568 
569 	zend_llist_position pos;
570 	for (zval *pz_ch = (zval *) zend_llist_get_first_ex(&curl_multi->easyh, &pos); pz_ch;
571 		pz_ch = (zval *) zend_llist_get_next_ex(&curl_multi->easyh, &pos)) {
572 		zend_get_gc_buffer_add_zval(gc_buffer, pz_ch);
573 	}
574 
575 	zend_get_gc_buffer_use(gc_buffer, table, n);
576 
577 	return zend_std_get_properties(object);
578 }
579 
580 static zend_object_handlers curl_multi_handlers;
581 
curl_multi_register_handlers(void)582 void curl_multi_register_handlers(void) {
583 	curl_multi_ce->create_object = curl_multi_create_object;
584 	curl_multi_ce->default_object_handlers = &curl_multi_handlers;
585 
586 	memcpy(&curl_multi_handlers, &std_object_handlers, sizeof(zend_object_handlers));
587 	curl_multi_handlers.offset = XtOffsetOf(php_curlm, std);
588 	curl_multi_handlers.free_obj = curl_multi_free_obj;
589 	curl_multi_handlers.get_gc = curl_multi_get_gc;
590 	curl_multi_handlers.get_constructor = curl_multi_get_constructor;
591 	curl_multi_handlers.clone_obj = NULL;
592 	curl_multi_handlers.cast_object = curl_cast_object;
593 	curl_multi_handlers.compare = zend_objects_not_comparable;
594 }
595