summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarald Radi <phanto@php.net>2003-03-03 01:27:22 +0000
committerHarald Radi <phanto@php.net>2003-03-03 01:27:22 +0000
commit3e52882d3bc79fe46574d54a76de9260e498e788 (patch)
treed9a45eca69f7bd03c63d4b6cf5327e5deb89b007
parenta700180f5d9e9c7467caefb351118e402ed8832e (diff)
downloadphp-git-3e52882d3bc79fe46574d54a76de9260e498e788.tar.gz
adding disable_classes ini directive based on the
newly introduced zend_disable_class function
-rw-r--r--main/main.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/main/main.c b/main/main.c
index 277eba516d..915a028c35 100644
--- a/main/main.c
+++ b/main/main.c
@@ -183,6 +183,44 @@ static void php_disable_functions(TSRMLS_D)
}
/* }}} */
+/* {{{ php_disable_classes
+ */
+static void php_disable_classes(TSRMLS_D)
+{
+ char *s = NULL;
+ char *e = INI_STR("disable_classes");
+ char p;
+
+ if (!*e) {
+ return;
+ }
+
+ while (*e) {
+ switch (*e) {
+ case ' ':
+ case ',':
+ if (s) {
+ p = *e;
+ *e = '\0';
+ zend_disable_class(s, e-s TSRMLS_CC);
+ *e = p;
+ s = NULL;
+ }
+ break;
+ default:
+ if (!s) {
+ s = e;
+ }
+ break;
+ }
+ e++;
+ }
+ if (s) {
+ zend_disable_class(s, e-s TSRMLS_CC);
+ }
+}
+/* }}} */
+
/* {{{ PHP_INI_MH
*/
static PHP_INI_MH(OnUpdateTimeout)
@@ -308,6 +346,7 @@ PHP_INI_BEGIN()
PHP_INI_ENTRY("sendmail_path", DEFAULT_SENDMAIL_PATH, PHP_INI_SYSTEM, NULL)
PHP_INI_ENTRY("mail_force_extra_parameters",NULL, PHP_INI_SYSTEM, NULL)
PHP_INI_ENTRY("disable_functions", "", PHP_INI_SYSTEM, NULL)
+ PHP_INI_ENTRY("disable_classes", "", PHP_INI_SYSTEM, NULL)
STD_PHP_INI_BOOLEAN("allow_url_fopen", "1", PHP_INI_ALL, OnUpdateBool, allow_url_fopen, php_core_globals, core_globals)
STD_PHP_INI_BOOLEAN("always_populate_raw_post_data", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, always_populate_raw_post_data, php_core_globals, core_globals)
@@ -1301,8 +1340,9 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
*/
php_ini_delayed_modules_startup(TSRMLS_C);
- /* disable certain functions as requested by php.ini */
+ /* disable certain classes and functions as requested by php.ini */
php_disable_functions(TSRMLS_C);
+ php_disable_classes(TSRMLS_C);
/* start Zend extensions */
zend_startup_extensions();