not work as expected in a PHP version lower than 5.1.3.
Internals:
- - our http_urlencode_hash() only handles arrays and does not
- differentiate between prefixes for numeric or string keys.
+ - our http_urlencode_hash() does not differentiate between prefixes
+ for numeric or string keys.
PHP_FE(http_put_file, http_arg_pass_ref_4)
PHP_FE(http_put_stream, http_arg_pass_ref_4)
PHP_FE(http_request, http_arg_pass_ref_5)
-#ifdef HAVE_CURL_GETFORMDATA
PHP_FE(http_request_body_encode, NULL)
-#endif
#endif
PHP_FE(http_request_method_register, NULL)
PHP_FE(http_request_method_unregister, NULL)
{
http_deflatestream_object *o = (http_deflatestream_object *) object;
- if (OBJ_PROP(o)) {
- zend_hash_destroy(OBJ_PROP(o));
- FREE_HASHTABLE(OBJ_PROP(o));
- }
if (o->stream) {
http_encoding_deflate_stream_free(&o->stream);
}
- efree(o);
+ freeObject(o);
}
/* {{{ proto void HttpDeflateStream::__construct([int flags = 0])
{
http_inflatestream_object *o = (http_inflatestream_object *) object;
- if (OBJ_PROP(o)) {
- zend_hash_destroy(OBJ_PROP(o));
- FREE_HASHTABLE(OBJ_PROP(o));
- }
if (o->stream) {
http_encoding_inflate_stream_free(&o->stream);
}
- efree(o);
+ freeObject(o);
}
/* {{{ proto void HttpInflateStream::__construct([int flags = 0])
{
http_message_object *o = (http_message_object *) object;
- if (OBJ_PROP(o)) {
- zend_hash_destroy(OBJ_PROP(o));
- FREE_HASHTABLE(OBJ_PROP(o));
- }
if (o->message) {
http_message_dtor(o->message);
efree(o->message);
p.value.obj = o->parent;
zend_objects_store_del_ref(&p TSRMLS_CC);
}
- efree(o);
+ freeObject(o);
}
static zval *_http_message_object_read_prop(zval *object, zval *member, int type TSRMLS_DC)
{
http_querystring_object *o = (http_querystring_object *) object;
- if (OBJ_PROP(o)) {
- zend_hash_destroy(OBJ_PROP(o));
- FREE_HASHTABLE(OBJ_PROP(o));
- }
- efree(o);
+ freeObject(o);
}
/* {{{ querystring helpers */
{
http_request_object *o = (http_request_object *) object;
- if (OBJ_PROP(o)) {
- zend_hash_destroy(OBJ_PROP(o));
- FREE_HASHTABLE(OBJ_PROP(o));
- }
http_request_free(&o->request);
- efree(o);
+ freeObject(o);
}
#define http_request_object_check_request_content_type(t) _http_request_object_check_request_content_type((t) TSRMLS_CC)
{
http_requestpool_object *o = (http_requestpool_object *) object;
- if (OBJ_PROP(o)) {
- zend_hash_destroy(OBJ_PROP(o));
- FREE_HASHTABLE(OBJ_PROP(o));
- }
http_request_pool_dtor(&o->pool);
- efree(o);
+ freeObject(o);
}
#define http_requestpool_object_llist2array _http_requestpool_object_llist2array
#endif
#include "php.h"
+#include "missing.h"
#include "php_http_std_defs.h"
#include "phpstr/phpstr.h"
-#include "missing.h"
#ifdef HTTP_WANT_SAPI
# if PHP_API_VERSION > 20041225
# define HTTP_HAVE_SAPI_RTIME
-# else
# endif
# include "SAPI.h"
#endif
PHP_FUNCTION(http_put_file);
PHP_FUNCTION(http_put_stream);
PHP_FUNCTION(http_request);
-#ifdef HAVE_CURL_GETFORMDATA
PHP_FUNCTION(http_request_body_encode);
-#endif /* HAVE_CURL_GETFORMDATA */
#endif /* HTTP_HAVE_CURL */
PHP_FUNCTION(http_request_method_register);
PHP_FUNCTION(http_request_method_unregister);
# define getObject(t, o) getObjectEx(t, o, getThis())
# define getObjectEx(t, o, v) t * o = ((t *) zend_object_store_get_object(v TSRMLS_CC))
# define putObject(t, o) zend_objects_store_put(o, (zend_objects_store_dtor_t) zend_objects_destroy_object, (zend_objects_free_object_storage_t) _ ##t## _free, NULL TSRMLS_CC);
+# ifndef WONKY
+# define freeObject(o) \
+ if (OBJ_GUARDS(o)) { \
+ zend_hash_destroy(OBJ_GUARDS(o)); \
+ FREE_HASHTABLE(OBJ_GUARDS(o)); \
+ } \
+ if (OBJ_PROP(o)) { \
+ zend_hash_destroy(OBJ_PROP(o)); \
+ FREE_HASHTABLE(OBJ_PROP(o)); \
+ } \
+ efree(o);
+# else
+# define freeObject(o) \
+ if (OBJ_PROP(o)) { \
+ zend_hash_destroy(OBJ_PROP(o)); \
+ FREE_HASHTABLE(OBJ_PROP(o)); \
+ } \
+ efree(o);
+# endif
# define OBJ_PROP(o) (o)->zo.properties
+# define OBJ_GUARDS(o) (o)->zo.guards
# define DCL_STATIC_PROP(a, t, n, v) zend_declare_property_ ##t(OBJ_PROP_CE, (#n), sizeof(#n)-1, (v), (ZEND_ACC_ ##a | ZEND_ACC_STATIC) TSRMLS_CC)
# define DCL_STATIC_PROP_Z(a, n, v) zend_declare_property(OBJ_PROP_CE, (#n), sizeof(#n)-1, (v), (ZEND_ACC_ ##a | ZEND_ACC_STATIC) TSRMLS_CC)