Skip to content

$this->input->post() Broken Returned Data #4397

@mertdogan

Description

@mertdogan

I'm using codeigniter 3.0.4 . I've experienced a problem and created a test structure for describe it here like below:

function dene1(){
 $url = site_url('Giris/dene2');
 $myvars = '_search=true&nd=1453717819822&rows=42&page=1&sidx=&sord=asc&filters=%7B%22groupOp%22%3A%22AND%22%2C%22rules%22%3A%5B%7B%22field%22%3A%22HTH2%22%2C%22op%22%3A%22eq%22%2C%22data%22%3A%22%3E7.5%2B%3C10%22%7D%2C%7B%22field%22%3A%22ST1Y%22%2C%22op%22%3A%22cn%22%2C%22data%22%3A%22100%22%7D%2C%7B%22field%22%3A%22ST2Y%22%2C%22op%22%3A%22cn%22%2C%22data%22%3A%22%3E55%2B%3C100%22%7D%5D%7D';
 echo '<h3>MYVAR ORIGINAL:</h3><code>'.$myvars.'</code><hr/>';
 echo '<h3>MYVAR URLDECODED:</h3><code>'.urldecode($myvars).'</code><hr/>';

 $ch = curl_init( $url );
 curl_setopt( $ch, CURLOPT_POST, 1);
 curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars);
 curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
 curl_setopt( $ch, CURLOPT_HEADER, 0);
 curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);

 $response = curl_exec( $ch );
 echo '<h3>MYVAR $this->input->post() RESPONCE:</h3><code>'.$response.'</code>';
}

function dene2(){
 print_r($this->input->post());
}

This functions are in a controller.

When i visit site http://localhost:81/index.php/giris/dene1.html site; returned values like below:

MYVAR ORIGINAL:

_search=true&nd=1453717819822&rows=42&page=1&sidx=&sord=asc&filters=%7B%22groupOp%22%3A%22AND%22%2C%22rules%22%3A%5B%7B%22field%22%3A%22HTH2%22%2C%22op%22%3A%22eq%22%2C%22data%22%3A%22%3E7.5%2B%3C10%22%7D%2C%7B%22field%22%3A%22ST1Y%22%2C%22op%22%3A%22cn%22%2C%22data%22%3A%22100%22%7D%2C%7B%22field%22%3A%22ST2Y%22%2C%22op%22%3A%22cn%22%2C%22data%22%3A%22%3E55%2B%3C100%22%7D%5D%7D
MYVAR URLDECODED:

_search=true&nd=1453717819822&rows=42&page=1&sidx=&sord=asc&filters={"groupOp":"AND","rules":[{"field":"HTH2","op":"eq","data":">7.5+<10"},{"field":"ST1Y","op":"cn","data":"100"},{"field":"ST2Y","op":"cn","data":">55+<100"}]}
MYVAR $this->input->post() RESPONCE:

Array ( [_search] => true [nd] => 1453717819822 [rows] => 42 [page] => 1 [sidx] => [sord] => asc [filters] => {"groupOp":"AND","rules":[{"field":"HTH2","op":"eq","data":">7.5+<10>55+<100"}]} )

I want to describe these structure. I have defined myvars string for post data to another controller function. I shown urldecoded style of myvars variable for simple understanding. And shown output of $this->input->post() .

As you can see; post() function is brakes HTH2 field and removes ST2Y field. (These are coming from jqgrid).

When i use

$input=file_get_contents('php://input');
$_GET = array();
parse_str($input, $_GET);

structure for gater input data, everything works well but $this->input->post() brakes data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions