From: Marcus Boerger Date: Fri, 29 Jul 2005 18:12:12 +0000 (+0000) Subject: - Fix property handling X-Git-Tag: RELEASE_0_11_0~9 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=9a35b7682fede86cb0167d21a67fea38a6e85181;p=m6w6%2Fext-http - Fix property handling - Fix tests --- diff --git a/http_request_object.c b/http_request_object.c index 571f521..d1c6dba 100644 --- a/http_request_object.c +++ b/http_request_object.c @@ -278,7 +278,7 @@ zend_function_entry http_request_object_fe[] = { HTTP_REQUEST_ALIAS(methodUnregister, http_request_method_unregister) HTTP_REQUEST_ALIAS(methodName, http_request_method_name) HTTP_REQUEST_ALIAS(methodExists, http_request_method_exists) - + {NULL, NULL, NULL} }; static zend_object_handlers http_request_object_handlers; @@ -287,6 +287,8 @@ void _http_request_object_init(INIT_FUNC_ARGS) { HTTP_REGISTER_CLASS_EX(HttpRequest, http_request_object, NULL, 0); + _http_request_object_declare_default_properties(TSRMLS_C); + /* HTTP/1.1 */ HTTP_LONG_CONSTANT("HTTP_GET", HTTP_GET); HTTP_LONG_CONSTANT("HTTP_HEAD", HTTP_HEAD); diff --git a/php_http_std_defs.h b/php_http_std_defs.h index 115ece2..f0e862e 100644 --- a/php_http_std_defs.h +++ b/php_http_std_defs.h @@ -289,15 +289,15 @@ typedef int STATUS; zval_dtor(__tmp); \ efree(__tmp); \ } -# define DCL_PROP(a, t, n, v) zend_declare_property_ ##t(ce, (#n), sizeof(#n), (v), (ZEND_ACC_ ##a) TSRMLS_CC) -# define DCL_PROP_Z(a, n, v) zend_declare_property(ce, (#n), sizeof(#n), (v), (ZEND_ACC_ ##a) TSRMLS_CC) -# define DCL_PROP_N(a, n) zend_declare_property_null(ce, (#n), sizeof(#n), (ZEND_ACC_ ##a) TSRMLS_CC) +# define DCL_PROP(a, t, n, v) zend_declare_property_ ##t(ce, (#n), sizeof(#n)-1, (v), (ZEND_ACC_ ##a) TSRMLS_CC) +# define DCL_PROP_Z(a, n, v) zend_declare_property(ce, (#n), sizeof(#n)-1, (v), (ZEND_ACC_ ##a) TSRMLS_CC) +# define DCL_PROP_N(a, n) zend_declare_property_null(ce, (#n), sizeof(#n)-1, (ZEND_ACC_ ##a) TSRMLS_CC) # define UPD_PROP(o, t, n, v) UPD_PROP_EX(o, getThis(), t, n, v) -# define UPD_PROP_EX(o, this, t, n, v) zend_update_property_ ##t(o->zo.ce, this, (#n), sizeof(#n), (v) TSRMLS_CC) +# define UPD_PROP_EX(o, this, t, n, v) zend_update_property_ ##t(o->zo.ce, this, (#n), sizeof(#n)-1, (v) TSRMLS_CC) # define SET_PROP(o, n, z) SET_PROP_EX(o, getThis(), n, z) -# define SET_PROP_EX(o, this, n, z) zend_update_property(o->zo.ce, this, (#n), sizeof(#n), (z) TSRMLS_CC) +# define SET_PROP_EX(o, this, n, z) zend_update_property(o->zo.ce, this, (#n), sizeof(#n)-1, (z) TSRMLS_CC) # define GET_PROP(o, n) GET_PROP_EX(o, getThis(), n) -# define GET_PROP_EX(o, this, n) zend_read_property(o->zo.ce, this, (#n), sizeof(#n), 0 TSRMLS_CC) +# define GET_PROP_EX(o, this, n) zend_read_property(o->zo.ce, this, (#n), sizeof(#n)-1, 0 TSRMLS_CC) # define ACC_PROP_PRIVATE(ce, flags) ((flags & ZEND_ACC_PRIVATE) && (EG(scope) && ce == EG(scope)) # define ACC_PROP_PROTECTED(ce, flags) ((flags & ZEND_ACC_PROTECTED) && (zend_check_protected(ce, EG(scope)))) @@ -314,8 +314,8 @@ typedef int STATUS; # define FREE_PARR(o, p) \ { \ - zval *__tmp = NULL; \ - if (__tmp = GET_PROP(o, p)) { \ + zval *__tmp = GET_PROP(o, p); \ + if (__tmp) { \ zval_dtor(__tmp); \ FREE_ZVAL(__tmp); \ __tmp = NULL; \ diff --git a/tests/date_002.phpt b/tests/date_002.phpt index 98ab785..f7f8a3b 100644 --- a/tests/date_002.phpt +++ b/tests/date_002.phpt @@ -4,6 +4,8 @@ http_date() without timestamp +--INI-- +date.timezone=GMT --FILE-- +===DONE=== --EXPECTF-- %sTEST Array @@ -22,5 +28,5 @@ Array [Accept-Charset] => iso-8859-1, * [User-Agent] => Mozilla/5.0 ) -string(7) "a=b&c=d" - +OK +===DONE===