/** * Runs the process * * @return void */ public function run() { // register shutdown handler register_shutdown_function(array(&$this, "shutdown")); // init globals to local var $globals = $this->globals; // set globals $_SERVER = $globals['server']; $_ENV = $globals['env']; $_REQUEST = $globals['request']; $_POST = $globals['post']; $_GET = $globals['get']; $_COOKIE = $globals['cookie']; $_FILES = $globals['files']; // check if http war post data is set if (isset($globals['httpRawPostData'])) { // set raw post data to be available in php://input stream and $HTTP_RAW_POST_DATA var appserver_set_raw_post_data($globals['httpRawPostData']); } // register uploaded files for thread process context internal hashmap foreach ($this->uploadedFiles as $uploadedFile) { appserver_register_file_upload($uploadedFile); } // change dir to be in real php process context chdir(dirname($this->scriptFilename)); // reset headers sent appserver_set_headers_sent(false); try { // start output buffering ob_start(); // require script filename require $this->scriptFilename; } catch (\Exception $e) { // process uncaught exceptions // todo: refactor this if pthreads can manage set_exception_handler. $this->lastError = array('message' => $e->getMessage(), 'type' => E_ERROR, 'file' => $e->getFile(), 'line' => $e->getLine()); } }
/** * Register's a file upload on internal php hash table for being able to use core functions * like move_uploaded_file or is_uploaded_file as usual. * * @param string $filename The filename to register * * @return bool */ public function registerFileUpload($filename) { return appserver_register_file_upload($filename); }
/** * Register's a file upload on internal php hash table for being able to use core functions * like move_uploaded_file or is_uploaded_file as usual. * * @param string $filename The filename to register * * @return bool */ public function registerFileUpload($filename) { // add filename to uploaded file array $this->uploadedFiles[] = $filename; // registers file upload in this context for php process without threading return appserver_register_file_upload($filename); }