-
Notifications
You must be signed in to change notification settings - Fork 0
/
global_strict.c
77 lines (63 loc) · 1.57 KB
/
global_strict.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "php.h"
#include "ext/standard/info.h"
#include "php_global_strict.h"
ZEND_API zend_op_array *(*original_compile_file)(zend_file_handle *file_handle, int type);
ZEND_API zend_op_array *global_strict_compile_file(zend_file_handle *file_handle, int type)
{
zend_op_array *op_array = original_compile_file(file_handle, type);
if ((op_array->fn_flags & ZEND_ACC_STRICT_TYPES) == 0) {
op_array->fn_flags |= ZEND_ACC_STRICT_TYPES;
}
return op_array;
}
PHP_MINIT_FUNCTION(global_strict)
{
original_compile_file = zend_compile_file;
zend_compile_file = global_strict_compile_file;
return SUCCESS;
}
PHP_MSHUTDOWN_FUNCTION(global_strict)
{
zend_compile_file = original_compile_file;
return SUCCESS;
}
/* {{{ PHP_RINIT_FUNCTION */
PHP_RINIT_FUNCTION(global_strict)
{
#if defined(ZTS) && defined(COMPILE_DL_GLOBAL_STRICT)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MINFO_FUNCTION */
PHP_MINFO_FUNCTION(global_strict)
{
php_info_print_table_start();
php_info_print_table_row(2, "global_strict support", "enabled");
php_info_print_table_end();
}
/* }}} */
/* {{{ global_strict_module_entry */
zend_module_entry global_strict_module_entry = {
STANDARD_MODULE_HEADER,
"global_strict",
NULL,
PHP_MINIT(global_strict),
PHP_MSHUTDOWN(global_strict),
PHP_RINIT(global_strict),
NULL,
PHP_MINFO(global_strict),
PHP_GLOBAL_STRICT_VERSION,
STANDARD_MODULE_PROPERTIES
};
/* }}} */
#ifdef COMPILE_DL_GLOBAL_STRICT
# ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE()
# endif
ZEND_GET_MODULE(global_strict)
#endif