Skip to content

Commit

Permalink
Added flag --disable-DeepTrace-notices for disabling notices/warnings…
Browse files Browse the repository at this point in the history
… about modifying internal stuff
  • Loading branch information
snapserv-bot committed Feb 10, 2013
1 parent 9d74ca0 commit 4b91389
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 2 additions & 0 deletions DeepTrace_constants.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
6 changes: 6 additions & 0 deletions DeepTrace_methods.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;

Expand All @@ -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;

Expand Down
18 changes: 17 additions & 1 deletion config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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, [
Expand Down

0 comments on commit 4b91389

Please sign in to comment.