2 +--------------------------------------------------------------------+
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the conditions mentioned |
7 | in the accompanying LICENSE file are met. |
8 +--------------------------------------------------------------------+
9 | Copyright (c) 2004-2014, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
13 #include "php_http_api.h"
15 zend_object_value
php_http_object_new(zend_class_entry
*ce TSRMLS_DC
)
17 return php_http_object_new_ex(ce
, NULL
, NULL TSRMLS_CC
);
20 zend_object_value
php_http_object_new_ex(zend_class_entry
*ce
, void *nothing
, php_http_object_t
**ptr TSRMLS_DC
)
24 o
= ecalloc(1, sizeof(php_http_object_t
));
25 zend_object_std_init((zend_object
*) o
, ce TSRMLS_CC
);
26 object_properties_init((zend_object
*) o
, ce
);
32 o
->zv
.handle
= zend_objects_store_put(o
, NULL
, (zend_objects_free_object_storage_t
) zend_objects_free_object_storage
, NULL TSRMLS_CC
);
33 o
->zv
.handlers
= zend_get_std_object_handlers();
38 STATUS
php_http_new(zend_object_value
*ovp
, zend_class_entry
*ce
, php_http_new_t create
, zend_class_entry
*parent_ce
, void *intern_ptr
, void **obj_ptr TSRMLS_DC
)
44 } else if (parent_ce
&& !instanceof_function(ce
, parent_ce TSRMLS_CC
)) {
45 php_http_throw(unexpected_val
, "Class %s does not extend %s", ce
->name
, parent_ce
->name
);
49 ov
= create(ce
, intern_ptr
, obj_ptr TSRMLS_CC
);
56 STATUS
php_http_method_call(zval
*object
, const char *method_str
, size_t method_len
, int argc
, zval
**argv
[], zval
**retval_ptr TSRMLS_DC
)
63 fci
.size
= sizeof(fci
);
64 fci
.object_ptr
= object
;
65 fci
.function_name
= &zmethod
;
66 fci
.retval_ptr_ptr
= retval_ptr
? retval_ptr
: &retval
;
67 fci
.param_count
= argc
;
69 fci
.no_separation
= 1;
70 fci
.symbol_table
= NULL
;
71 fci
.function_table
= NULL
;
74 ZVAL_STRINGL(&zmethod
, method_str
, method_len
, 0);
75 rv
= zend_call_function(&fci
, NULL TSRMLS_CC
);
77 if (!retval_ptr
&& retval
) {
78 zval_ptr_dtor(&retval
);
88 * vim600: noet sw=4 ts=4 fdm=marker
89 * vim<600: noet sw=4 ts=4