Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static size_t sapi_dp_ub_write(const char *str, size_t str_length) {
- }
- static int php_dp_startup(sapi_module_struct *sapi_module) {
- if (php_module_startup(sapi_module, NULL, 0) == FAILURE) {
- return FAILURE;
- }
- return SUCCESS;
- }
- static int sapi_dp_deactivate(void) {
- fflush(stdout);
- if(SG(request_info).argv0) {
- free(SG(request_info).argv0);
- SG(request_info).argv0 = NULL;
- }
- return SUCCESS;
- }
- static void sapi_dp_flush(void *server_context) {
- if (fflush(stdout)==EOF && errno!=EBADF) {
- #ifndef PHP_CLI_WIN32_NO_CONSOLE
- php_handle_aborted_connection();
- #endif
- }
- }
- static int sapi_dp_header_handler(sapi_header_struct *h, sapi_header_op_enum op, sapi_headers_struct *s) {
- return 0;
- }
- static void sapi_dp_log_message(char *message, int syslog_type_int) /* {{{ */
- {
- fprintf(stderr, "%s\n", message);
- #ifdef PHP_WIN32
- fflush(stderr);
- #endif
- }
- static void sapi_dp_register_variables(zval *track_vars_array) /* {{{ */
- {
- size_t len;
- char *docroot = "";
- /* In CGI mode, we consider the environment to be a part of the server
- * variables
- */
- php_import_environment_variables(track_vars_array);
- }
- static char* sapi_dp_read_cookies(void) /* {{{ */
- {
- return NULL;
- }
- static void sapi_dp_send_header(sapi_header_struct *sapi_header, void *server_context) /* {{{ */
- {
- }
- static int sapi_dp_send_headers(sapi_headers_struct *sapi_headers) /* {{{ */
- {
- /* We do nothing here, this function is needed to prevent that the fallback
- * header handling is called. */
- return SAPI_HEADER_SENT_SUCCESSFULLY;
- }
- static int php_cli_startup(sapi_module_struct *sapi_module)
- {
- return php_module_startup(sapi_module, NULL, 0) == FAILURE ? FAILURE : SUCCESS;
- }
- static sapi_module_struct dp_sapi_module = {
- "DPackager Loader",
- "DPackager Loader",
- php_dp_startup,
- php_module_shutdown_wrapper,
- NULL,
- sapi_dp_deactivate,
- sapi_dp_ub_write,
- sapi_dp_flush,
- NULL,
- NULL,
- php_error,
- sapi_dp_header_handler, /* header handler */
- sapi_dp_send_headers, /* send headers handler */
- sapi_dp_send_header, /* send header handler */
- NULL,
- sapi_dp_read_cookies,
- sapi_dp_register_variables, /* register server variables */
- sapi_dp_log_message, /* Log message */
- NULL, /* Get request time */
- NULL, /* Child terminate */
- STANDARD_SAPI_MODULE_PROPERTIES
- };
- ZEND_API int startupDPackagerSAPI(void) {
- sapi_module_struct *sapi_module = &dp_sapi_module;
- php_tsrm_startup();
- ZEND_TSRMLS_CACHE_UPDATE();
- zend_signal_startup();
- sapi_startup(sapi_module);
- sapi_module->startup(sapi_module);
- php_request_startup();
- zend_eval_string_ex("$a = 1+1;", NULL, (char *)"", 1 TSRMLS_CC);
- zend_ini_deactivate();
- php_module_shutdown();
- tsrm_shutdown();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement