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