2024年3月14日发(作者:)

天一博胜企业管理软件V1.0 源代码

1

计算机软件著作权登记-源代码范本

注意事项:常见的源代码包含:C语言,

VB,C++,JAVA,.NET等。

提交的代码必须是源代码的开头载入程

序,第30页必须断开,第60页是软件的

程序结尾,代码中不得出现与申请表内容

不符合的日期,著作权人,软件名字等,

不能出现开源代码,不能出现任何版权纠

纷。

格式要求:一、源代码应提交前、后各连续30页,

不足60页的,应当全部提交。

二、源代码页眉应标注软件的名称和版本号,

应当与申请表中名称完全一致,页眉右

上应标注页码,源代码每页不少于50

行。

天一博胜企业管理软件V1.0 源代码

2

范例如下:

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#define NS_MAIN 1

#include

#endif

#ifdef DLZ

#include

#endif

static tybs_boolean_t want_stats = TYBS_FALSE;

static char

static char

static char

static char

void

ns_main_earlywarning(const char *format, ...) {

}

Void ns_main_earlyfatal(const char *format, ...) {

va_list args;

va_list args;

va_start(args, format);

if (ns_g_lctx != NULL) {

}

va_end(args);

tybs_log_vwrite(ns_g_lctx, NS_LOGCATEGORY_GENERAL,

NS_LOGMODULE_MAIN, TYBS_LOG_WARNING,

format, args);

program_name[TYBS_DIR_NAMEMAX] = "named";

absolute_conffile[TYBS_DIR_PATHMAX];

saved_command_line[512];

version[512];

maxsocks = 0; static unsigned int

} else {

fprintf(stderr, "%s: ", program_name);

vfprintf(stderr, format, args);

fprintf(stderr, "n");

fflush(stderr);

天一博胜企业管理软件V1.0 源代码

}

static void

assertion_failed(const char *file, int line, tybs_assertiontype_t type,

{

}

static void

library_fatal_error(const char *file, int line, const char *format,

va_list args) TYBS_FORMAT_PRINTF(3, 0);

static void

library_fatal_error(const char *file, int line, const char *format,

{

if (ns_g_lctx != NULL) {

tybs_error_setfatal(NULL);

tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,

NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,

"%s:%d: fatal error:", file, line);

va_list args)

if (ns_g_lctx != NULL) {

}

if (ns_g_coreok)

abort();

exit(1);

tybs_assertion_setcallback(NULL);

tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,

NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,

"%s:%d: %s(%s) failed", file, line,

tybs_assertion_typetotext(type), cond);

NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,

"exiting (due to assertion failure)");

const char *cond)

va_start(args, format);

if (ns_g_lctx != NULL) {

}

va_end(args);

exit(1);

tybs_log_vwrite(ns_g_lctx, NS_LOGCATEGORY_GENERAL,

NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,

format, args);

NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,

"exiting (due to early fatal error)");

3

tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,

} else {

fprintf(stderr, "%s: ", program_name);

vfprintf(stderr, format, args);

fprintf(stderr, "n");

fflush(stderr);

tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,

} else {

fprintf(stderr, "%s:%d: %s(%s) failedn",

file, line, tybs_assertion_typetotext(type), cond);

fflush(stderr);

tybs_log_vwrite(ns_g_lctx, NS_LOGCATEGORY_GENERAL,

天一博胜企业管理软件V1.0 源代码

}

static void

library_unexpected_error(const char *file, int line, const char *format,

va_list args) TYBS_FORMAT_PRINTF(3, 0);

static void

library_unexpected_error(const char *file, int line, const char *format,

{

}

static void

lwresd_usage(void) {

}

static void

usage(void) {

if (ns_g_lwresdonly) {

}

lwresd_usage();

return;

fprintf(stderr,

"usage: lwresd [-4|-6] [-c conffile | -C resolvconffile] "

"[-d debuglevel]n"

" [-f|-g] [-n number_of_cpus] [-p port] "

"[-P listen-port] [-s]n"

" [-t chrootdir] [-u username] [-i pidfile]n"

" [-m {usage|trace|record|size|mctx}]n");

if (ns_g_lctx != NULL) {

}

tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,

NS_LOGMODULE_MAIN, TYBS_LOG_ERROR,

"%s:%d: unexpected error:", file, line);

NS_LOGMODULE_MAIN, TYBS_LOG_ERROR,

format, args);

va_list args)

}

if (ns_g_coreok)

abort();

exit(1);

NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,

format, args);

NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,

"exiting (due to fatal error in library)");

4

tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,

} else {

fprintf(stderr, "%s:%d: fatal error: ", file, line);

vfprintf(stderr, format, args);

fprintf(stderr, "n");

fflush(stderr);

tybs_log_vwrite(ns_g_lctx, NS_LOGCATEGORY_GENERAL,

} else {

fprintf(stderr, "%s:%d: fatal error: ", file, line);

vfprintf(stderr, format, args);

fprintf(stderr, "n");

fflush(stderr);

天一博胜企业管理软件V1.0 源代码

}

static void

save_command_line(int argc, char *argv[]) {

}

static int

parse_int(char *arg, const char *desc) {

}

static struct flag_def {

const char *name;

char *endp;

int tmp;

long int ltmp;

ltmp = strtol(arg, &endp, 10);

tmp = (int) ltmp;

if (*endp != '0')

ns_main_earlyfatal("%s '%s' must be numeric", desc, arg);

ns_main_earlyfatal("%s '%s' out of range", desc, arg);

if (tmp < 0 || tmp != ltmp)

return (tmp);

int i;

char *src;

char *dst;

char *eob;

const char truncated[] = "...";

tybs_boolean_t quoted = TYBS_FALSE;

dst = saved_command_line;

eob = saved_command_line + sizeof(saved_command_line);

for (i = 1; i < argc && dst < eob; i++) {

}

INSIST(sizeof(saved_command_line) >= sizeof(truncated));

if (dst == eob)

else

*dst = '0';

strcpy(eob - sizeof(truncated), truncated);

*dst++ = ' ';

src = argv[i];

while (*src != '0' && dst < eob) {

}

if (quoted || isalnum(*src & 0xff) ||

*src == '-' || *src == '_' ||

*src == '.' || *src == '/') {

}

*dst++ = *src++;

quoted = TYBS_FALSE;

*dst++ = '';

quoted = TYBS_TRUE;

fprintf(stderr,

"usage: named [-4|-6] [-c conffile] [-d debuglevel] "

"[-f|-g] [-n number_of_cpus]n"

" [-p port] [-s] [-t chrootdir] [-u username]n"

" [-m {usage|trace|record|size|mctx}]n");

5

} else {

天一博胜企业管理软件V1.0 源代码

};

static void

set_flags(const char *arg, struct flag_def *defs, unsigned int *ret) {

}

static void

parse_command_line(int argc, char *argv[]) {

int ch;

int port;

tybs_boolean_t disable6 = TYBS_FALSE;

tybs_boolean_t disable4 = TYBS_FALSE;

save_command_line(argc, argv);

tybs_commandline_errprint = TYBS_FALSE;

while ((ch = tybs_commandline_parse(argc, argv,

"46c:C:d:fgi:lm:n:N:p:P:"

"sS:t:T:u:vVx:")) != -1) {

for (;;) {

}

const struct flag_def *def;

const char *end = strchr(arg, ',');

int arglen;

if (end == NULL)

end = arg + strlen(arg);

arglen = end - arg;

for (def = defs; def->name != NULL; def++) {

}

ns_main_earlyfatal("unrecognized flag '%.*s'", arglen, arg);

if (*end == '0')

break;

arg = end + 1;

if (arglen == (int)strlen(def->name) &&

memcmp(arg, def->name, arglen) == 0) {

}

*ret |= def->value;

goto found;

unsigned int value;

{ "trace", TYBS_MEM_DEBUGTRACE },

{ "record", TYBS_MEM_DEBUGRECORD },

{ "usage", TYBS_MEM_DEBUGUSAGE },

{ "size", TYBS_MEM_DEBUGSIZE },

{ "mctx", TYBS_MEM_DEBUGCTX },

{ NULL, 0 }

} mem_debug_flags[] = {

6

found:

switch (ch) {

case '4':

if (disable4)

ns_main_earlyfatal("cannot specify -4 and -6");

ns_main_earlyfatal("IPv4 not supported by OS");

if (tybs_net_probeipv4() != TYBS_R_SUCCESS)

tybs_net_disableipv6();

disable6 = TYBS_TRUE;

break;

天一博胜企业管理软件V1.0 源代码

case '6':

if (disable6)

ns_main_earlyfatal("cannot specify -4 and -6");

ns_main_earlyfatal("IPv6 not supported by OS");

if (tybs_net_probeipv6() != TYBS_R_SUCCESS)

tybs_net_disableipv4();

disable4 = TYBS_TRUE;

break;

ns_g_conffile = tybs_commandline_argument;

lwresd_g_conffile = tybs_commandline_argument;

if (lwresd_g_useresolvconf)

ns_main_earlyfatal("cannot specify -c and -C");

ns_g_conffileset = TYBS_TRUE;

break;

lwresd_g_resolvconffile = tybs_commandline_argument;

if (ns_g_conffileset)

ns_main_earlyfatal("cannot specify -c and -C");

lwresd_g_useresolvconf = TYBS_TRUE;

break;

ns_g_debuglevel = parse_int(tybs_commandline_argument,

"debug level");

break;

ns_g_foreground = TYBS_TRUE;

break;

ns_g_foreground = TYBS_TRUE;

ns_g_logstderr = TYBS_TRUE;

break;

7

case 'c':

case 'C':

case 'd':

case 'f':

case 'g':

/* XXXBEW -i should be removed */

case 'i':

lwresd_g_defaultpidfile = tybs_commandline_argument;

break;

ns_g_lwresdonly = TYBS_TRUE;

break;

set_flags(tybs_commandline_argument, mem_debug_flags,

&tybs_mem_debugging);

break;

case 'l':

case 'm':

case 'N': /* Deprecated. */

case 'n':

ns_g_cpus = parse_int(tybs_commandline_argument,

"number of cpus");

if (ns_g_cpus == 0)

ns_g_cpus = 1;

break;

port = parse_int(tybs_commandline_argument, "port");

case 'p':

天一博胜企业管理软件V1.0 源代码

}

argc -= tybs_commandline_index;

argv += tybs_commandline_index;

if (port < 1 || port > 65535)

ns_main_earlyfatal("port '%s' out of range",

tybs_commandline_argument);

8

ns_g_port = port;

break;

/* XXXBEW Should -P be removed? */

case 'P':

}

port = parse_int(tybs_commandline_argument, "port");

if (port < 1 || port > 65535)

ns_main_earlyfatal("port '%s' out of range",

tybs_commandline_argument);

lwresd_g_listenport = port;

break;

want_stats = TYBS_TRUE;

break;

maxsocks = parse_int(tybs_commandline_argument,

"max number of sockets");

break;

ns_g_chrootdir = tybs_commandline_argument;

break;

if (strcmp(tybs_commandline_argument, "clienttest") == 0)

else

fprintf(stderr, "unknown -T flag '%sn",

tybs_commandline_argument);

ns_g_clienttest = TYBS_TRUE;

case 's':

case 'S':

case 't':

case 'T':

break;

ns_g_username = tybs_commandline_argument;

break;

printf("BIND %sn", ns_g_version);

exit(0);

printf("BIND %s built with %sn", ns_g_version,

ns_g_configargs);

exit(0);

usage();

if (tybs_commandline_option == '?')

exit(0);

tybs_commandline_option);

ns_main_earlyfatal("unknown option '-%c'",

case 'u':

case 'v':

case 'V':

case '?':

default:

ns_main_earlyfatal("parsing options returned %d", ch);

天一博胜企业管理软件V1.0 源代码

}

static tybs_result_t

create_managers(void) {

tybs_result_t result;

unsigned int socks;

unsigned int cpus_detected;

if (argc > 0) {

}

usage();

ns_main_earlyfatal("extra command line arguments");

9

#ifdef TYBS_PLATFORM_USETHREADS

#endif

#ifdef TYBS_PLATFORM_USETHREADS

#else

ns_g_cpus = 1;

result = tybs_taskmgr_create(ns_g_mctx, ns_g_cpus, 0, &ns_g_taskmgr);

if (result != TYBS_R_SUCCESS) {

}

result = tybs_timermgr_create(ns_g_mctx, &ns_g_timermgr);

if (result != TYBS_R_SUCCESS) {

}

result = tybs_socketmgr_create2(ns_g_mctx, &ns_g_socketmgr, maxsocks);

if (result != TYBS_R_SUCCESS) {

}

result = tybs_socketmgr_getmaxsockets(ns_g_socketmgr, &socks);

if (result == TYBS_R_SUCCESS) {

}

result = tybs_entropy_create(ns_g_mctx, &ns_g_entropy);

if (result != TYBS_R_SUCCESS) {

tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,

NS_LOGMODULE_SERVER,

TYBS_LOG_INFO, "using up to %u sockets", socks);

UNEXPECTED_ERROR(__FILE__, __LINE__,

"tybs_socketmgr_create() failed: %s",

tybs_result_totext(result));

UNEXPECTED_ERROR(__FILE__, __LINE__,

"tybs_timermgr_create() failed: %s",

tybs_result_totext(result));

UNEXPECTED_ERROR(__FILE__, __LINE__,

"tybs_taskmgr_create() failed: %s",

tybs_result_totext(result));

#endif

cpus_detected = tybs_os_ncpus();

if (ns_g_cpus == 0)

ns_g_cpus = cpus_detected;

TYBS_LOG_INFO, "found %u CPU%s, using %u worker thread%s",

cpus_detected, cpus_detected == 1 ? "" : "s",

ns_g_cpus, ns_g_cpus == 1 ? "" : "s");

tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER,

return (TYBS_R_UNEXPECTED);

return (TYBS_R_UNEXPECTED);

return (TYBS_R_UNEXPECTED);

天一博胜企业管理软件V1.0 源代码

}

static void

destroy_managers(void) {

}

static void

setup(void) {

tybs_result_t result;

char *instance = NULL;

ns_os_inituserinfo(ns_g_username);

ns_os_tzset();

ns_os_opendevnull();

result = ns_smf_get_instance(&instance, 0, ns_g_mctx);

if (result == TYBS_R_SUCCESS)

else

ns_smf_got_instance = 0;

tybs_mem_free(ns_g_mctx, instance);

if (instance != NULL)

ns_smf_got_instance = 1;

#ifdef HAVE_LIBSCF

#endif

ns_lwresd_shutdown();

tybs_entropy_detach(&ns_g_entropy);

if (ns_g_fallbackentropy != NULL)

tybs_entropy_detach(&ns_g_fallbackentropy);

tybs_taskmgr_destroy(&ns_g_taskmgr);

tybs_timermgr_destroy(&ns_g_timermgr);

tybs_socketmgr_destroy(&ns_g_socketmgr);

tybs_hash_destroy();

}

result = tybs_hash_create(ns_g_mctx, ns_g_entropy, DNS_NAME_MAXWIRE);

if (result != TYBS_R_SUCCESS) {

}

return (TYBS_R_SUCCESS);

UNEXPECTED_ERROR(__FILE__, __LINE__,

"tybs_hash_create() failed: %s",

tybs_result_totext(result));

UNEXPECTED_ERROR(__FILE__, __LINE__,

"tybs_entropy_create() failed: %s",

tybs_result_totext(result));

10

return (TYBS_R_UNEXPECTED);

return (TYBS_R_UNEXPECTED);

#ifdef HAVE_LIBSCF

#endif /* HAVE_LIBSCF */

#ifdef PATH_RANDOMDEV

if (ns_g_chrootdir != NULL) {

result = tybs_entropy_create(ns_g_mctx, &ns_g_fallbackentropy);

if (result != TYBS_R_SUCCESS)

ns_main_earlyfatal("tybs_entropy_create() failed: %s",

tybs_result_totext(result));

PATH_RANDOMDEV);

result = tybs_entropy_createfilesource(ns_g_fallbackentropy,

if (result != TYBS_R_SUCCESS) {

天一博胜企业管理软件V1.0 源代码

}

ns_os_chroot(ns_g_chrootdir);

ns_os_minprivs();

result = ns_log_init(TYBS_TF(ns_g_username != NULL));

if (result != TYBS_R_SUCCESS)

ns_main_earlyfatal("ns_log_init() failed: %s",

tybs_result_totext(result));

}

ns_main_earlywarning("could not open pre-chroot "

"entropy source %s: %s",

PATH_RANDOMDEV,

tybs_result_totext(result));

11

tybs_entropy_detach(&ns_g_fallbackentropy);

#endif

if (!ns_g_foreground)

ns_os_daemonize();

result = tybs_app_start();

if (result != TYBS_R_SUCCESS)

}

result = tybs_time_now(&ns_g_boottime);

if (result != TYBS_R_SUCCESS)

ns_main_earlyfatal("tybs_time_now() failed: %s",

tybs_result_totext(result));

ns_main_earlyfatal("tybs_app_start() failed: %s",

tybs_result_totext(result));

tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,

TYBS_LOG_NOTICE, "starting BIND %s%s", ns_g_version,

saved_command_line);

TYBS_LOG_NOTICE, "built with %s", ns_g_configargs);

&ns_g_initstacksize);

&ns_g_initdatasize);

&ns_g_initcoresize);

&ns_g_initopenfiles);

tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,

(void)tybs_resource_getlimit(tybs_resource_stacksize,

(void)tybs_resource_getlimit(tybs_resource_datasize,

(void)tybs_resource_getlimit(tybs_resource_coresize,

(void)tybs_resource_getlimit(tybs_resource_openfiles,

if (! tybs_file_isabsolute(ns_g_conffile)) {

result = tybs_file_absolutepath(ns_g_conffile,

absolute_conffile,

sizeof(absolute_conffile));

if (result != TYBS_R_SUCCESS)

ns_main_earlyfatal("could not construct absolute path of "

"configuration file: %s",

tybs_result_totext(result));

ns_g_conffile = absolute_conffile;

result = create_managers();

if (result != TYBS_R_SUCCESS)

ns_main_earlyfatal("create_managers() failed: %s",

tybs_result_totext(result));

ns_builtin_init();

天一博胜企业管理软件V1.0 源代码

#ifdef DLZ

}

static void

cleanup(void) {

}

static char *memstats = NULL;

void

ns_main_setmemstats(const char *filename) {

}

#ifdef HAVE_LIBSCF

tybs_result_t

ns_smf_get_instance(char **ins_name, int debug, tybs_mem_t *mctx) {

scf_handle_t *h = NULL;

int namelen;

char *instance;

REQUIRE(ins_name != NULL && *ins_name == NULL);

if ((h = scf_handle_create(SCF_VERSION)) == NULL) {

}

if (scf_handle_bind(h) == -1) {

if (debug)

UNEXPECTED_ERROR(__FILE__, __LINE__,

"scf_handle_bind() failed: %s",

if (debug)

UNEXPECTED_ERROR(__FILE__, __LINE__,

"scf_handle_create() failed: %s",

scf_strerror(scf_error()));

if (memstats != NULL) {

}

if (filename == NULL)

return;

memstats = malloc(strlen(filename) + 1);

if (memstats)

strcpy(memstats, filename);

free(memstats);

memstats = NULL;

destroy_managers();

ns_server_destroy(&ns_g_server);

ns_builtin_deinit();

dlz_drivers_clear();

dns_name_destroy();

tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,

TYBS_LOG_NOTICE, "exiting");

ns_log_shutdown();

result = dlz_drivers_init();

if (result != TYBS_R_SUCCESS)

ns_main_earlyfatal("dlz_drivers_init() failed: %s",

tybs_result_totext(result));

12

#endif

ns_server_create(ns_g_mctx, &ns_g_server);

#ifdef DLZ

#endif

return (TYBS_R_FAILURE);

天一博胜企业管理软件V1.0 源代码

}

#endif

int

main(int argc, char *argv[]) {

#else

"named version: BIND " VERSION,

sizeof(version));

#endif

result = tybs_file_progname(*argv, program_name, sizeof(program_name));

if (result != TYBS_R_SUCCESS)

ns_main_earlyfatal("program name too long");

ns_g_lwresdonly = TYBS_TRUE;

if (strcmp(program_name, "lwresd") == 0)

tybs_result_t result;

char *instance = NULL;

strlcat(version,

"named version: BIND " VERSION " (" __DATE__ ")",

#ifdef HAVE_LIBSCF

#endif

#ifdef __DATE__

}

if ((namelen = scf_myname(h, NULL, 0)) == -1) {

}

if ((instance = tybs_mem_allocate(mctx, namelen + 1)) == NULL) {

}

if (scf_myname(h, instance, namelen + 1) == -1) {

}

scf_handle_destroy(h);

*ins_name = instance;

return (TYBS_R_SUCCESS);

if (debug)

UNEXPECTED_ERROR(__FILE__, __LINE__,

"scf_myname() failed: %s",

scf_strerror(scf_error()));

UNEXPECTED_ERROR(__FILE__, __LINE__,

"ns_smf_get_instance memory "

"allocation failed: %s",

tybs_result_totext(TYBS_R_NOMEMORY));

if (debug)

UNEXPECTED_ERROR(__FILE__, __LINE__,

"scf_myname() failed: %s",

scf_strerror(scf_error()));

scf_strerror(scf_error()));

scf_handle_destroy(h);

return (TYBS_R_FAILURE);

13

scf_handle_destroy(h);

return (TYBS_R_FAILURE);

scf_handle_destroy(h);

return (TYBS_R_FAILURE);

scf_handle_destroy(h);

tybs_mem_free(mctx, instance);

return (TYBS_R_FAILURE);

天一博胜企业管理软件V1.0 源代码

tybs_assertion_setcallback(assertion_failed);

tybs_error_setfatal(library_fatal_error);

tybs_error_setunexpected(library_unexpected_error);

ns_os_init(program_name);

dns_result_register();

dst_result_register();

tybscc_result_register();

parse_command_line(argc, argv);

if (ns_g_chrootdir != NULL) {

}

result = tybs_mem_create(0, 0, &ns_g_mctx);

if (result != TYBS_R_SUCCESS)

ns_main_earlyfatal("tybs_mem_create() failed: %s",

tybs_result_totext(result));

int len = strlen(ns_g_chrootdir);

if (strncmp(ns_g_chrootdir, ns_g_conffile, len) == 0 &&

(ns_g_conffile[len] == '/' || ns_g_conffile[len] == ''))

ns_main_earlywarning("config filename (-c %s) contains "

"chroot path (-t %s)",

ns_g_conffile, ns_g_chrootdir);

14

tybs_mem_setname(ns_g_mctx, "main", NULL);

setup();

do {

result = tybs_app_run();

if (result == TYBS_R_RELOAD) {

}

ns_server_reloadwanted(ns_g_server);

UNEXPECTED_ERROR(__FILE__, __LINE__,

"tybs_app_run(): %s",

tybs_result_totext(result));

} else if (result != TYBS_R_SUCCESS) {

result = TYBS_R_SUCCESS;

} while (result != TYBS_R_SUCCESS);

if (ns_smf_want_disable == 1) {

}

cleanup();

if (want_stats) {

tybs_mem_stats(ns_g_mctx, stdout);

tybs_mutex_stats(stdout);

result = ns_smf_get_instance(&instance, 1, ns_g_mctx);

if (result == TYBS_R_SUCCESS && instance != NULL) {

}

if (instance != NULL)

tybs_mem_free(ns_g_mctx, instance);

if (smf_disable_instance(instance, 0) != 0)

UNEXPECTED_ERROR(__FILE__, __LINE__,

"smf_disable_instance() "

"failed for %s : %s",

instance,

scf_strerror(scf_error()));

#ifdef HAVE_LIBSCF

#endif /* HAVE_LIBSCF */

天一博胜企业管理软件V1.0 源代码

}

#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS

#include "php.h"

#include

#include

#ifdef PHP_WIN32

#include "win32/time.h"

#include "win32/signal.h"

#include "win32/php_win32_globals.h"

#include

#elif defined(NETWARE)

#include

#ifdef USE_WINSOCK

#include

#endif

#endif

#if HAVE_SYS_TIME_H

#include

#endif

#if HAVE_UNISTD_H

#include

#endif

#if HAVE_SIGNAL_H

#include

#endif

#if HAVE_SETLOCALE

#include

#endif

#include "zend.h"

#include "zend_extensions.h"

#include "php_ini.h"

#include "php_globals.h"

#include "php_main.h"

#include "fopen_wrappers.h"

#include "ext/standard/php_standard.h"

}

if (ns_g_memstatistics && memstats != NULL) {

}

tybs_mem_destroy(&ns_g_mctx);

tybs_mem_checkdestroyed(stderr);

ns_main_setmemstats(NULL);

tybs_app_finish();

ns_os_closedevnull();

ns_os_shutdown();

return (0);

FILE *fp = NULL;

result = tybs_stdio_open(memstats, "w", &fp);

if (result == TYBS_R_SUCCESS) {

}

tybs_mem_stats(ns_g_mctx, fp);

tybs_mutex_stats(fp);

tybs_stdio_close(fp);

15

天一博胜企业管理软件V1.0 源代码

#include "php_variables.h"

#include "ext/standard/credits.h"

#ifdef PHP_WIN32

#include

#include "win32/php_registry.h"

#include "ext/standard/flock_compat.h"

#endif

#include "php_syslog.h"

#include "Zend/zend_exceptions.h"

#if PHP_SIGCHILD

#include

#include

#endif

#include "zend_compile.h"

#include "zend_execute.h"

#include "zend_highlight.h"

#include "zend_indent.h"

#include "zend_extensions.h"

#include "zend_ini.h"

#include "php_content_types.h"

#include "php_ticks.h"

#include "php_logos.h"

#include "php_streams.h"

#include "php_open_temporary_file.h"

#include "SAPI.h"

#include "rfc1867.h"

/* }}} */

#ifndef ZTS

php_core_globals core_globals;

#else

PHPAPI int core_globals_id;

#endif

#define SAFE_FILENAME(f) ((f)?(f):"-")

/* {{{ PHP_INI_MH

*/

static PHP_INI_MH(OnSetPrecision)

{

}

static PHP_INI_MH(OnChangeMemoryLimit)

{

if (new_value) {

}

PG(memory_limit) = zend_atoi(new_value, new_value_length);

PG(memory_limit) = 1<<30; /* effectively, no limit */

} else {

int i = atoi(new_value);

if (i >= 0) {

}

EG(precision) = i;

return SUCCESS;

return FAILURE;

16

} else {

天一博胜企业管理软件V1.0 源代码

}

static void php_disable_functions(TSRMLS_D)

{

}

static void php_disable_classes(TSRMLS_D)

{

char *s = NULL, *e;

if (!*(INI_STR("disable_classes"))) {

}

e = PG(disable_classes) = strdup(INI_STR("disable_classes"));

while (*e) {

switch (*e) {

case ' ':

case ',':

if (s) {

}

break;

if (!s) {

}

s = e;

*e = '0';

zend_disable_class(s, e-s TSRMLS_CC);

s = NULL;

return;

char *s = NULL, *e;

if (!*(INI_STR("disable_functions"))) {

}

e = PG(disable_functions) = strdup(INI_STR("disable_functions"));

while (*e) {

}

if (s) {

}

zend_disable_function(s, e-s TSRMLS_CC);

switch (*e) {

}

e++;

case ' ':

case ',':

if (s) {

}

break;

if (!s) {

}

break;

s = e;

*e = '0';

zend_disable_function(s, e-s TSRMLS_CC);

s = NULL;

return;

return zend_set_memory_limit(PG(memory_limit));

17

default:

default:

天一博胜企业管理软件V1.0 源代码

}

static PHP_INI_MH(OnUpdateTimeout)

{

}

static int php_get_display_errors_mode(char *value, int value_length)

{

}

static PHP_INI_MH(OnUpdateDisplayErrors)

{

}

static PHP_INI_DISP(display_errors_mode)

{

int mode, tmp_value_length, cgi_or_cli;

char *tmp_value;

PG(display_errors) = (zend_bool) php_get_display_errors_mode(new_value, new_value_length);

return SUCCESS;

int mode;

if (!value) {

}

if (value_length == 2 && !strcasecmp("on", value)) {

}

return mode;

mode = PHP_DISPLAY_ERRORS_STDOUT;

mode = PHP_DISPLAY_ERRORS_STDOUT;

mode = PHP_DISPLAY_ERRORS_STDOUT;

mode = PHP_DISPLAY_ERRORS_STDERR;

mode = PHP_DISPLAY_ERRORS_STDOUT;

mode = atoi(value);

if (mode && mode != PHP_DISPLAY_ERRORS_STDOUT && mode != PHP_DISPLAY_ERRORS_STDERR) {

}

mode = PHP_DISPLAY_ERRORS_STDOUT;

} else if (value_length == 3 && !strcasecmp("yes", value)) {

} else if (value_length == 4 && !strcasecmp("true", value)) {

} else if (value_length == 6 && !strcasecmp(value, "stderr")) {

} else if (value_length == 6 && !strcasecmp(value, "stdout")) {

} else {

return PHP_DISPLAY_ERRORS_STDOUT;

EG(timeout_seconds) = atoi(new_value);

if (stage==PHP_INI_STAGE_STARTUP) {

}

zend_unset_timeout(TSRMLS_C);

zend_set_timeout(EG(timeout_seconds));

return SUCCESS;

/* Don't set a timeout on startup, only per-request */

return SUCCESS;

}

if (s) {

}

zend_disable_class(s, e-s TSRMLS_CC);

}

e++;

break;

18

天一博胜企业管理软件V1.0 源代码

}

static PHP_INI_MH(OnUpdateErrorLog)

{

}

static PHP_INI_MH(OnChangeMailForceExtra)

{

/* Don't allow changing it in htaccess */

if (stage == PHP_INI_STAGE_HTACCESS) {

/* Only do the safemode/open_basedir check at runtime */

if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) &&

}

OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);

return SUCCESS;

strcmp(new_value, "syslog")) {

if (PG(safe_mode) && (!php_checkuid(new_value, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {

}

if (PG(open_basedir) && php_check_open_basedir(new_value TSRMLS_CC)) {

}

return FAILURE;

return FAILURE;

TSRMLS_FETCH();

if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {

}

mode = php_get_display_errors_mode(tmp_value, tmp_value_length);

cgi_or_cli = (!strcmp(sapi_, "cli") || !strcmp(sapi_, "cgi"));

switch (mode) {

}

case PHP_DISPLAY_ERRORS_STDERR:

if (cgi_or_cli ) {

}

break;

if (cgi_or_cli ) {

}

break;

PUTS("Off");

break;

PUTS("STDOUT");

PUTS("On");

} else {

PUTS("STDERR");

PUTS("On");

} else {

tmp_value = (ini_entry->orig_value ? ini_entry->orig_value : NULL );

tmp_value_length = ini_entry->orig_value_length;

tmp_value = ini_entry->value;

tmp_value_length = ini_entry->value_length;

tmp_value = NULL;

tmp_value_length = 0;

19

} else if (ini_entry->value) {

} else {

case PHP_DISPLAY_ERRORS_STDOUT:

default:

天一博胜企业管理软件V1.0 源代码

}

#ifndef PHP_SAFE_MODE_EXEC_DIR

# define PHP_SAFE_MODE_EXEC_DIR ""

#endif

#if defined(PHP_PROG_SENDMAIL) && !defined(NETWARE)

#

#

#else

# define DEFAULT_SENDMAIL_PATH "/usr/sbin/sendmail -t -i"

#endif

PHPAPI void php_log_err(char *log_message TSRMLS_DC)

{

}

PHPAPI int php_write(void *buf, uint size TSRMLS_DC)

{

int fd = -1;

char error_time_str[128];

struct tm tmbuf;

time_t error_time;

/* Try to use the specified logging location. */

if (PG(error_log) != NULL) {

}

/* Otherwise fall back to the default logging location, if we have one */

if (sapi__message) {

}

sapi__message(log_message);

if (!strcmp(PG(error_log), "syslog")) {

}

fd = VCWD_OPEN_MODE(PG(error_log), O_CREAT | O_APPEND | O_WRONLY, 0644);

if (fd != -1) {

}

char *tmp;

int len;

time(&error_time);

php_syslog(LOG_NOTICE, "%.500s", log_message);

return;

define DEFAULT_SENDMAIL_PATH PHP_PROG_SENDMAIL " -t -i "

define DEFAULT_SENDMAIL_PATH NULL

#elif defined(PHP_WIN32)

}

return SUCCESS;

return FAILURE;

20

#ifdef HAVE_SYSLOG_H

#endif

strftime(error_time_str, sizeof(error_time_str), "%d-%b-%Y %H:%M:%S", php_localtime_r(&error_time,

len = spprintf(&tmp, 0, "[%s] %s%s", error_time_str, log_message, PHP_EOL);

php_flock(fd, 2);

write(fd, tmp, len);

efree(tmp);

close(fd);

return;

&tmbuf));

#ifdef PHP_WIN32

#endif

天一博胜企业管理软件V1.0 源代码

}

/* }}} */

/* {{{ php_printf

*/

PHPAPI int php_printf(const char *format, ...)

{

}

/* }}} */

/* {{{ php_verror helpers */

/* {{{ php_during_module_startup */

static int php_during_module_startup(void)

{

}

/* }}} */

/* {{{ php_during_module_shutdown */

static int php_during_module_shutdown(void)

{

}

/* }}} */

/* }}} */

/* {{{ php_verror */

/* php_verror is called from php_error_docref functions.

* Its purpose is to unify error messages and automatically generate clickable

* html error messages if correcponding ini setting (html_errors) is activated.

* See: CODING_STANDARDS for details.

*/

PHPAPI void php_verror(const char *docref, const char *params, int type, const char *format, va_list args TSRMLS_DC)

{

char *buffer = NULL, *docref_buf = NULL, *target = NULL;

char *docref_target = "", *docref_root = "";

char *p;

int buffer_len = 0;

char *space;

char *class_name = get_active_class_name(&space TSRMLS_CC);

char *function;

int origin_len;

char *origin;

char *message;

return module_shutdown;

return module_startup;

va_list args;

int ret;

char *buffer;

int size;

TSRMLS_FETCH();

va_start(args, format);

size = vspprintf(&buffer, 0, format, args);

ret = PHPWRITE(buffer, size);

efree(buffer);

va_end(args);

return ret;

return PHPWRITE(buf, size);

21

天一博胜企业管理软件V1.0 源代码

int is_function = 0;

/* get error text into buffer and escape for html if necessary */

buffer_len = vspprintf(&buffer, 0, format, args);

if (PG(html_errors)) {

}

/* which function caused the problem if any at all */

if (php_during_module_startup()) {

) {

}

if (is_function) {

switch (EG(current_execute_data)->opline->) {

}

function = get_active_function_name(TSRMLS_C);

if (!function || !strlen(function)) {

}

function = "Unknown";

is_function = 1;

} else {

case ZEND_EVAL:

function = "eval";

is_function = 1;

break;

function = "include";

is_function = 1;

break;

function = "include_once";

is_function = 1;

break;

function = "require";

is_function = 1;

break;

function = "require_once";

is_function = 1;

break;

function = "Unknown";

function = "PHP Startup";

function = "PHP Shutdown";

EG(current_execute_data)->opline &&

EG(current_execute_data)->opline->opcode == ZEND_INCLUDE_OR_EVAL

} else if (php_during_module_shutdown()) {

} else if (EG(current_execute_data) &&

int len;

char *replace = php_escape_html_entities(buffer, buffer_len, &len, 0, ENT_COMPAT, NULL TSRMLS_CC);

efree(buffer);

buffer = replace;

buffer_len = len;

22

case ZEND_INCLUDE:

case ZEND_INCLUDE_ONCE:

case ZEND_REQUIRE:

case ZEND_REQUIRE_ONCE:

default:

} else {

天一博胜企业管理软件V1.0 源代码

}

if (PG(html_errors)) {

}

if (docref && docref[0] == '#') {

}

if (!docref && is_function) {

}

if (docref && is_function && (PG(html_errors) || strlen(PG(docref_root)))) {

if (strncmp(docref, "", 7)) {

}

/* display html formatted or only show the additional links */

/* We don't have '' so we use docref_root */

char *ref; /* temp copy for duplicated docref */

docref_root = PG(docref_root);

ref = estrdup(docref);

if (docref_buf) {

}

docref_buf = ref;

/* strip of the target if any */

p = strrchr(ref, '#');

if (p) {

}

/* add the extension if it is set in ini */

if (PG(docref_ext) && strlen(PG(docref_ext))) {

}

docref = docref_buf;

spprintf(&docref_buf, 0, "%s%s", ref, PG(docref_ext));

efree(ref);

target = estrdup(p);

if (target) {

}

docref_target = target;

*p = '0';

efree(docref_buf);

if (space[0] == '0') {

}

while((p = strchr(docref_buf, '_')) != NULL) {

}

docref = docref_buf;

*p = '-';

spprintf(&docref_buf, 0, "function.%s", function);

spprintf(&docref_buf, 0, "function.%s-%s", class_name, function);

} else {

docref_target = strchr(docref, '#');

docref = NULL;

int len;

char *replace = php_escape_html_entities(origin, origin_len, &len, 0, ENT_COMPAT, NULL TSRMLS_CC);

efree(origin);

origin = replace;

origin_len = spprintf(&origin, 0, "%s%s%s(%s)", class_name, space, function, params);

origin_len = spprintf(&origin, 0, "%s", function);

} else {

23

天一博胜企业管理软件V1.0 源代码

}

/* }}} */

/* {{{ php_error_docref0 */

/* See: CODING_STANDARDS for details. */

PHPAPI void php_error_docref0(const char *docref TSRMLS_DC, int type, const char *format, ...)

{

}

/* }}} */

/* {{{ php_error_docref1 */

/* See: CODING_STANDARDS for details. */

PHPAPI void php_error_docref1(const char *docref TSRMLS_DC, const char *param1, int type, const char *format, ...)

{

}

/* }}} */

/* {{{ php_error_docref2 */

/* See: CODING_STANDARDS for details. */

va_list args;

va_start(args, format);

php_verror(docref, param1, type, format, args TSRMLS_CC);

va_end(args);

va_list args;

va_start(args, format);

php_verror(docref, "", type, format, args TSRMLS_CC);

va_end(args);

}

efree(origin);

if (docref_buf) {

}

if (PG(track_errors) && module_initialized && EG(active_symbol_table) &&

}

efree(buffer);

php_error(type, "%s", message);

efree(message);

(!EG(user_error_handler) || !(EG(user_error_handler_error_reporting) & type))) {

zval *tmp;

ALLOC_INIT_ZVAL(tmp);

ZVAL_STRINGL(tmp, buffer, buffer_len, 1);

efree(docref_buf);

if (PG(html_errors)) {

24

spprintf(&message, 0, "%s [%s]: %s", origin, docref_root, docref, docref_target, docref,

buffer);

} else {

}

if (target) {

}

spprintf(&message, 0, "%s: %s", origin, buffer);

efree(target);

spprintf(&message, 0, "%s [%s%s%s]: %s", origin, docref_root, docref, docref_target, buffer);

} else {

zend_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) &tmp, sizeof(zval *),

NULL);

PHPAPI void php_error_docref2(const char *docref TSRMLS_DC, const char *param1, const char *param2, int type, const char

天一博胜企业管理软件V1.0 源代码

*format, ...)

{

}

/* }}} */

/* {{{ php_html_puts */

PHPAPI void php_html_puts(const char *str, uint size TSRMLS_DC)

{

}

/* }}} */

/* {{{ php_suppress_errors */

PHPAPI void php_set_error_handling(error_handling_t error_handling, zend_class_entry *exception_class TSRMLS_DC)

{

}

/* }}} */

/* {{{ php_error_cb

extended error handling function */

static void php_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args)

{

char *buffer;

int buffer_len, display;

TSRMLS_FETCH();

buffer_len = vspprintf(&buffer, PG(log_errors_max_len), format, args);

/* check for repeated errors to be ignored */

if (PG(ignore_repeated_errors) && PG(last_error_message)) {

/* no check for PG(last_error_file) is needed since it cannot

* be NULL if PG(last_error_message) is not NULL */

if (strcmp(PG(last_error_message), buffer)

|| (!PG(ignore_repeated_source)

&& ((PG(last_error_lineno) != (int)error_lineno)

|| strcmp(PG(last_error_file), error_filename)))) {

PG(error_handling) = error_handling;

PG(exception_class) = exception_class;

if (PG(last_error_message)) {

}

if (PG(last_error_file)) {

}

PG(last_error_lineno) = 0;

free(PG(last_error_file));

PG(last_error_file) = NULL;

free(PG(last_error_message));

PG(last_error_message) = NULL;

zend_html_puts(str, size TSRMLS_CC);

char *params;

va_list args;

spprintf(¶ms, 0, "%s,%s", param1, param2);

va_start(args, format);

php_verror(docref, params ? params : "...", type, format, args TSRMLS_CC);

va_end(args);

if (params) {

}

efree(params);

25

display = 1;

天一博胜企业管理软件V1.0 源代码

}

/* store the error if it has changed */

if (display) {

}

/* according to error handling mode, suppress error, throw exception or show it */

if (PG(error_handling) != EH_NORMAL) {

}

/* display/log the error if necessary */

if (display && (EG(error_reporting) & type || (type & E_CORE))

&& (PG(log_errors) || PG(display_errors) || (!module_initialized))) {

char *error_type_str;

switch (type) {

switch (type) {

}

case E_ERROR:

case E_CORE_ERROR:

case E_COMPILE_ERROR:

case E_USER_ERROR:

case E_PARSE:

/* fatal errors are real errors and cannot be made exceptions */

break;

/* for the sake of BC to old damaged code */

break;

if (PG(last_error_message)) {

}

if (PG(last_error_file)) {

}

PG(last_error_type) = type;

PG(last_error_message) = strdup(buffer);

PG(last_error_file) = strdup(error_filename);

PG(last_error_lineno) = error_lineno;

free(PG(last_error_file));

free(PG(last_error_message));

} else {

}

display = 1;

display = 0;

26

} else {

case E_STRICT:

case E_NOTICE:

case E_USER_NOTICE:

/* notices are no errors and are not treated as such like E_WARNINGS */

break;

/* throw an exception if we are in EH_THROW mode

* but DO NOT overwrite a pending exception

*/

if (PG(error_handling) == EH_THROW && !EG(exception)) {

}

efree(buffer);

return;

zend_throw_error_exception(PG(exception_class), buffer, 0, type TSRMLS_CC);

default:

天一博胜企业管理软件V1.0 源代码

}

if (!module_initialized || PG(log_errors)) {

}

if (PG(display_errors)

&& ((module_initialized && !PG(during_request_startup))

) {

if (PG(xmlrpc_errors)) {

php_printf("

in %s

|| (PG(display_startup_errors)

)

&&

)

(OG(php_body_write)==php_default_output_func

char *log_buffer;

if ((type == E_CORE_ERROR || type == E_CORE_WARNING) && PG(display_startup_errors)) {

}

spprintf(&log_buffer, 0, "PHP %s: %s in %s on line %d", error_type_str, buffer, error_filename, error_lineno);

php_log_err(log_buffer TSRMLS_CC);

efree(log_buffer);

MessageBox(NULL, buffer, error_type_str, MB_OK|ZEND_SERVICE_MB_STYLE);

case E_ERROR:

case E_CORE_ERROR:

case E_COMPILE_ERROR:

case E_USER_ERROR:

error_type_str = "Fatal error";

break;

error_type_str = "Catchable fatal error";

break;

27

case E_RECOVERABLE_ERROR:

case E_WARNING:

case E_CORE_WARNING:

case E_COMPILE_WARNING:

case E_USER_WARNING:

error_type_str = "Warning";

break;

error_type_str = "Parse error";

break;

case E_PARSE:

case E_NOTICE:

case E_USER_NOTICE:

error_type_str = "Notice";

break;

error_type_str = "Strict Standards";

break;

error_type_str = "Unknown error";

break;

case E_STRICT:

default:

#ifdef PHP_WIN32

#endif

||

OG(php_body_write)==php_ub_body_write_no_header || OG(php_body_write)==php_ub_body_write)

version="1.0"?>faultCode%ld

faultString%s:%s on

天一博胜企业管理软件V1.0 源代码

buffer, error_filename, error_lineno);

}

/* Bail out if we can't recover */

switch (type) {

case E_CORE_ERROR:

if(!module_initialized) {

}

if (PG(report_zend_debug)) {

}

zend_bool trigger_break;

switch (type) {

}

case E_ERROR:

case E_CORE_ERROR:

case E_COMPILE_ERROR:

case E_USER_ERROR:

trigger_break=1;

break;

trigger_break=0;

break;

} else {

}

char *prepend_string = INI_STR("error_prepend_string");

char *append_string = INI_STR("error_append_string");

if (PG(html_errors)) {

}

if (type == E_ERROR) {

}

/* Write CLI/CGI errors to stderr if display_errors = "stderr" */

if ((!strcmp(sapi_, "cli") || !strcmp(sapi_, "cgi")) &&

) {

}

PG(display_errors) == PHP_DISPLAY_ERRORS_STDERR

int len;

28

line %d", PG(xmlrpc_error_number), error_type_str,

char *buf = php_escape_html_entities(buffer, buffer_len, &len, 0, ENT_COMPAT, NULL

php_printf("%s
n%s: %s in %s on line %d
n%s",

efree(buf);

php_printf("%s
n%s: %s in %s on line %d
n%s",

TSRMLS_CC);

STR_PRINT(prepend_string), error_type_str, buf, error_filename, error_lineno, STR_PRINT(append_string));

} else {

STR_PRINT(prepend_string), error_type_str, buffer, error_filename, error_lineno, STR_PRINT(append_string));

} else {

fprintf(stderr, "%s: %s in %s on line %dn", error_type_str, buffer, error_filename, error_lineno);

php_printf("%sn%s: %s in %s on line %dn%s", STR_PRINT(prepend_string), error_type_str,

} else {

buffer, error_filename, error_lineno, STR_PRINT(append_string));

#if ZEND_DEBUG

default:

zend_output_debug_string(trigger_break, "%s(%d) : %s - %s", error_filename, error_lineno, error_type_str, buffer);

#endif

天一博胜企业管理软件V1.0 源代码

}

static PHP_INI_MH(OnUpdateTimeout)

{

EG(timeout_seconds) = atoi(new_value);

if (stage==PHP_INI_STAGE_STARTUP) {

/* Don't set a timeout on startup, only per-request */

return SUCCESS;

}

/* Log if necessary */

if (!display) {

}

if (PG(track_errors) && module_initialized && EG(active_symbol_table)) {

}

efree(buffer);

zval *tmp;

ALLOC_INIT_ZVAL(tmp);

ZVAL_STRINGL(tmp, buffer, buffer_len, 1);

efree(buffer);

return;

}

/* bad error in module startup - no way we can live with this */

exit(-2);

29

/* no break - intentionally */

case E_ERROR:

case E_RECOVERABLE_ERROR:

case E_PARSE:

case E_COMPILE_ERROR:

case E_USER_ERROR:

EG(exit_status) = 255;

if (module_initialized) {

}

break;

if (!PG(display_errors) &&

!SG(headers_sent) &&

) {

}

/* the parser would return 1 (failure), we can bail out nicely */

if (type != E_PARSE) {

}

/* restore memory limit */

zend_set_memory_limit(PG(memory_limit));

efree(buffer);

zend_objects_store_mark_destructed(&EG(objects_store) TSRMLS_CC);

zend_bailout();

return;

sapi_header_line ctr = {0};

= "HTTP/1.0 500 Internal Server Error";

_len = strlen();

sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);

SG(sapi_headers).http_response_code == 200

zend_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) & tmp, sizeof(zval *),

NULL);

天一博胜企业管理软件V1.0 源代码

}

static int php_get_display_errors_mode(char *value, int value_length)

{

}

static PHP_INI_MH(OnUpdateDisplayErrors)

{

}

static PHP_INI_DISP(display_errors_mode)

{

int mode, tmp_value_length, cgi_or_cli;

char *tmp_value;

TSRMLS_FETCH();

if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {

}

mode = php_get_display_errors_mode(tmp_value, tmp_value_length);

cgi_or_cli = (!strcmp(sapi_, "cli") || !strcmp(sapi_, "cgi"));

switch (mode) {

tmp_value = (ini_entry->orig_value ? ini_entry->orig_value : NULL );

tmp_value_length = ini_entry->orig_value_length;

tmp_value = ini_entry->value;

tmp_value_length = ini_entry->value_length;

tmp_value = NULL;

tmp_value_length = 0;

PG(display_errors) = (zend_bool) php_get_display_errors_mode(new_value, new_value_length);

return SUCCESS;

int mode;

if (!value) {

}

if (value_length == 2 && !strcasecmp("on", value)) {

}

return mode;

mode = PHP_DISPLAY_ERRORS_STDOUT;

mode = PHP_DISPLAY_ERRORS_STDOUT;

mode = PHP_DISPLAY_ERRORS_STDOUT;

mode = PHP_DISPLAY_ERRORS_STDERR;

mode = PHP_DISPLAY_ERRORS_STDOUT;

mode = atoi(value);

if (mode && mode != PHP_DISPLAY_ERRORS_STDOUT && mode != PHP_DISPLAY_ERRORS_STDERR) {

}

mode = PHP_DISPLAY_ERRORS_STDOUT;

} else if (value_length == 3 && !strcasecmp("yes", value)) {

} else if (value_length == 4 && !strcasecmp("true", value)) {

} else if (value_length == 6 && !strcasecmp(value, "stderr")) {

} else if (value_length == 6 && !strcasecmp(value, "stdout")) {

} else {

return PHP_DISPLAY_ERRORS_STDOUT;

}

zend_unset_timeout(TSRMLS_C);

zend_set_timeout(EG(timeout_seconds));

return SUCCESS;

30

} else if (ini_entry->value) {

} else {

天一博胜企业管理软件V1.0 源代码

}

static PHP_INI_MH(OnUpdateErrorLog)

{

}

static PHP_INI_MH(OnChangeMailForceExtra)

{

}

#ifndef PHP_SAFE_MODE_EXEC_DIR

# define PHP_SAFE_MODE_EXEC_DIR ""

#endif

#if defined(PHP_PROG_SENDMAIL) && !defined(NETWARE)

#

#

#else

# define DEFAULT_SENDMAIL_PATH "/usr/sbin/sendmail -t -i"

#endif

define DEFAULT_SENDMAIL_PATH PHP_PROG_SENDMAIL " -t -i "

define DEFAULT_SENDMAIL_PATH NULL

#elif defined(PHP_WIN32)

/* Don't allow changing it in htaccess */

if (stage == PHP_INI_STAGE_HTACCESS) {

}

return SUCCESS;

return FAILURE;

/* Only do the safemode/open_basedir check at runtime */

if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) &&

}

OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);

return SUCCESS;

strcmp(new_value, "syslog")) {

if (PG(safe_mode) && (!php_checkuid(new_value, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {

}

if (PG(open_basedir) && php_check_open_basedir(new_value TSRMLS_CC)) {

}

return FAILURE;

return FAILURE;

}

case PHP_DISPLAY_ERRORS_STDERR:

if (cgi_or_cli ) {

}

break;

if (cgi_or_cli ) {

}

break;

PUTS("Off");

break;

PUTS("STDOUT");

PUTS("On");

} else {

PUTS("STDERR");

PUTS("On");

} else {

31

case PHP_DISPLAY_ERRORS_STDOUT:

default:

天一博胜企业管理软件V1.0 源代码

PHPAPI void php_log_err(char *log_message TSRMLS_DC)

{

}

PHPAPI int php_write(void *buf, uint size TSRMLS_DC)

{

}

/* }}} */

/* {{{ php_printf

*/

PHPAPI int php_printf(const char *format, ...)

{

va_list args;

int ret;

char *buffer;

int size;

TSRMLS_FETCH();

va_start(args, format);

size = vspprintf(&buffer, 0, format, args);

return PHPWRITE(buf, size);

int fd = -1;

char error_time_str[128];

struct tm tmbuf;

time_t error_time;

/* Try to use the specified logging location. */

if (PG(error_log) != NULL) {

}

/* Otherwise fall back to the default logging location, if we have one */

if (sapi__message) {

}

sapi__message(log_message);

if (!strcmp(PG(error_log), "syslog")) {

}

fd = VCWD_OPEN_MODE(PG(error_log), O_CREAT | O_APPEND | O_WRONLY, 0644);

if (fd != -1) {

}

char *tmp;

int len;

time(&error_time);

php_syslog(LOG_NOTICE, "%.500s", log_message);

return;

32

#ifdef HAVE_SYSLOG_H

#endif

strftime(error_time_str, sizeof(error_time_str), "%d-%b-%Y %H:%M:%S", php_localtime_r(&error_time,

len = spprintf(&tmp, 0, "[%s] %s%s", error_time_str, log_message, PHP_EOL);

php_flock(fd, 2);

write(fd, tmp, len);

efree(tmp);

close(fd);

return;

&tmbuf));

#ifdef PHP_WIN32

#endif

天一博胜企业管理软件V1.0 源代码

}

/* }}} */

/* {{{ php_verror helpers */

/* {{{ php_during_module_startup */

static int php_during_module_startup(void)

{

}

static int php_during_module_shutdown(void)

{

}

PHPAPI void php_verror(const char *docref, const char *params, int type, const char *format, va_list args TSRMLS_DC)

{

char *buffer = NULL, *docref_buf = NULL, *target = NULL;

char *docref_target = "", *docref_root = "";

char *p;

int buffer_len = 0;

char *space;

char *class_name = get_active_class_name(&space TSRMLS_CC);

char *function;

int origin_len;

char *origin;

char *message;

int is_function = 0;

/* get error text into buffer and escape for html if necessary */

buffer_len = vspprintf(&buffer, 0, format, args);

if (PG(html_errors)) {

}

/* which function caused the problem if any at all */

if (php_during_module_startup()) {

) {

switch (EG(current_execute_data)->opline->) {

case ZEND_EVAL:

function = "eval";

is_function = 1;

break;

function = "PHP Startup";

function = "PHP Shutdown";

EG(current_execute_data)->opline &&

EG(current_execute_data)->opline->opcode == ZEND_INCLUDE_OR_EVAL

} else if (php_during_module_shutdown()) {

} else if (EG(current_execute_data) &&

int len;

char *replace = php_escape_html_entities(buffer, buffer_len, &len, 0, ENT_COMPAT, NULL TSRMLS_CC);

efree(buffer);

buffer = replace;

buffer_len = len;

return module_shutdown;

return module_startup;

ret = PHPWRITE(buffer, size);

efree(buffer);

va_end(args);

return ret;

33

天一博胜企业管理软件V1.0 源代码

}

if (is_function) {

}

if (PG(html_errors)) {

}

if (docref && docref[0] == '#') {

}

if (!docref && is_function) {

if (space[0] == '0') {

}

while((p = strchr(docref_buf, '_')) != NULL) {

}

docref = docref_buf;

*p = '-';

spprintf(&docref_buf, 0, "function.%s", function);

spprintf(&docref_buf, 0, "function.%s-%s", class_name, function);

} else {

docref_target = strchr(docref, '#');

docref = NULL;

int len;

char *replace = php_escape_html_entities(origin, origin_len, &len, 0, ENT_COMPAT, NULL TSRMLS_CC);

efree(origin);

origin = replace;

origin_len = spprintf(&origin, 0, "%s%s%s(%s)", class_name, space, function, params);

origin_len = spprintf(&origin, 0, "%s", function);

} else {

}

function = get_active_function_name(TSRMLS_C);

if (!function || !strlen(function)) {

}

function = "Unknown";

is_function = 1;

} else {

case ZEND_INCLUDE:

function = "include";

is_function = 1;

break;

function = "include_once";

is_function = 1;

break;

function = "require";

is_function = 1;

break;

function = "require_once";

is_function = 1;

break;

function = "Unknown";

34

case ZEND_INCLUDE_ONCE:

case ZEND_REQUIRE:

case ZEND_REQUIRE_ONCE:

default:

} else {

天一博胜企业管理软件V1.0 源代码

}

if (docref && is_function && (PG(html_errors) || strlen(PG(docref_root)))) {

}

efree(origin);

if (docref_buf) {

}

if (PG(track_errors) && module_initialized && EG(active_symbol_table) &&

}

(!EG(user_error_handler) || !(EG(user_error_handler_error_reporting) & type))) {

zval *tmp;

ALLOC_INIT_ZVAL(tmp);

ZVAL_STRINGL(tmp, buffer, buffer_len, 1);

efree(docref_buf);

if (strncmp(docref, "", 7)) {

}

/* display html formatted or only show the additional links */

if (PG(html_errors)) {

/* We don't have '' so we use docref_root */

char *ref; /* temp copy for duplicated docref */

docref_root = PG(docref_root);

ref = estrdup(docref);

if (docref_buf) {

}

docref_buf = ref;

/* strip of the target if any */

p = strrchr(ref, '#');

if (p) {

}

/* add the extension if it is set in ini */

if (PG(docref_ext) && strlen(PG(docref_ext))) {

}

docref = docref_buf;

spprintf(&docref_buf, 0, "%s%s", ref, PG(docref_ext));

efree(ref);

target = estrdup(p);

if (target) {

}

docref_target = target;

*p = '0';

efree(docref_buf);

35

spprintf(&message, 0, "%s [%s]: %s", origin, docref_root, docref, docref_target, docref,

buffer);

} else {

}

if (target) {

}

spprintf(&message, 0, "%s: %s", origin, buffer);

efree(target);

spprintf(&message, 0, "%s [%s%s%s]: %s", origin, docref_root, docref, docref_target, buffer);

} else {

zend_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) &tmp, sizeof(zval *),

NULL);

天一博胜企业管理软件V1.0 源代码

}

/* }}} */

/* {{{ php_error_docref0 */

/* See: CODING_STANDARDS for details. */

PHPAPI void php_error_docref0(const char *docref TSRMLS_DC, int type, const char *format, ...)

{

}

/* }}} */

/* {{{ php_error_docref1 */

/* See: CODING_STANDARDS for details. */

PHPAPI void php_error_docref1(const char *docref TSRMLS_DC, const char *param1, int type, const char *format, ...)

{

}

/* }}} */

/* {{{ php_error_docref2 */

/* See: CODING_STANDARDS for details. */

va_list args;

va_start(args, format);

php_verror(docref, param1, type, format, args TSRMLS_CC);

va_end(args);

va_list args;

va_start(args, format);

php_verror(docref, "", type, format, args TSRMLS_CC);

va_end(args);

efree(buffer);

php_error(type, "%s", message);

efree(message);

36

PHPAPI void php_error_docref2(const char *docref TSRMLS_DC, const char *param1, const char *param2, int type, const char

*format, ...)

{

}

/* }}} */

/* {{{ php_html_puts */

PHPAPI void php_html_puts(const char *str, uint size TSRMLS_DC)

{

}

/* }}} */

/* {{{ php_suppress_errors */

PHPAPI void php_set_error_handling(error_handling_t error_handling, zend_class_entry *exception_class TSRMLS_DC)

{

PG(error_handling) = error_handling;

PG(exception_class) = exception_class;

zend_html_puts(str, size TSRMLS_CC);

char *params;

va_list args;

spprintf(¶ms, 0, "%s,%s", param1, param2);

va_start(args, format);

php_verror(docref, params ? params : "...", type, format, args TSRMLS_CC);

va_end(args);

if (params) {

}

efree(params);

天一博胜企业管理软件V1.0 源代码

}

PHP_FUNCTION(set_time_limit)

{

}

static PHP_INI_DISP(display_errors_mode)

{

int mode, tmp_value_length, cgi_or_cli;

char *tmp_value;

TSRMLS_FETCH();

if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {

}

mode = php_get_display_errors_mode(tmp_value, tmp_value_length);

cgi_or_cli = (!strcmp(sapi_, "cli") || !strcmp(sapi_, "cgi"));

switch (mode) {

case PHP_DISPLAY_ERRORS_STDERR:

if (cgi_or_cli ) {

}

PUTS("STDERR");

PUTS("On");

} else {

tmp_value = (ini_entry->orig_value ? ini_entry->orig_value : NULL );

tmp_value_length = ini_entry->orig_value_length;

tmp_value = ini_entry->value;

tmp_value_length = ini_entry->value_length;

tmp_value = NULL;

tmp_value_length = 0;

zval **new_timeout;

if (PG(safe_mode)) {

}

if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &new_timeout) == FAILURE) {

}

convert_to_string_ex(new_timeout);

if

}

(zend_alter_ini_entry("max_execution_time",

RETURN_TRUE;

RETURN_FALSE;

sizeof("max_execution_time"),

WRONG_PARAM_COUNT;

php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot set time limit in safe mode");

RETURN_FALSE;

if (PG(last_error_message)) {

}

if (PG(last_error_file)) {

}

PG(last_error_lineno) = 0;

free(PG(last_error_file));

PG(last_error_file) = NULL;

free(PG(last_error_message));

PG(last_error_message) = NULL;

37

Z_STRVAL_PP(new_timeout),

Z_STRLEN_PP(new_timeout), PHP_INI_USER, PHP_INI_STAGE_RUNTIME) == SUCCESS) {

} else {

} else if (ini_entry->value) {

} else {

天一博胜企业管理软件V1.0 源代码

break;

case PHP_DISPLAY_ERRORS_STDOUT:

if (cgi_or_cli ) {

PUTS("STDOUT");

} else {

PUTS("On");

}

break;

default:

PUTS("Off");

break;

}

}

static PHP_INI_MH(OnUpdateErrorLog)

{

/* Only do the safemode/open_basedir check at runtime */

if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) &&

strcmp(new_value, "syslog")) {

if (PG(safe_mode) && (!php_checkuid(new_value, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {

return FAILURE;

}

if (PG(open_basedir) && php_check_open_basedir(new_value TSRMLS_CC)) {

return FAILURE;

}

}

OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);

return SUCCESS;

}

static FILE *php_fopen_wrapper_for_zend(const char *filename, char **opened_path)

{

TSRMLS_FETCH();

return php_stream_open_wrapper_as_file((char *)filename,

ENFORCE_SAFE_MODE|USE_PATH|IGNORE_URL_WIN|REPORT_ERRORS|STREAM_OPEN_FOR_INCLUDE,

opened_path);

}

/* }}} */

static void stream_closer_for_zend(void *handle TSRMLS_DC) /* {{{ */

{

php_stream_close((php_stream*)handle);

}

/* }}} */

static long stream_fteller_for_zend(void *handle TSRMLS_DC) /* {{{ */

{

return (long)php_stream_tell((php_stream*)handle);

}

/* }}} */

static PHP_INI_MH(OnUpdateTimeout)

{

EG(timeout_seconds) = atoi(new_value);

if (stage==PHP_INI_STAGE_STARTUP) {

/* Don't set a timeout on startup, only per-request */

return SUCCESS;

38

"rb",

天一博胜企业管理软件V1.0 源代码

}

/* }}} */

/* {{{ php_get_display_errors_mode() helper function

*/

static int php_get_display_errors_mode(char *value, int value_length)

{

}

/* }}} */

/* {{{ PHP_INI_MH

*/

static PHP_INI_MH(OnUpdateDisplayErrors)

{

}

/* }}} */

/* {{{ PHP_INI_DISP

*/

static PHP_INI_DISP(display_errors_mode)

{

int mode, tmp_value_length, cgi_or_cli;

char *tmp_value;

TSRMLS_FETCH();

if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {

tmp_value = (ini_entry->orig_value ? ini_entry->orig_value : NULL );

tmp_value_length = ini_entry->orig_value_length;

PG(display_errors) = (zend_bool) php_get_display_errors_mode(new_value, new_value_length);

return SUCCESS;

int mode;

if (!value) {

}

if (value_length == 2 && !strcasecmp("on", value)) {

}

return mode;

mode = PHP_DISPLAY_ERRORS_STDOUT;

mode = PHP_DISPLAY_ERRORS_STDOUT;

mode = PHP_DISPLAY_ERRORS_STDOUT;

mode = PHP_DISPLAY_ERRORS_STDERR;

mode = PHP_DISPLAY_ERRORS_STDOUT;

mode = atoi(value);

if (mode && mode != PHP_DISPLAY_ERRORS_STDOUT && mode != PHP_DISPLAY_ERRORS_STDERR) {

}

mode = PHP_DISPLAY_ERRORS_STDOUT;

} else if (value_length == 3 && !strcasecmp("yes", value)) {

} else if (value_length == 4 && !strcasecmp("true", value)) {

} else if (value_length == 6 && !strcasecmp(value, "stderr")) {

} else if (value_length == 6 && !strcasecmp(value, "stdout")) {

} else {

return PHP_DISPLAY_ERRORS_STDOUT;

}

zend_unset_timeout(TSRMLS_C);

zend_set_timeout(EG(timeout_seconds));

return SUCCESS;

39

} else if (ini_entry->value) {

天一博胜企业管理软件V1.0 源代码

}

static PHP_INI_MH(OnUpdateErrorLog)

{

}

/* }}} */

/* {{{ PHP_INI_MH

*/

static PHP_INI_MH(OnChangeMailForceExtra)

{

/* Don't allow changing it in htaccess */

if (stage == PHP_INI_STAGE_HTACCESS) {

return FAILURE;

/* Only do the safemode/open_basedir check at runtime */

if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) &&

}

OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);

return SUCCESS;

strcmp(new_value, "syslog")) {

if (PG(safe_mode) && (!php_checkuid(new_value, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {

}

if (PG(open_basedir) && php_check_open_basedir(new_value TSRMLS_CC)) {

}

return FAILURE;

return FAILURE;

}

mode = php_get_display_errors_mode(tmp_value, tmp_value_length);

/* Display 'On' for other SAPIs instead of STDOUT or STDERR */

cgi_or_cli = (!strcmp(sapi_, "cli") || !strcmp(sapi_, "cgi"));

switch (mode) {

}

case PHP_DISPLAY_ERRORS_STDERR:

if (cgi_or_cli ) {

}

break;

if (cgi_or_cli ) {

}

break;

PUTS("Off");

break;

PUTS("STDOUT");

PUTS("On");

} else {

PUTS("STDERR");

PUTS("On");

} else {

tmp_value = ini_entry->value;

tmp_value_length = ini_entry->value_length;

tmp_value = NULL;

tmp_value_length = 0;

40

} else {

case PHP_DISPLAY_ERRORS_STDOUT:

default:

天一博胜企业管理软件V1.0 源代码

}

static int php_stream_open_for_zend(const char *filename, zend_file_handle *handle TSRMLS_DC) /* {{{ */

{

}

/* }}} */

PHPAPI int php_stream_open_for_zend_ex(const char *filename, zend_file_handle *handle, int mode TSRMLS_DC) /* {{{ */

{

}

/* }}} */

/* {{{ php_get_configuration_directive_for_zend

*/

static int php_get_configuration_directive_for_zend(char *name, uint name_length, zval *contents)

{

}

/* }}} */

/* {{{ php_message_handler_for_zend

*/

static void php_message_handler_for_zend(long message, void *data)

{

TSRMLS_FETCH();

switch (message) {

case ZMSG_FAILED_INCLUDE_FOPEN:

zval *retval = cfg_get_entry(name, name_length);

if (retval) {

}

*contents = *retval;

return SUCCESS;

return FAILURE;

php_stream *stream;

stream = php_stream_open_wrapper((char *)filename, "rb", mode, &handle->opened_path);

if (stream) {

}

return FAILURE;

handle->type = ZEND_HANDLE_STREAM;

handle->filename = (char*)filename;

handle->free_filename = 0;

handle-> = stream;

handle-> = (zend_stream_reader_t)_php_stream_read;

handle-> = stream_closer_for_zend;

handle->r = stream_fteller_for_zend;

handle->ctive = 0;

/* suppress warning if this stream is not explicitly closed */

php_stream_auto_cleanup(stream);

return SUCCESS;

return php_stream_open_for_zend_ex(filename,

}

return SUCCESS;

41

handle,

ENFORCE_SAFE_MODE|USE_PATH|REPORT_ERRORS|STREAM_OPEN_FOR_INCLUDE TSRMLS_CC);

} else {

php_error_docref("e" TSRMLS_CC, E_WARNING, "Failed opening '%s' for inclusion

break;

(include_path='%s')", php_strip_url_passwd((char *) data), STR_PRINT(PG(include_path)));

天一博胜企业管理软件V1.0 源代码

#

#

#

#

#

#

else

endif

else

endif

}

break;

struct tm *ta, tmbuf;

time_t curtime;

fprintf(stderr, "%s", memory_leak_buf);

}

break;

fprintf(stderr, "%s", memory_leak_buf);

case ZMSG_FAILED_REQUIRE_FOPEN:

42

php_error_docref("e" TSRMLS_CC, E_COMPILE_ERROR, "Failed opening required '%s'

break;

php_error_docref(NULL

break;

TSRMLS_CC, E_WARNING, "Failed opening '%s' for highlighting",

(include_path='%s')", php_strip_url_passwd((char *) data), STR_PRINT(PG(include_path)));

case ZMSG_FAILED_HIGHLIGHT_FOPEN:

php_strip_url_passwd((char *) data));

case ZMSG_MEMORY_LEAK_DETECTED:

case ZMSG_MEMORY_LEAK_REPEATED:

if (EG(error_reporting) & E_WARNING) {

char memory_leak_buf[1024];

if (message==ZMSG_MEMORY_LEAK_DETECTED) {

}

OutputDebugString(memory_leak_buf);

zend_leak_info *t = (zend_leak_info *) data;

snprintf(memory_leak_buf, 512, "%s(%d) : Freeing 0x%.8lX (%zu bytes), script=%sn", t->filename,

if (t->orig_filename) {

}

unsigned long leak_count = (zend_uintptr_t) data;

snprintf(memory_leak_buf, 512, "Last leak repeated %ld time%sn", leak_count,

char relay_buf[512];

snprintf(relay_buf, 512, "%s(%d) : Actual location (location was relayed)n", t->orig_filename,

strlcat(memory_leak_buf, relay_buf, sizeof(memory_leak_buf));

#if ZEND_DEBUG

t->lineno, (zend_uintptr_t)t->addr, t->size, SAFE_FILENAME(SG(request_info).path_translated));

t->orig_lineno);

} else {

(leak_count>1?"s":""));

if defined(PHP_WIN32)

#endif

case ZMSG_MEMORY_LEAKS_GRAND_TOTAL:

if (EG(error_reporting) & E_WARNING) {

char memory_leak_buf[512];

snprintf(memory_leak_buf, 512, "=== Total %d memory leaks detected ===n", *((zend_uint *) data));

OutputDebugString(memory_leak_buf);

#if ZEND_DEBUG

if defined(PHP_WIN32)

#endif

case ZMSG_LOG_SCRIPT_NAME: {

天一博胜企业管理软件V1.0 源代码

#

#

#

}

/* }}} */

else

endif

}

}

break;

fprintf(stderr, "%s", memory_leak_buf);

char *datetime_str, asctimebuf[52];

char memory_leak_buf[4096];

time(&curtime);

ta = php_localtime_r(&curtime, &tmbuf);

datetime_str = php_asctime_r(ta, asctimebuf);

if (datetime_str) {

datetime_str[strlen(datetime_str)-1]=0; /* get rid of the trailing newline */

43

snprintf(memory_leak_buf, sizeof(memory_leak_buf), "[%s] Script: '%s'n", datetime_str,

SAFE_FILENAME(SG(request_info).path_translated));

} else {

}

OutputDebugString(memory_leak_buf);

snprintf(memory_leak_buf, sizeof(memory_leak_buf), "[null] Script: '%s'n",

SAFE_FILENAME(SG(request_info).path_translated));

if defined(PHP_WIN32)

PHPAPI void php_error_docref2(const char *docref TSRMLS_DC, const char *param1, const char *param2, int type, const char

*format, ...)

{

}

/* }}} */

/* {{{ php_html_puts */

PHPAPI void php_html_puts(const char *str, uint size TSRMLS_DC)

{

}

/* }}} */

/* {{{ php_suppress_errors */

PHPAPI void php_set_error_handling(error_handling_t error_handling, zend_class_entry *exception_class TSRMLS_DC)

{

PG(error_handling) = error_handling;

PG(exception_class) = exception_class;

if (PG(last_error_message)) {

}

free(PG(last_error_message));

PG(last_error_message) = NULL;

zend_html_puts(str, size TSRMLS_CC);

char *params;

va_list args;

spprintf(¶ms, 0, "%s,%s", param1, param2);

va_start(args, format);

php_verror(docref, params ? params : "...", type, format, args TSRMLS_CC);

va_end(args);

if (params) {

}

efree(params);

天一博胜企业管理软件V1.0 源代码

}

/* }}} */

/* {{{ php_error_cb

extended error handling function */

static void php_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args)

{

char *buffer;

int buffer_len, display;

TSRMLS_FETCH();

buffer_len = vspprintf(&buffer, PG(log_errors_max_len), format, args);

/* check for repeated errors to be ignored */

if (PG(ignore_repeated_errors) && PG(last_error_message)) {

}

/* store the error if it has changed */

if (display) {

}

/* according to error handling mode, suppress error, throw exception or show it */

if (PG(error_handling) != EH_NORMAL) {

switch (type) {

case E_ERROR:

case E_CORE_ERROR:

case E_COMPILE_ERROR:

case E_USER_ERROR:

case E_PARSE:

/* fatal errors are real errors and cannot be made exceptions */

if (PG(last_error_message)) {

}

if (PG(last_error_file)) {

}

PG(last_error_type) = type;

PG(last_error_message) = strdup(buffer);

PG(last_error_file) = strdup(error_filename);

PG(last_error_lineno) = error_lineno;

free(PG(last_error_file));

free(PG(last_error_message));

/* no check for PG(last_error_file) is needed since it cannot

* be NULL if PG(last_error_message) is not NULL */

if (strcmp(PG(last_error_message), buffer)

}

display = 1;

|| (!PG(ignore_repeated_source)

&& ((PG(last_error_lineno) != (int)error_lineno)

|| strcmp(PG(last_error_file), error_filename)))) {

if (PG(last_error_file)) {

}

PG(last_error_lineno) = 0;

free(PG(last_error_file));

PG(last_error_file) = NULL;

44

display = 1;

display = 0;

} else {

} else {

天一博胜企业管理软件V1.0 源代码

{

}

#if PHP_SIGCHILD

/* {{{ sigchld_handler

*/

static void sigchld_handler(int apar)

{

}

/* }}} */

#endif

/* {{{ php_start_sapi()

*/

static int php_start_sapi(TSRMLS_D)

{

int retval = SUCCESS;

if(!SG(sapi_started)) {

zend_try {

PG(during_request_startup) = 1;

/* initialize global variables */

PG(modules_activated) = 0;

PG(header_is_being_sent) = 0;

PG(connection_status) = PHP_CONNECTION_NORMAL;

zend_activate(TSRMLS_C);

zend_set_timeout(EG(timeout_seconds));

zend_activate_modules(TSRMLS_C);

PG(modules_activated)=1;

retval = FAILURE;

while (waitpid(-1, NULL, WNOHANG) > 0);

signal(SIGCHLD, sigchld_handler);

PG(connection_status) |= PHP_CONNECTION_TIMEOUT;

zend_set_timeout(EG(timeout_seconds));

}

}

break;

/* for the sake of BC to old damaged code */

break;

case E_STRICT:

45

case E_NOTICE:

case E_USER_NOTICE:

/* notices are no errors and are not treated as such like E_WARNINGS */

break;

/* throw an exception if we are in EH_THROW mode

* but DO NOT overwrite a pending exception

*/

if (PG(error_handling) == EH_THROW && !EG(exception)) {

}

efree(buffer);

return;

zend_throw_error_exception(PG(exception_class), buffer, 0, type TSRMLS_CC);

default:

void php_on_timeout(int seconds TSRMLS_DC)

} zend_catch {

天一博胜企业管理软件V1.0 源代码

}

/* }}} */

/* {{{ php_request_startup

*/

#ifndef APACHE_HOOKS

int php_request_startup(TSRMLS_D)

{

int retval = SUCCESS;

PG(com_initialized) = 0;

#ifdef PHP_WIN32

#endif

#if PHP_SIGCHILD

signal(SIGCHLD, sigchld_handler);

zend_try {

PG(during_request_startup) = 1;

php_output_activate(TSRMLS_C);

/* initialize global variables */

PG(modules_activated) = 0;

PG(header_is_being_sent) = 0;

PG(connection_status) = PHP_CONNECTION_NORMAL;

PG(in_user_include) = 0;

zend_activate(TSRMLS_C);

sapi_activate(TSRMLS_C);

if (PG(max_input_time) == -1) {

}

/* Disable realpath cache if safe_mode or open_basedir are set */

if (PG(safe_mode) || (PG(open_basedir) && *PG(open_basedir))) {

}

if (PG(expose_php)) {

}

if (PG(output_handler) && PG(output_handler)[0]) {

}

/* We turn this off in php_execute_script() */

php_start_ob_buffer_named(PG(output_handler), 0, 1 TSRMLS_CC);

if (PG(output_buffering)>1) {

}

php_start_implicit_flush(TSRMLS_C);

php_start_ob_buffer(NULL, PG(output_buffering), 1 TSRMLS_CC);

php_start_ob_buffer(NULL, 0, 1 TSRMLS_CC);

} else {

} else if (PG(output_buffering)) {

sapi_add_header(SAPI_PHP_VERSION_HEADER, sizeof(SAPI_PHP_VERSION_HEADER)-1, 1);

CWDG(realpath_cache_size_limit) = 0;

zend_set_timeout(EG(timeout_seconds));

zend_set_timeout(PG(max_input_time));

} else {

#endif

}

return retval;

} zend_end_try();

SG(sapi_started) = 1;

46

} else if (PG(implicit_flush)) {

天一博胜企业管理软件V1.0 源代码

}

# else

int php_request_startup(TSRMLS_D)

{

}

# endif

/* }}} */

/* {{{ php_request_startup_for_hook

*/

int php_request_startup_for_hook(TSRMLS_D)

{

}

int retval = SUCCESS;

signal(SIGCHLD, sigchld_handler);

if (php_start_sapi(TSRMLS_C) == FAILURE) {

}

php_output_activate(TSRMLS_C);

sapi_activate_headers_only(TSRMLS_C);

php_hash_environment(TSRMLS_C);

return retval;

return FAILURE;

#if PHP_SIGCHLD

#endif

int retval = SUCCESS;

signal(SIGCHLD, sigchld_handler);

if (php_start_sapi() == FAILURE) {

}

php_output_activate(TSRMLS_C);

sapi_activate(TSRMLS_C);

php_hash_environment(TSRMLS_C);

zend_try {

PG(during_request_startup) = 1;

php_output_activate(TSRMLS_C);

if (PG(expose_php)) {

}

retval = FAILURE;

sapi_add_header(SAPI_PHP_VERSION_HEADER, sizeof(SAPI_PHP_VERSION_HEADER)-1, 1);

return FAILURE;

#if PHP_SIGCHILD

#endif

/* PG(during_request_startup) = 0; */

php_hash_environment(TSRMLS_C);

zend_activate_modules(TSRMLS_C);

PG(modules_activated)=1;

retval = FAILURE;

47

} zend_catch {

} zend_end_try();

SG(sapi_started) = 1;

return retval;

} zend_catch {

} zend_end_try();

return retval;

天一博胜企业管理软件V1.0 源代码

/* }}} */

/* {{{ php_request_shutdown_for_exec

*/

void php_request_shutdown_for_exec(void *dummy)

{

}

/* }}} */

/* {{{ php_request_shutdown_for_hook

*/

void php_request_shutdown_for_hook(void *dummy)

{

}

/* }}} */

/* {{{ php_request_shutdown

*/

void php_request_shutdown(void *dummy)

{

zend_bool report_memleaks;

TSRMLS_FETCH();

TSRMLS_FETCH();

if (PG(modules_activated)) zend_try {

php_call_shutdown_functions(TSRMLS_C);

} zend_end_try();

if (PG(modules_activated)) {

}

zend_try {

int i;

for (i = 0; i < NUM_TRACK_VARS; i++) {

}

if (PG(http_globals)[i]) {

}

zval_ptr_dtor(&PG(http_globals)[i]);

zend_deactivate_modules(TSRMLS_C);

php_free_shutdown_functions(TSRMLS_C);

TSRMLS_FETCH();

/* used to close fd's in the 3..255 range here, but it's problematic

*/

shutdown_memory_manager(1, 1 TSRMLS_CC);

48

} zend_end_try();

zend_deactivate(TSRMLS_C);

zend_try {

sapi_deactivate(TSRMLS_C);

} zend_end_try();

zend_try {

php_shutdown_stream_hashes(TSRMLS_C);

} zend_end_try();

zend_try {

shutdown_memory_manager(CG(unclean_shutdown), 0 TSRMLS_CC);

} zend_end_try();

zend_try {

zend_unset_timeout(TSRMLS_C);

} zend_end_try();

天一博胜企业管理软件V1.0 源代码

report_memleaks = PG(report_memleaks);

/* EG(opline_ptr) points into nirvana and therefore cannot be safely accessed

* inside zend_executor callback functions.

*/

EG(opline_ptr) = NULL;

EG(active_op_array) = NULL;

/* 1. Call all possible shutdown functions registered with register_shutdown_function() */

if (PG(modules_activated)) zend_try {

php_call_shutdown_functions(TSRMLS_C);

} zend_end_try();

/* 2. Call all possible __destruct() functions */

zend_try {

zend_call_destructors(TSRMLS_C);

} zend_end_try();

/* 3. Flush all output buffers */

zend_try {

php_end_ob_buffers((zend_bool)(SG(request_info).headers_only?0:1) TSRMLS_CC);

} zend_end_try();

/* 4. Send the set HTTP headers (note: This must be done AFTER php_end_ob_buffers() !!) */

zend_try {

sapi_send_headers(TSRMLS_C);

} zend_end_try();

/* 5. Call all extensions RSHUTDOWN functions */

if (PG(modules_activated)) {

}

/* 6. Destroy super-globals */

zend_try {

int i;

for (i=0; i

}

if (PG(http_globals)[i]) {

}

zval_ptr_dtor(&PG(http_globals)[i]);

zend_deactivate_modules(TSRMLS_C);

php_free_shutdown_functions(TSRMLS_C);

49

} zend_end_try();

/* 6.5 free last error information */

if (PG(last_error_message)) {

}

if (PG(last_error_file)) {

}

/* 7. Shutdown scanner/executor/compiler and restore ini entries */

zend_deactivate(TSRMLS_C);

/* 8. Call all extensions post-RSHUTDOWN functions */

zend_try {

zend_post_deactivate_modules(TSRMLS_C);

} zend_end_try();

/* 9. SAPI related shutdown (free stuff) */

free(PG(last_error_file));

PG(last_error_file) = NULL;

free(PG(last_error_message));

PG(last_error_message) = NULL;

天一博胜企业管理软件V1.0 源代码

}

/* }}} */

/* {{{ php_com_initialize

*/

PHPAPI void php_com_initialize(TSRMLS_D)

{

#ifdef PHP_WIN32

}

/* }}} */

/* {{{ php_body_write_wrapper

*/

static int php_body_write_wrapper(const char *str, uint str_length)

{

}

/* }}} */

#ifdef ZTS

/* {{{ core_globals_ctor

*/

static void core_globals_ctor(php_core_globals *core_globals TSRMLS_DC)

{

}

/* }}} */

#endif

memset(core_globals, 0, sizeof(*core_globals));

TSRMLS_FETCH();

return php_body_write(str, str_length TSRMLS_CC);

if (!PG(com_initialized)) {

}

CoInitialize(NULL);

PG(com_initialized) = 1;

zend_try {

sapi_deactivate(TSRMLS_C);

} zend_end_try();

/* 10. Destroy stream hashes */

zend_try {

php_shutdown_stream_hashes(TSRMLS_C);

} zend_end_try();

/* 11. Free Willy (here be crashes) */

zend_try {

shutdown_memory_manager(CG(unclean_shutdown) || !report_memleaks, 0 TSRMLS_CC);

} zend_end_try();

/* 12. Reset max_execution_time */

zend_try {

zend_unset_timeout(TSRMLS_C);

} zend_end_try();

if (PG(com_initialized)) {

}

CoUninitialize();

PG(com_initialized) = 0;

50

#ifdef PHP_WIN32

#endif

#endif

天一博胜企业管理软件V1.0 源代码

/* {{{ core_globals_dtor

*/

static void core_globals_dtor(php_core_globals *core_globals TSRMLS_DC)

{

}

/* }}} */

/* {{{ php_register_extensions

*/

int php_register_extensions(zend_module_entry **ptr, int count TSRMLS_DC)

{

}

/* }}} */

#if defined(PHP_WIN32) && defined(_MSC_VER) && (_MSC_VER >= 1400)

static _invalid_parameter_handler old_invalid_parameter_handler;

void dummy_invalid_parameter_handler(

{

static int called = 0;

char buf[1024];

int len;

if (!called) {

called = 1;

if (function) {

if (file) {

const wchar_t *expression,

const wchar_t *function,

const wchar_t *file,

unsigned int line,

uintptr_t pEwserved)

zend_module_entry **end = ptr + count;

while (ptr < end) {

}

return SUCCESS;

if (*ptr) {

}

ptr++;

if (zend_register_internal_module(*ptr TSRMLS_CC)==NULL) {

}

return FAILURE;

if (core_globals->last_error_message) {

}

if (core_globals->last_error_file) {

}

if (core_globals->disable_functions) {

}

if (core_globals->disable_classes) {

}

free(core_globals->disable_classes);

free(core_globals->disable_functions);

free(core_globals->last_error_file);

free(core_globals->last_error_message);

51

len = _snprintf(buf, sizeof(buf)-1, "Invalid parameter detected in CRT function '%ws' (%ws:%d)", function,

file, line);

天一博胜企业管理软件V1.0 源代码

}

#endif

/* {{{ php_module_startup

*/

int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_modules, uint num_additional_modules)

{

zend_utility_functions zuf;

zend_utility_values zuv;

int module_number=0; /* for REGISTER_INI_ENTRIES() */

char *php_os;

zend_executor_globals *executor_globals;

void ***tsrm_ls;

php_core_globals *core_globals;

}

}

zend_error(E_WARNING, "%s", buf);

called = 0;

} else {

}

len = _snprintf(buf, sizeof(buf)-1, "Invalid CRT parameters detected");

len = _snprintf(buf, sizeof(buf)-1, "Invalid parameter detected in CRT function '%ws'", function);

52

} else {

#ifdef ZTS

#endif

#if defined(PHP_WIN32) || (defined(NETWARE) && defined(USE_WINSOCK))

WORD wVersionRequested = MAKEWORD(2, 0);

WSADATA wsaData;

#endif

#ifdef PHP_WIN32

#else

php_os=PHP_OS;

#endif

#ifdef ZTS

tsrm_ls = ts_resource(0);

module_shutdown = 0;

#endif

{

}

old_invalid_parameter_handler =

}

_set_invalid_parameter_handler(dummy_invalid_parameter_handler);

_set_invalid_parameter_handler(old_invalid_parameter_handler);

if (old_invalid_parameter_handler != NULL) {

DWORD dwVersion = GetVersion();

/* Get build numbers for Windows NT or Win95 */

if (dwVersion < 0x80000000){

}

php_os="WINNT";

php_os="WIN32";

} else {

#if defined(_MSC_VER) && (_MSC_VER >= 1400)

#endif

天一博胜企业管理软件V1.0 源代码

module_startup = 1;

sapi_initialize_empty_request(TSRMLS_C);

sapi_activate(TSRMLS_C);

if (module_initialized) {

return SUCCESS;

}

sapi_module = *sf;

php_output_startup();

_function = php_error_cb;

_function = php_printf;

_function = php_body_write_wrapper;

_function = php_fopen_wrapper_for_zend;

e_handler = php_message_handler_for_zend;

_interruptions = sapi__interruptions;

k_interruptions = sapi_k_interruptions;

_configuration_directive = php_get_configuration_directive_for_zend;

_function = php_run_ticks;

_timeout = php_on_timeout;

_open_function = php_stream_open_for_zend;

ntf_function = vspprintf;

_function = sapi_getenv;

zend_startup(&zuf, NULL, 1);

#ifdef ZTS

executor_globals = ts_resource(executor_globals_id);

ts_allocate_id(&core_globals_id, sizeof(php_core_globals), (ts_allocate_ctor) core_globals_ctor,

core_globals_dtor);

core_globals = ts_resource(core_globals_id);

#ifdef PHP_WIN32

ts_allocate_id(&php_win32_core_globals_id, sizeof(php_win32_core_globals),

php_win32_core_globals_ctor, (ts_allocate_dtor) php_win32_core_globals_dtor);

#endif

#endif

EG(bailout) = NULL;

EG(error_reporting) = E_ALL & ~E_NOTICE;

PG(header_is_being_sent) = 0;

SG(request_info).headers_only = 0;

SG(request_info).argv0 = NULL;

SG(request_info).argc=0;

SG(request_info).argv=(char **)NULL;

PG(connection_status) = PHP_CONNECTION_NORMAL;

PG(during_request_startup) = 0;

PG(last_error_message) = NULL;

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, "");

zend_update_current_locale();

#endif

#if HAVE_TZSET

53

(ts_allocate_dtor)

(ts_allocate_ctor)

天一博胜企业管理软件V1.0 源代码

tzset();

#endif

#if defined(PHP_WIN32) || (defined(NETWARE) && defined(USE_WINSOCK))

/* start up winsock services */

if (WSAStartup(wVersionRequested, &wsaData) != 0) {

}

le_index_ptr = zend_register_list_destructors_ex(NULL, NULL, "index pointer", 0);

/* this will read in , set up the configuration parameters,

load zend extensions and register php function extensions

to be loaded later */

if (php_init_config(TSRMLS_C) == FAILURE) {

}

/* Register PHP core ini entries */

REGISTER_INI_ENTRIES();

/* Register Zend ini entries */

zend_register_standard_ini_entries(TSRMLS_C);

/* Disable realpath cache if safe_mode or open_basedir are set */

if (PG(safe_mode) || (PG(open_basedir) && *PG(open_basedir))) {

}

if (php_init_stream_wrappers(module_number TSRMLS_CC) == FAILURE)

}

/* initialize registry for images to be used in phpinfo()

(this uses configuration parameters from )

*/

if (php_init_info_logos() == FAILURE) {

}

_errors = 1;

_use_extension = ".php";

php_startup_auto_globals(TSRMLS_C);

zend_set_utility_values(&zuv);

php_startup_sapi_content_types(TSRMLS_C);

REGISTER_MAIN_STRINGL_CONSTANT("PHP_VERSION", PHP_VERSION,

php_printf("PHP: Unable to initialize info phpinfo logos.n");

return FAILURE;

php_printf("PHP: Unable to initialize stream url wrappers.n");

return FAILURE;

{

CWDG(realpath_cache_size_limit) = 0;

return FAILURE;

php_printf(" unusable. %dn", WSAGetLastError());

return FAILURE;

54

#endif

sizeof(PHP_VERSION)-1,

CONST_PERSISTENT | CONST_CS);

REGISTER_MAIN_STRINGL_CONSTANT("PHP_OS", php_os, strlen(php_os), CONST_PERSISTENT | CONST_CS);

REGISTER_MAIN_STRINGL_CONSTANT("PHP_SAPI", sapi_, strlen(sapi_),

PHP_INCLUDE_PATH,

PEAR_INSTALLDIR,

PHP_EXTENSION_DIR,

PHP_EXTENSION_DIR,

CONST_PERSISTENT | CONST_CS);

REGISTER_MAIN_STRINGL_CONSTANT("DEFAULT_INCLUDE_PATH",

REGISTER_MAIN_STRINGL_CONSTANT("PEAR_INSTALL_DIR",

REGISTER_MAIN_STRINGL_CONSTANT("PEAR_EXTENSION_DIR",

REGISTER_MAIN_STRINGL_CONSTANT("PHP_EXTENSION_DIR",

sizeof(PHP_INCLUDE_PATH)-1, CONST_PERSISTENT | CONST_CS);

sizeof(PEAR_INSTALLDIR)-1, CONST_PERSISTENT | CONST_CS);

sizeof(PHP_EXTENSION_DIR)-1, CONST_PERSISTENT | CONST_CS);

天一博胜企业管理软件V1.0 源代码

sizeof(PHP_EXTENSION_DIR)-1, CONST_PERSISTENT | CONST_CS);

}

void php_module_shutdown_for_exec(void)

REGISTER_MAIN_STRINGL_CONSTANT("PHP_PREFIX",

REGISTER_MAIN_STRINGL_CONSTANT("PHP_BINDIR",

REGISTER_MAIN_STRINGL_CONSTANT("PHP_LIBDIR",

REGISTER_MAIN_STRINGL_CONSTANT("PHP_DATADIR",

PHP_PREFIX,

PHP_BINDIR,

PHP_LIBDIR,

PHP_DATADIR,

55

sizeof(PHP_PREFIX)-1,

sizeof(PHP_BINDIR)-1,

sizeof(PHP_LIBDIR)-1,

sizeof(PHP_DATADIR)-1,

CONST_PERSISTENT | CONST_CS);

CONST_PERSISTENT | CONST_CS);

CONST_PERSISTENT | CONST_CS);

CONST_PERSISTENT | CONST_CS);

REGISTER_MAIN_STRINGL_CONSTANT("PHP_SYSCONFDIR", PHP_SYSCONFDIR, sizeof(PHP_SYSCONFDIR)-1,

REGISTER_MAIN_STRINGL_CONSTANT("PHP_LOCALSTATEDIR",

REGISTER_MAIN_STRINGL_CONSTANT("PHP_CONFIG_FILE_PATH",

REGISTER_MAIN_STRINGL_CONSTANT("PHP_CONFIG_FILE_SCAN_DIR",

REGISTER_MAIN_STRINGL_CONSTANT("PHP_SHLIB_SUFFIX",

PHP_LOCALSTATEDIR,

PHP_CONFIG_FILE_PATH,

PHP_CONFIG_FILE_SCAN_DIR,

PHP_SHLIB_SUFFIX,

CONST_PERSISTENT | CONST_CS);

sizeof(PHP_LOCALSTATEDIR)-1, CONST_PERSISTENT | CONST_CS);

strlen(PHP_CONFIG_FILE_PATH), CONST_PERSISTENT | CONST_CS);

sizeof(PHP_CONFIG_FILE_SCAN_DIR)-1, CONST_PERSISTENT | CONST_CS);

sizeof(PHP_SHLIB_SUFFIX)-1, CONST_PERSISTENT | CONST_CS);

REGISTER_MAIN_STRINGL_CONSTANT("PHP_EOL", PHP_EOL, sizeof(PHP_EOL)-1, CONST_PERSISTENT |

REGISTER_MAIN_LONG_CONSTANT("PHP_INT_MAX", LONG_MAX, CONST_PERSISTENT | CONST_CS);

REGISTER_MAIN_LONG_CONSTANT("PHP_INT_SIZE", sizeof(long), CONST_PERSISTENT | CONST_CS);

php_output_register_constants(TSRMLS_C);

php_rfc1867_register_constants(TSRMLS_C);

if (php_startup_ticks(TSRMLS_C) == FAILURE) {

}

zend_register_default_classes(TSRMLS_C);

if (php_register_internal_extensions(TSRMLS_C) == FAILURE) {

}

php_register_extensions(&additional_modules, num_additional_modules TSRMLS_CC);

php_ini_register_extensions(TSRMLS_C);

zend_startup_modules(TSRMLS_C);

php_disable_functions(TSRMLS_C);

php_disable_classes(TSRMLS_C);

/* start Zend extensions */

zend_startup_extensions();

zend_post_startup(TSRMLS_C);

module_initialized = 1;

sapi_deactivate(TSRMLS_C);

module_startup = 0;

shutdown_memory_manager(1, 0 TSRMLS_CC);

/* we're done */

return SUCCESS;

php_printf("Unable to start builtin modulesn");

return FAILURE;

php_printf("Unable to start PHP ticksn");

return FAILURE;

CONST_CS);

#ifdef ZTS

#endif

天一博胜企业管理软件V1.0 源代码

{

}

int php_module_shutdown_wrapper(sapi_module_struct *sapi_globals)

{

}

void php_module_shutdown(TSRMLS_D)

{

int module_number=0; /* for UNREGISTER_INI_ENTRIES() */

module_shutdown = 1;

if (!module_initialized) {

}

ts_free_worker_threads();

return;

TSRMLS_FETCH();

php_module_shutdown(TSRMLS_C);

return SUCCESS;

/* used to close fd's in the range 3.255 here, but it's problematic */

56

#ifdef ZTS

#endif

#if defined(PHP_WIN32) || (defined(NETWARE) && defined(USE_WINSOCK))

#else

}

PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC)

{

zend_file_handle *prepend_file_p, *append_file_p;

zend_file_handle prepend_file = {0}, append_file = {0};

int old_cwd_fd = -1;

zend_ini_global_shutdown(TSRMLS_C);

ts_free_id(core_globals_id);

php_shutdown_temporary_directory();

module_initialized = 0;

if (old_invalid_parameter_handler == NULL) {

}

_set_invalid_parameter_handler(old_invalid_parameter_handler);

/*close winsock */

WSACleanup();

php_shutdown_ticks(TSRMLS_C);

sapi_flush(TSRMLS_C);

zend_shutdown(TSRMLS_C);

php_shutdown_stream_wrappers(module_number TSRMLS_CC);

php_shutdown_info_logos();

UNREGISTER_INI_ENTRIES();

php_shutdown_config();

zend_ini_shutdown(TSRMLS_C);

shutdown_memory_manager(CG(unclean_shutdown), 1 TSRMLS_CC);

core_globals_dtor(&core_globals TSRMLS_CC);

#endif

#ifndef ZTS

#endif

#if defined(PHP_WIN32) && defined(_MSC_VER) && (_MSC_VER >= 1400)

#endif

#if HAVE_BROKEN_GETCWD

天一博胜企业管理软件V1.0 源代码

#else

char *old_cwd;

int retval = 0;

EG(exit_status) = 0;

if (php_handle_special_queries(TSRMLS_C)) {

}

zend_file_handle_dtor(primary_file);

return 0;

#endif

57

#ifndef HAVE_BROKEN_GETCWD

# define OLD_CWD_SIZE 4096

old_cwd = do_alloca(OLD_CWD_SIZE);

old_cwd[0] = '0';

zend_try {

char realfile[MAXPATHLEN];

UpdateIniFromRegistry(primary_file->filename TSRMLS_CC);

PG(during_request_startup) = 0;

if ((primary_file->type == ZEND_HANDLE_FILENAME || primary_file->type == ZEND_HANDLE_STREAM) &&

#endif

#ifdef PHP_WIN32

#endif

primary_file->filename) {

#if HAVE_BROKEN_GETCWD

#else

}

if (primary_file->filename &&

) {

}

if (PG(auto_prepend_file) && PG(auto_prepend_file)[0]) {

}

if (PG(auto_append_file) && PG(auto_append_file)[0]) {

prepend_me = PG(auto_prepend_file);

prepend__path = NULL;

prepend__filename = 0;

prepend_ = ZEND_HANDLE_FILENAME;

prepend_file_p = &prepend_file;

prepend_file_p = NULL;

int realfile_len;

int dummy = 1;

if (expand_filepath(primary_file->filename, realfile TSRMLS_CC)) {

}

realfile_len = strlen(realfile);

zend_hash_add(&EG(included_files), realfile, realfile_len+1, (void *)&dummy, sizeof(int), NULL);

primary_file->opened_path = estrndup(realfile, realfile_len);

primary_file->opened_path == NULL &&

primary_file->type != ZEND_HANDLE_FILENAME

VCWD_GETCWD(old_cwd, OLD_CWD_SIZE-1);

VCWD_CHDIR_FILE(primary_file->filename);

#endif

/* this looks nasty to me */

old_cwd_fd = open(".", 0);

} else {

天一博胜企业管理软件V1.0 源代码

#else

}

PHPAPI int php_execute_simple_script(zend_file_handle *primary_file, zval **ret TSRMLS_DC)

{

char *old_cwd;

EG(exit_status) = 0;

old_cwd = do_alloca(OLD_CWD_SIZE);

old_cwd[0] = '0';

zend_try {

UpdateIniFromRegistry(primary_file->filename TSRMLS_CC);

PG(during_request_startup) = 0;

if (primary_file->type == ZEND_HANDLE_FILENAME && primary_file->filename) {

}

zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, ret, 1, primary_file);

VCWD_GETCWD(old_cwd, OLD_CWD_SIZE-1);

VCWD_CHDIR_FILE(primary_file->filename);

if (old_cwd[0] != '0') {

}

free_alloca(old_cwd);

return retval;

VCWD_CHDIR(old_cwd);

}

if (PG(max_input_time) != -1) {

}

zend_unset_timeout(TSRMLS_C);

zend_set_timeout(INI_INT("max_execution_time"));

append_me = PG(auto_append_file);

append__path = NULL;

append__filename = 0;

append_ = ZEND_HANDLE_FILENAME;

append_file_p = &append_file;

append_file_p = NULL;

58

} else {

#ifdef PHP_WIN32

#endif

retval = (zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, NULL, 3, prepend_file_p, primary_file, append_file_p)

== SUCCESS);

} zend_end_try();

if (old_cwd_fd != -1) {

}

fchdir(old_cwd_fd);

close(old_cwd_fd);

#if HAVE_BROKEN_GETCWD

#endif

#define OLD_CWD_SIZE 4096

#ifdef PHP_WIN32

#endif

} zend_end_try();

if (old_cwd[0] != '0') {

}

free_alloca(old_cwd);

VCWD_CHDIR(old_cwd);

天一博胜企业管理软件V1.0 源代码

}

PHPAPI void php_handle_aborted_connection(void)

{

}

PHPAPI int php_handle_auth_data(const char *auth TSRMLS_DC)

{

}

PHPAPI int php_lint_script(zend_file_handle *file TSRMLS_DC)

{

zend_op_array *op_array;

int retval = FAILURE;

zend_try {

op_array = zend_compile_file(file, ZEND_INCLUDE TSRMLS_CC);

zend_destroy_file_handle(file TSRMLS_CC);

if (op_array) {

int ret = -1;

if (auth && auth[0] != '0' && strncmp(auth, "Basic ", 6) == 0) {

}

if (ret == -1) {

}

if (ret == -1 && auth && auth[0] != '0' && strncmp(auth, "Digest ", 7) == 0) {

}

if (ret == -1) {

}

return ret;

SG(request_info).auth_digest = NULL;

SG(request_info).auth_digest = estrdup(auth + 7);

ret = 0;

SG(request_info).auth_user = SG(request_info).auth_password = NULL;

SG(request_info).auth_digest = NULL;

} else {

char *pass;

char *user;

user = php_base64_decode(auth + 6, strlen(auth) - 6, NULL);

if (user) {

}

pass = strchr(user, ':');

if (pass) {

}

*pass++ = '0';

SG(request_info).auth_user = user;

SG(request_info).auth_password = estrdup(pass);

ret = 0;

efree(user);

TSRMLS_FETCH();

PG(connection_status) = PHP_CONNECTION_ABORTED;

php_output_set_status(0 TSRMLS_CC);

if (!PG(ignore_user_abort)) {

}

zend_bailout();

return EG(exit_status);

59

} else {

天一博胜企业管理软件V1.0 源代码

}

}

destroy_op_array(op_array TSRMLS_CC);

efree(op_array);

retval = SUCCESS;

60

} zend_end_try();

return retval;