Fixed bug #26707 (Incorrect error for disabled functions/classes).

This commit is contained in:
Ilia Alshanetsky 2003-12-24 16:38:22 +00:00
parent f95db00d6c
commit be5670af2b
3 changed files with 20 additions and 13 deletions

View File

@ -131,23 +131,21 @@ static PHP_INI_MH(OnChangeMemoryLimit)
*/
static void php_disable_functions(TSRMLS_D)
{
char *s = NULL;
char *e = INI_STR("disable_functions");
char p;
char *s = NULL, *e;
if (!*e) {
if (!*(INI_STR("disable_functions"))) {
return;
}
e = PG(disable_functions) = strdup(INI_STR("disable_functions"));
while (*e) {
switch (*e) {
case ' ':
case ',':
if (s) {
p = *e;
*e = '\0';
zend_disable_function(s, e-s TSRMLS_CC);
*e = p;
s = NULL;
}
break;
@ -169,23 +167,21 @@ static void php_disable_functions(TSRMLS_D)
*/
static void php_disable_classes(TSRMLS_D)
{
char *s = NULL;
char *e = INI_STR("disable_classes");
char p;
char *s = NULL, *e;
if (!*e) {
if (!*(INI_STR("disable_classes"))) {
return;
}
e = PG(disable_classes) = strdup(INI_STR("disable_classes"));
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;
@ -1384,6 +1380,8 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
PG(last_error_file) = NULL;
PG(last_error_lineno) = 0;
PG(error_handling) = EH_NORMAL;
PG(disable_functions) = NULL;
PG(disable_classes) = NULL;
#if HAVE_SETLOCALE
setlocale(LC_CTYPE, "");
@ -1552,6 +1550,12 @@ void php_module_shutdown(TSRMLS_D)
if (PG(last_error_file)) {
free(PG(last_error_file));
}
if (PG(disable_functions)) {
free(PG(disable_functions));
}
if (PG(disable_classes)) {
free(PG(disable_classes));
}
}
/* }}} */

View File

@ -26,7 +26,7 @@
#include <dmalloc.h>
#endif
#define PHP_API_VERSION 20031103
#define PHP_API_VERSION 20031224
#define PHP_HAVE_STREAMS
#define YYDEBUG 0

View File

@ -147,6 +147,9 @@ struct _php_core_globals {
int last_error_lineno;
error_handling_t error_handling;
zend_class_entry *exception_class;
char *disable_functions;
char *disable_classes;
};