Skip to content

Commit

Permalink
セッション関連の設定が正しく反映されない不具合を修正。(2)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomk79 committed Nov 2, 2022
1 parent ecd14fe commit 35f28c1
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions php/px.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,24 +208,21 @@ public function __construct( $path_homedir ){
$this->bowl = new bowl();

// Apply command-line option "--command-php"
// make instance $req
$req_conf = new \stdClass;
$req_conf->session_name = $this->conf->session_name;
$req_conf->session_expire = $this->conf->session_expire;
$req_conf->directory_index_primary = $this->get_directory_index_primary();
$this->req = new \tomk79\request( $req_conf );

if( strlen(''.$this->req->get_cli_option( '--command-php' )) ){
$this->conf->commands->php = $this->req->get_cli_option( '--command-php' );
$temporary_req = new \tomk79\request( $req_conf );
if( strlen(''.$temporary_req->get_cli_option( '--command-php' )) ){
$this->conf->commands->php = $temporary_req->get_cli_option( '--command-php' );
}
if( strlen(''.$this->req->get_cli_option( '-c' )) ){
$this->conf->path_phpini = $this->req->get_cli_option( '-c' );
if( strlen(''.$temporary_req->get_cli_option( '-c' )) ){
$this->conf->path_phpini = $temporary_req->get_cli_option( '-c' );
}
if( strlen(''.$this->req->get_cli_option( '--method' )) ){
$_SERVER['REQUEST_METHOD'] = strtoupper($this->req->get_cli_option( '--method' ));
if( strlen(''.$temporary_req->get_cli_option( '--method' )) ){
$_SERVER['REQUEST_METHOD'] = strtoupper($temporary_req->get_cli_option( '--method' ));
}
if( strtoupper($_SERVER['REQUEST_METHOD']) == "POST" ){
$tmp_body_file = $this->req->get_cli_option( '--body-file' );
$tmp_body_file = $temporary_req->get_cli_option( '--body-file' );
if( strlen(''.$tmp_body_file) ){
// ファイルからPOSTパラメータを読み取る
if( is_file($this->realpath_homedir.'/_sys/ram/data/'.$tmp_body_file) ){
Expand All @@ -235,15 +232,12 @@ public function __construct( $path_homedir ){
// なければ、絶対パスとして探す
parse_str(file_get_contents( $tmp_body_file ), $_POST);
}
}elseif( strlen(''.$this->req->get_cli_option( '--body' )) ){
}elseif( strlen(''.$temporary_req->get_cli_option( '--body' )) ){
// POSTパラメータを直接受け取る
parse_str($this->req->get_cli_option( '--body' ), $_POST);
parse_str($temporary_req->get_cli_option( '--body' ), $_POST);
}
unset($tmp_body_file);
}
if( strlen(''.$this->req->get_cli_option( '-u' )) ){
$_SERVER['HTTP_USER_AGENT'] = @$this->req->get_cli_option( '-u' );
}

// make instance $fs
$fs_conf = new \stdClass;
Expand All @@ -254,6 +248,15 @@ public function __construct( $path_homedir ){
$this->realpath_homedir = $this->fs()->get_realpath($this->realpath_homedir.'/');
$this->realpath_homedir = $this->fs()->normalize_path($this->realpath_homedir);

// make instance $req
$req_conf = new \stdClass;
$req_conf->session_name = $this->conf->session_name;
$req_conf->session_expire = $this->conf->session_expire;
$req_conf->directory_index_primary = $this->get_directory_index_primary();
$this->req = new \tomk79\request( $req_conf );
if( strlen(''.$this->req->get_cli_option( '-u' )) ){
$_SERVER['HTTP_USER_AGENT'] = @$this->req->get_cli_option( '-u' );
}
if(!count($_GET)){
$tmp_cli_params = $this->req->get_cli_params();
if( count($tmp_cli_params) ){
Expand Down

0 comments on commit 35f28c1

Please sign in to comment.