xref: /PHP-7.4/ext/spl/spl_exceptions.c (revision 92ac598a)
1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 7                                                        |
4    +----------------------------------------------------------------------+
5    | Copyright (c) The PHP Group                                          |
6    +----------------------------------------------------------------------+
7    | This source file is subject to version 3.01 of the PHP license,      |
8    | that is bundled with this package in the file LICENSE, and is        |
9    | available through the world-wide-web at the following url:           |
10    | http://www.php.net/license/3_01.txt                                  |
11    | If you did not receive a copy of the PHP license and are unable to   |
12    | obtain it through the world-wide-web, please send a note to          |
13    | license@php.net so we can mail you a copy immediately.               |
14    +----------------------------------------------------------------------+
15    | Authors: Marcus Boerger <helly@php.net>                              |
16    +----------------------------------------------------------------------+
17  */
18 
19 #ifdef HAVE_CONFIG_H
20 # include "config.h"
21 #endif
22 
23 #include "php.h"
24 #include "php_ini.h"
25 #include "ext/standard/info.h"
26 #include "zend_interfaces.h"
27 #include "zend_exceptions.h"
28 
29 #include "php_spl.h"
30 #include "spl_functions.h"
31 #include "spl_engine.h"
32 #include "spl_exceptions.h"
33 
34 PHPAPI zend_class_entry *spl_ce_LogicException;
35 PHPAPI zend_class_entry *spl_ce_BadFunctionCallException;
36 PHPAPI zend_class_entry *spl_ce_BadMethodCallException;
37 PHPAPI zend_class_entry *spl_ce_DomainException;
38 PHPAPI zend_class_entry *spl_ce_InvalidArgumentException;
39 PHPAPI zend_class_entry *spl_ce_LengthException;
40 PHPAPI zend_class_entry *spl_ce_OutOfRangeException;
41 PHPAPI zend_class_entry *spl_ce_RuntimeException;
42 PHPAPI zend_class_entry *spl_ce_OutOfBoundsException;
43 PHPAPI zend_class_entry *spl_ce_OverflowException;
44 PHPAPI zend_class_entry *spl_ce_RangeException;
45 PHPAPI zend_class_entry *spl_ce_UnderflowException;
46 PHPAPI zend_class_entry *spl_ce_UnexpectedValueException;
47 
48 #define spl_ce_Exception zend_ce_exception
49 
50 /* {{{ PHP_MINIT_FUNCTION(spl_exceptions) */
PHP_MINIT_FUNCTION(spl_exceptions)51 PHP_MINIT_FUNCTION(spl_exceptions)
52 {
53     REGISTER_SPL_SUB_CLASS_EX(LogicException,           Exception,        NULL, NULL);
54     REGISTER_SPL_SUB_CLASS_EX(BadFunctionCallException, LogicException,   NULL, NULL);
55     REGISTER_SPL_SUB_CLASS_EX(BadMethodCallException,   BadFunctionCallException,   NULL, NULL);
56     REGISTER_SPL_SUB_CLASS_EX(DomainException,          LogicException,   NULL, NULL);
57     REGISTER_SPL_SUB_CLASS_EX(InvalidArgumentException, LogicException,   NULL, NULL);
58     REGISTER_SPL_SUB_CLASS_EX(LengthException,          LogicException,   NULL, NULL);
59     REGISTER_SPL_SUB_CLASS_EX(OutOfRangeException,      LogicException,   NULL, NULL);
60 
61     REGISTER_SPL_SUB_CLASS_EX(RuntimeException,         Exception,        NULL, NULL);
62     REGISTER_SPL_SUB_CLASS_EX(OutOfBoundsException,     RuntimeException, NULL, NULL);
63     REGISTER_SPL_SUB_CLASS_EX(OverflowException,        RuntimeException, NULL, NULL);
64     REGISTER_SPL_SUB_CLASS_EX(RangeException,           RuntimeException, NULL, NULL);
65     REGISTER_SPL_SUB_CLASS_EX(UnderflowException,       RuntimeException, NULL, NULL);
66     REGISTER_SPL_SUB_CLASS_EX(UnexpectedValueException, RuntimeException, NULL, NULL);
67 
68 	return SUCCESS;
69 }
70 /* }}} */
71