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-2010, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
13 /* $Id: http_exception_object.c 292841 2009-12-31 08:48:57Z mike $ */
17 #include <Zend/zend_exceptions.h>
19 #ifndef PHP_HTTP_DBG_EXCEPTIONS
20 # define PHP_HTTP_DBG_EXCEPTIONS 0
23 zend_class_entry
*php_http_exception_class_entry
;
25 zend_function_entry php_http_exception_method_entry
[] = {
29 #if PHP_HTTP_DBG_EXCEPTIONS
30 static void php_http_exception_hook(zval
*ex TSRMLS_DC
)
33 zval
*m
= zend_read_property(Z_OBJCE_P(ex
), ex
, "message", lenof("message"), 0 TSRMLS_CC
);
34 fprintf(stderr
, "*** Threw exception '%s'\n", Z_STRVAL_P(m
));
36 fprintf(stderr
, "*** Threw NULL exception\n");
41 PHP_MINIT_FUNCTION(http_exception
)
43 PHP_HTTP_REGISTER_EXCEPTION(Exception
, php_http_exception_class_entry
, zend_exception_get_default(TSRMLS_C
));
45 zend_declare_class_constant_long(php_http_exception_class_entry
, ZEND_STRL("E_UNKNOWN"), PHP_HTTP_E_UNKNOWN TSRMLS_CC
);
46 zend_declare_class_constant_long(php_http_exception_class_entry
, ZEND_STRL("E_RUNTIME"), PHP_HTTP_E_RUNTIME TSRMLS_CC
);
47 zend_declare_class_constant_long(php_http_exception_class_entry
, ZEND_STRL("E_INVALID_PARAM"), PHP_HTTP_E_INVALID_PARAM TSRMLS_CC
);
48 zend_declare_class_constant_long(php_http_exception_class_entry
, ZEND_STRL("E_HEADER"), PHP_HTTP_E_HEADER TSRMLS_CC
);
49 zend_declare_class_constant_long(php_http_exception_class_entry
, ZEND_STRL("E_MALFORMED_HEADERS"), PHP_HTTP_E_MALFORMED_HEADERS TSRMLS_CC
);
50 zend_declare_class_constant_long(php_http_exception_class_entry
, ZEND_STRL("E_MESSAGE"), PHP_HTTP_E_MESSAGE TSRMLS_CC
);
51 zend_declare_class_constant_long(php_http_exception_class_entry
, ZEND_STRL("E_MESSAGE_TYPE"), PHP_HTTP_E_MESSAGE_TYPE TSRMLS_CC
);
52 zend_declare_class_constant_long(php_http_exception_class_entry
, ZEND_STRL("E_MESSAGE_BODY"), PHP_HTTP_E_MESSAGE_BODY TSRMLS_CC
);
53 zend_declare_class_constant_long(php_http_exception_class_entry
, ZEND_STRL("E_ENCODING"), PHP_HTTP_E_ENCODING TSRMLS_CC
);
54 zend_declare_class_constant_long(php_http_exception_class_entry
, ZEND_STRL("E_REQUEST"), PHP_HTTP_E_REQUEST TSRMLS_CC
);
55 zend_declare_class_constant_long(php_http_exception_class_entry
, ZEND_STRL("E_REQUEST_POOL"), PHP_HTTP_E_REQUEST_POOL TSRMLS_CC
);
56 zend_declare_class_constant_long(php_http_exception_class_entry
, ZEND_STRL("E_REQUEST_DATASHARE"), PHP_HTTP_E_REQUEST_DATASHARE TSRMLS_CC
);
57 zend_declare_class_constant_long(php_http_exception_class_entry
, ZEND_STRL("E_REQUEST_FACTORY"), PHP_HTTP_E_REQUEST_FACTORY TSRMLS_CC
);
58 zend_declare_class_constant_long(php_http_exception_class_entry
, ZEND_STRL("E_REQUEST_METHOD"), PHP_HTTP_E_REQUEST_METHOD TSRMLS_CC
);
59 zend_declare_class_constant_long(php_http_exception_class_entry
, ZEND_STRL("E_SOCKET"), PHP_HTTP_E_SOCKET TSRMLS_CC
);
60 zend_declare_class_constant_long(php_http_exception_class_entry
, ZEND_STRL("E_RESPONSE"), PHP_HTTP_E_RESPONSE TSRMLS_CC
);
61 zend_declare_class_constant_long(php_http_exception_class_entry
, ZEND_STRL("E_URL"), PHP_HTTP_E_URL TSRMLS_CC
);
62 zend_declare_class_constant_long(php_http_exception_class_entry
, ZEND_STRL("E_QUERYSTRING"), PHP_HTTP_E_QUERYSTRING TSRMLS_CC
);
63 zend_declare_class_constant_long(php_http_exception_class_entry
, ZEND_STRL("E_COOKIE"), PHP_HTTP_E_COOKIE TSRMLS_CC
);
65 #if PHP_HTTP_DBG_EXCEPTIONS
66 zend_throw_exception_hook
= php_http_exception_hook
;
77 * vim600: noet sw=4 ts=4 fdm=marker
78 * vim<600: noet sw=4 ts=4