From 4b9138909ae5fffd089bbc7f73e47ce2fed3768c Mon Sep 17 00:00:00 2001 From: NeoXiD Date: Sun, 10 Feb 2013 02:09:38 +0100 Subject: [PATCH] Added flag --disable-DeepTrace-notices for disabling notices/warnings about modifying internal stuff --- DeepTrace_constants.c | 2 ++ DeepTrace_methods.c | 6 ++++++ config.m4 | 18 +++++++++++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/DeepTrace_constants.c b/DeepTrace_constants.c index a8b6eb3..e3d4fae 100644 --- a/DeepTrace_constants.c +++ b/DeepTrace_constants.c @@ -57,8 +57,10 @@ PHP_FUNCTION(dt_remove_constant) /* Output safety warning for persistent constants */ if(constant->flags & CONST_PERSISTENT) { +#ifdef DEEPTRACE_NOTICES php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Constant '%s' is persistent. You can, but you should not touch it.", constantName); +#endif } /* Get constant name and hash */ diff --git a/DeepTrace_methods.c b/DeepTrace_methods.c index 320149e..4dab058 100644 --- a/DeepTrace_methods.c +++ b/DeepTrace_methods.c @@ -116,7 +116,9 @@ static int DeepTrace_fetch_class(char *className, int className_len, zend_class_ /* Warning if user tries to modify a internal class */ if(ce->type != ZEND_USER_CLASS) { +#ifdef DEEPTRACE_NOTICES php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Class '%s' is not a user-defined class.", className); +#endif } /* Check if it is a interface */ @@ -144,7 +146,9 @@ static int DeepTrace_fetch_class_method(char *className, int className_len, char /* Warning if user tries to modify a internal class */ if(ce->type != ZEND_USER_CLASS) { +#ifdef DEEPTRACE_NOTICES php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Class '%s' is not a user-defined class.", className); +#endif } if(pce) *pce = ce; @@ -158,8 +162,10 @@ static int DeepTrace_fetch_class_method(char *className, int className_len, char /* Warning if user tries to modify a internal method */ if(fe->type != ZEND_USER_FUNCTION) { +#ifdef DEEPTRACE_NOTICES php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Method '%s::%s()' is not a user-defined method.", className, methodName); +#endif } if(pfe) *pfe = fe; diff --git a/config.m4 b/config.m4 index 58b6b57..38e1b0a 100644 --- a/config.m4 +++ b/config.m4 @@ -4,10 +4,26 @@ dnl config.m4 for DeepTrace extension PHP_ARG_ENABLE(DeepTrace, whether to enable DeepTrace support, [ --enable-DeepTrace Enable DeepTrace support], no, yes) +PHP_ARG_ENABLE(DeepTrace-notices, whether to show DeepTrace notices, +[ --disable-DeepTrace-notices Show DeepTrace notices], inherit, no) + PHP_ARG_ENABLE(DeepTrace-legacy-proctitle, whether to force the legacy proctitle call, -[ --enable-DeepTrace-legacy-proctitle Force legacy proctitle call], no, no) +[ --enable-DeepTrace-legacy-proctitle Force legacy proctitle call], inherit, no) if test "$PHP_DEEPTRACE" != "no"; then + if test "$PHP_DEEPTRACE_NOTICES" == "yes"; then + PHP_DEEPTRACE_NOTICES=yes + fi + if test "$PHP_DEEPTRACE_LEGACY_PROCTITLE" == "inherit"; then + PHP_DEEPTRACE_LEGACY_PROCTITLE=no + fi +fi + +if test "$PHP_DEEPTRACE" != "no"; then + if test "$PHP_DEEPTRACE_NOTICES" != "no"; then + AC_DEFINE(DEEPTRACE_NOTICES, 1, [Whether to show notices]) + fi + if test "$PHP_DEEPTRACE_LEGACY_PROCTITLE" == "no"; then AC_CACHE_VAL(_cv_dt_system_has_setproctitle, [ AC_CHECK_FUNCS(setproctitle, [