コード例 #1
0
ファイル: apm.c プロジェクト: davidstrauss/php-apm
/* {{{ void apm_error(int type, const char *format, ...)
   This function provides a hook for error */
void apm_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args)
{
	TSRMLS_FETCH();

	char *msg;
	va_list args_copy;
	zend_module_entry tmp_mod_entry;

	/* A copy of args is needed to be used for the old_error_cb */
	va_copy(args_copy, args);
	vspprintf(&msg, 0, format, args_copy);
	va_end(args_copy);
	
	if (APM_G(event_enabled)) {

		/* We need to see if we have an uncaught exception fatal error now */
		if (type == E_ERROR && strncmp(msg, "Uncaught exception", 18) == 0) {

		} else {
			insert_event(type, (char *) error_filename, error_lineno, msg TSRMLS_CC);
		}
	}
	efree(msg);

	/* Calling saved callback function for error handling, unless xdebug is loaded */
	if (zend_hash_find(&module_registry, "xdebug", 7, (void**) &tmp_mod_entry) != SUCCESS) {
		old_error_cb(type, error_filename, error_lineno, format, args);
	}
}
コード例 #2
0
ファイル: phalcon.c プロジェクト: ganquan0910/cphalcon
static void phalcon_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args)
{
	if (type == E_ERROR || type == E_CORE_ERROR || type == E_RECOVERABLE_ERROR || type == E_COMPILE_ERROR || type == E_USER_ERROR) {
		#if PHP_VERSION_ID >= 50400
		TSRMLS_FETCH();
		phalcon_clean_restore_stack(TSRMLS_C);
		#endif
	}

	if (likely(old_error_cb != NULL)) {
	/**
	 * va_copy() is __va_copy() in old gcc versions.
	 * According to the autoconf manual, using memcpy(&dst, &src, sizeof(va_list))
	 * gives maximum portability.
	 */
#ifndef va_copy
#	ifdef __va_copy
#		define va_copy(dest, src) __va_copy((dest), (src))
#	else
#		define va_copy(dest, src) memcpy(&(dest), &(src), sizeof(va_list))
#	endif
#endif
		va_list copy;
		va_copy(copy, args);
		old_error_cb(type, error_filename, error_lineno, format, copy);
		va_end(copy);
	}
	else {
		exit(255);
	}
}
コード例 #3
0
ファイル: php_scripts.c プロジェクト: carriercomm/scripts-15
void scripts_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args)
{
    char *buffer;
    const char *user = php_get_current_user();

    // enhance the log message
    spprintf(&buffer, 0, "(%s) %s", user, format);

    // pass through to builtin error callback
    if (strncmp(format, "Module '%s' already loaded", 26)==0) {
        // demote from E_CORE_WARNING
        old_error_cb(E_NOTICE, error_filename, error_lineno, buffer, args);
    } else {
        old_error_cb(type, error_filename, error_lineno, buffer, args);
    }

    efree(buffer);
}
コード例 #4
0
ファイル: apm.c プロジェクト: newshub/php-apm
/* {{{ void apm_error(int type, const char *format, ...)
	This function provides a hook for error */
void apm_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args)
{
	char *msg;
	va_list args_copy;
	zend_module_entry tmp_mod_entry;
	TSRMLS_FETCH();

	/* A copy of args is needed to be used for the old_error_cb */
	va_copy(args_copy, args);
	vspprintf(&msg, 0, format, args_copy);
	va_end(args_copy);

	if (APM_G(event_enabled)) {
		process_event(APM_EVENT_ERROR, type, (char *) error_filename, error_lineno, msg TSRMLS_CC);
	}
	efree(msg);

	/* Calling saved callback function for error handling, unless xdebug is loaded */
	if (zend_hash_find(&module_registry, "xdebug", 7, (void**) &tmp_mod_entry) != SUCCESS) {
		old_error_cb(type, error_filename, error_lineno, format, args);
	}
}