tests
[m6w6/ext-http] / php_http_object.c
index 9282e5d66c9ee3f3b0a7db84c09bf8c285377eb3..39e9116cbac20e9a95ba3df1d8ddaa33ff3b25ce 100644 (file)
@@ -6,14 +6,11 @@
     | modification, are permitted provided that the conditions mentioned |
     | in the accompanying LICENSE file are met.                          |
     +--------------------------------------------------------------------+
-    | Copyright (c) 2004-2010, Michael Wallner <mike@php.net>            |
+    | Copyright (c) 2004-2011, Michael Wallner <mike@php.net>            |
     +--------------------------------------------------------------------+
 */
 
-/* $Id: http_api.c 300299 2010-06-09 06:23:16Z mike $ */
-
-
-#include "php_http.h"
+#include "php_http_api.h"
 
 STATUS php_http_new(zend_object_value *ov, zend_class_entry *ce, php_http_new_t create, zend_class_entry *parent_ce, void *intern_ptr, void **obj_ptr TSRMLS_DC)
 {
@@ -35,14 +32,14 @@ PHP_HTTP_API zend_error_handling_t php_http_object_get_error_handling(zval *obje
 
        zeh = zend_read_property(Z_OBJCE_P(object), object, ZEND_STRL("errorHandling"), 0 TSRMLS_CC);
        if (Z_TYPE_P(zeh) != IS_NULL) {
-               lzeh = php_http_zsep(IS_LONG, zeh);
+               lzeh = php_http_ztyp(IS_LONG, zeh);
                eh = Z_LVAL_P(lzeh);
                zval_ptr_dtor(&lzeh);
                return eh;
        }
        zeh = zend_read_static_property(php_http_object_class_entry, ZEND_STRL("defaultErrorHandling"), 0 TSRMLS_CC);
        if (Z_TYPE_P(zeh) != IS_NULL) {
-               lzeh = php_http_zsep(IS_LONG, zeh);
+               lzeh = php_http_ztyp(IS_LONG, zeh);
                eh = Z_LVAL_P(lzeh);
                zval_ptr_dtor(&lzeh);
                return eh;
@@ -94,7 +91,7 @@ zend_object_value php_http_object_new_ex(zend_class_entry *ce, void *nothing, ph
        php_http_object_t *o;
 
        o = ecalloc(1, sizeof(php_http_object_t));
-       zend_object_std_init((zend_object *)o, ce TSRMLS_CC);
+       zend_object_std_init((zend_object *) o, ce TSRMLS_CC);
        object_properties_init((zend_object *) o, ce);
 
        if (ptr) {
@@ -115,7 +112,7 @@ PHP_METHOD(HttpObject, factory)
        zend_fcall_info fci;
        zend_fcall_info_cache fcc;
 
-       with_error_handling(EH_THROW, PHP_HTTP_EX_CE(runtime)) {
+       with_error_handling(EH_THROW, php_http_exception_class_entry) {
                if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "C|a/!", &class_entry, &ctor_args)) {
                        object_init_ex(return_value, class_entry);
 
@@ -142,7 +139,6 @@ PHP_METHOD(HttpObject, getErrorHandling)
 PHP_METHOD(HttpObject, setErrorHandling)
 {
        long eh;
-       zval *old;
 
        if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &eh)) {
                switch (eh) {
@@ -154,6 +150,7 @@ PHP_METHOD(HttpObject, setErrorHandling)
 
                        default:
                                php_http_error(HE_WARNING, PHP_HTTP_E_RUNTIME, "unknown error handling code (%ld)", eh);
+                               break;
                }
        }
 
@@ -168,7 +165,6 @@ PHP_METHOD(HttpObject, getDefaultErrorHandling)
 PHP_METHOD(HttpObject, setDefaultErrorHandling)
 {
        long eh;
-       zval *old;
 
        if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &eh)) {
                switch (eh) {
@@ -180,6 +176,7 @@ PHP_METHOD(HttpObject, setDefaultErrorHandling)
 
                        default:
                                php_http_error(HE_WARNING, PHP_HTTP_E_RUNTIME, "unknown error handling code (%ld)", eh);
+                               break;
                }
        }
 }