天一博胜企业管理软件V1.0 源代码
41
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; }
/* }}} */
/* {{{ PHP_INI_MH */
static PHP_INI_MH(OnChangeMailForceExtra) { /* Don't allow changing it in htaccess */ if (stage == PHP_INI_STAGE_HTACCESS) { return FAILURE; } return SUCCESS; }
static int php_stream_open_for_zend(const char *filename, zend_file_handle *handle TSRMLS_DC) /* {{{ */ { return php_stream_open_for_zend_ex(filename, handle, ENFORCE_SAFE_MODE|USE_PATH|REPORT_ERRORS|STREAM_OPEN_FOR_INCLUDE TSRMLS_CC); }
/* }}} */
PHPAPI int php_stream_open_for_zend_ex(const char *filename, zend_file_handle *handle, int mode TSRMLS_DC) /* {{{ */ { php_stream *stream; stream = php_stream_open_wrapper((char *)filename, \ if (stream) { handle->type = ZEND_HANDLE_STREAM; handle->filename = (char*)filename; handle->free_filename = 0; handle->handle.stream.handle = stream; handle->handle.stream.reader = (zend_stream_reader_t)_php_stream_read; handle->handle.stream.closer = stream_closer_for_zend; handle->handle.stream.fteller = stream_fteller_for_zend; handle->handle.stream.interactive = 0; /* suppress warning if this stream is not explicitly closed */ php_stream_auto_cleanup(stream); return SUCCESS; } return FAILURE; }
/* }}} */
/* {{{ php_get_configuration_directive_for_zend */
static int php_get_configuration_directive_for_zend(char *name, uint name_length, zval *contents)
天一博胜企业管理软件V1.0 源代码
42
{ zval *retval = cfg_get_entry(name, name_length); if (retval) { *contents = *retval; return SUCCESS; } else { return FAILURE; } }
/* }}} */
/* {{{ 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: php_error_docref(\TSRMLS_CC, E_WARNING, \opening '%s' for inclusion (include_path='%s')\ break; case ZMSG_FAILED_REQUIRE_FOPEN: php_error_docref(\TSRMLS_CC, E_COMPILE_ERROR, \opening required '%s' (include_path='%s')\ break; case ZMSG_FAILED_HIGHLIGHT_FOPEN: php_error_docref(NULL TSRMLS_CC, E_WARNING, \opening '%s' for highlighting\php_strip_url_passwd((char *) data)); break; case ZMSG_MEMORY_LEAK_DETECTED: case ZMSG_MEMORY_LEAK_REPEATED: #if ZEND_DEBUG if (EG(error_reporting) & E_WARNING) { char memory_leak_buf[1024]; if (message==ZMSG_MEMORY_LEAK_DETECTED) { zend_leak_info *t = (zend_leak_info *) data; snprintf(memory_leak_buf, 512, \: Freeing 0x%.8lX (%zu bytes), script=%s\\n\t->filename, t->lineno, (zend_uintptr_t)t->addr, t->size, SAFE_FILENAME(SG(request_info).path_translated)); if (t->orig_filename) { char relay_buf[512]; snprintf(relay_buf, 512, \: Actual location (location was relayed)\\n\t->orig_filename, t->orig_lineno); strlcat(memory_leak_buf, relay_buf, sizeof(memory_leak_buf)); } } else { unsigned long leak_count = (zend_uintptr_t) data; snprintf(memory_leak_buf, 512, \leak repeated %ld time%s\\n\leak_count, (leak_count>1?\ }
# if defined(PHP_WIN32) OutputDebugString(memory_leak_buf); # else
天一博胜企业管理软件V1.0 源代码
43
fprintf(stderr, \# endif } #endif break; case ZMSG_MEMORY_LEAKS_GRAND_TOTAL: #if ZEND_DEBUG if (EG(error_reporting) & E_WARNING) { char memory_leak_buf[512]; snprintf(memory_leak_buf, 512, \*) data));
# if defined(PHP_WIN32) OutputDebugString(memory_leak_buf); # else fprintf(stderr, \# endif } #endif break; case ZMSG_LOG_SCRIPT_NAME: { struct tm *ta, tmbuf; time_t curtime; 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 */ snprintf(memory_leak_buf, sizeof(memory_leak_buf), \ Script: '%s'\\n\datetime_str, SAFE_FILENAME(SG(request_info).path_translated)); } else { snprintf(memory_leak_buf, sizeof(memory_leak_buf), \ Script: '%s'\\n\SAFE_FILENAME(SG(request_info).path_translated)); }
# if defined(PHP_WIN32) OutputDebugString(memory_leak_buf); # else fprintf(stderr, \# endif } break; } }
/* }}} */
PHPAPI void php_error_docref2(const char *docref TSRMLS_DC, const char *param1, const char *param2, int type, const char *format, ...) { char *params; va_list args; spprintf(¶ms, 0, \ va_start(args, format);
天一博胜企业管理软件V1.0 源代码
44
php_verror(docref, params ? params : \ va_end(args); if (params) { efree(params); } }
/* }}} */
/* {{{ php_html_puts */
PHPAPI void php_html_puts(const char *str, uint size TSRMLS_DC) { zend_html_puts(str, size TSRMLS_CC); }
/* }}} */
/* {{{ 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; } if (PG(last_error_file)) { free(PG(last_error_file)); PG(last_error_file) = NULL; } PG(last_error_lineno) = 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)) { /* 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)))) { display = 1; } else { display = 0; } } else {
天一博胜企业管理软件V1.0 源代码
45
display = 1; } /* store the error if it has changed */ if (display) { if (PG(last_error_message)) { free(PG(last_error_message)); } if (PG(last_error_file)) { free(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; } /* 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 */ break; case E_STRICT: /* for the sake of BC to old damaged code */ break; case E_NOTICE: case E_USER_NOTICE: /* notices are no errors and are not treated as such like E_WARNINGS */ break; default: /* 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)) { zend_throw_error_exception(PG(exception_class), buffer, 0, type TSRMLS_CC); } efree(buffer); return; } }
void php_on_timeout(int seconds TSRMLS_DC) { PG(connection_status) |= PHP_CONNECTION_TIMEOUT; zend_set_timeout(EG(timeout_seconds)); }
#if PHP_SIGCHILD /* {{{ sigchld_handler */
static void sigchld_handler(int apar)