PHP cut GET request param












-1














In my PHP application I use this code to get request



$this->request->get


this return all data



Array
(
[rt] => extension/dump
[type] => xls
[controller] => list/product
[s] => administration
[token] => s7KO9PkoPmgpQmZjPQOimTbdKMB85uGa
[filters] => {"_search":true,"nd":1542700897278,"rows":20,"page":1,"sidx":"date_modified","sord":"desc","filters":"{"groupOp":"AND","rules":[{"field":"name","op":"cn","data":"Lemon
[Eucalyptus"}]}"}] =>
)


However next code cut the data



$this->request->get['filters']


returned only part of data (see the end of 'filters' are removed)



{"_search":true,"nd":1542700897278,"rows":20,"page":1,"sidx":"date_modified","sord":"desc","filters":"
{"groupOp":"AND","rules":[{"field":"name","op":"cn","data":"Lemon


Is any workaround to get full data inside 'filters'?
Converting object to array is not help



UPDATE:
js console output



{_search: false, nd: 1542700894743, rows: 20, page: 1, sidx:    "date_modified", …}
filters: "{"groupOp":"AND","rules":[{"field":"name","op":"cn","data":"Lemon & Eucalyptus"}]}"
nd: 1542700897278
page: 1
rows: 20
sidx: "date_modified"
sord: "desc"
_search: true

Request URL: http://blablabla&filters={%22_search%22:true,%22nd%22:1542700897278,%22rows%22:20,%22page%22:1,%22sidx%22:%22date_modified%22,%22sord%22:%22desc%22,%22filters%22:%22{%22groupOp%22:%22AND%22,%22rules%22:[{%22field%22:%22name%22,%22op%22:%22cn%22,%22data%22:%22Lemon%20&%20Eucalyptus%22}]}%22}


Request Method: GET



Is it somehow related to ampersand?










share|improve this question
























  • Could you post the actual parameters copied and pasted from your browser's address bar please?
    – Scoots
    Nov 20 '18 at 8:32






  • 1




    Have you tried comparing $this->request->get and actual $_GET? Maybe it's your parser that fails?
    – Justinas
    Nov 20 '18 at 9:04










  • @Justinas , $_GET["filters"] return the same. Cut result to Lemon... last part is missing
    – S.M. Nat
    Nov 20 '18 at 9:15










  • Check your php.ini and tell if value of max_value_length does not exceeds your query string. Also note that query string starts with ? and not with &
    – Justinas
    Nov 20 '18 at 9:49






  • 1




    This really depends on how you're reading / displaying these results. It also seems very strange to have your request parameters HTML encoded. I suspect one or both of "you're viewing it incorrectly" and "something is manipulating the data in a bad way before you read it"
    – Phil
    Nov 21 '18 at 1:49
















-1














In my PHP application I use this code to get request



$this->request->get


this return all data



Array
(
[rt] => extension/dump
[type] => xls
[controller] => list/product
[s] => administration
[token] => s7KO9PkoPmgpQmZjPQOimTbdKMB85uGa
[filters] => {"_search":true,"nd":1542700897278,"rows":20,"page":1,"sidx":"date_modified","sord":"desc","filters":"{"groupOp":"AND","rules":[{"field":"name","op":"cn","data":"Lemon
[Eucalyptus"}]}"}] =>
)


However next code cut the data



$this->request->get['filters']


returned only part of data (see the end of 'filters' are removed)



{"_search":true,"nd":1542700897278,"rows":20,"page":1,"sidx":"date_modified","sord":"desc","filters":"
{"groupOp":"AND","rules":[{"field":"name","op":"cn","data":"Lemon


Is any workaround to get full data inside 'filters'?
Converting object to array is not help



UPDATE:
js console output



{_search: false, nd: 1542700894743, rows: 20, page: 1, sidx:    "date_modified", …}
filters: "{"groupOp":"AND","rules":[{"field":"name","op":"cn","data":"Lemon & Eucalyptus"}]}"
nd: 1542700897278
page: 1
rows: 20
sidx: "date_modified"
sord: "desc"
_search: true

Request URL: http://blablabla&filters={%22_search%22:true,%22nd%22:1542700897278,%22rows%22:20,%22page%22:1,%22sidx%22:%22date_modified%22,%22sord%22:%22desc%22,%22filters%22:%22{%22groupOp%22:%22AND%22,%22rules%22:[{%22field%22:%22name%22,%22op%22:%22cn%22,%22data%22:%22Lemon%20&%20Eucalyptus%22}]}%22}


Request Method: GET



Is it somehow related to ampersand?










share|improve this question
























  • Could you post the actual parameters copied and pasted from your browser's address bar please?
    – Scoots
    Nov 20 '18 at 8:32






  • 1




    Have you tried comparing $this->request->get and actual $_GET? Maybe it's your parser that fails?
    – Justinas
    Nov 20 '18 at 9:04










  • @Justinas , $_GET["filters"] return the same. Cut result to Lemon... last part is missing
    – S.M. Nat
    Nov 20 '18 at 9:15










  • Check your php.ini and tell if value of max_value_length does not exceeds your query string. Also note that query string starts with ? and not with &
    – Justinas
    Nov 20 '18 at 9:49






  • 1




    This really depends on how you're reading / displaying these results. It also seems very strange to have your request parameters HTML encoded. I suspect one or both of "you're viewing it incorrectly" and "something is manipulating the data in a bad way before you read it"
    – Phil
    Nov 21 '18 at 1:49














-1












-1








-1







In my PHP application I use this code to get request



$this->request->get


this return all data



Array
(
[rt] => extension/dump
[type] => xls
[controller] => list/product
[s] => administration
[token] => s7KO9PkoPmgpQmZjPQOimTbdKMB85uGa
[filters] => {"_search":true,"nd":1542700897278,"rows":20,"page":1,"sidx":"date_modified","sord":"desc","filters":"{"groupOp":"AND","rules":[{"field":"name","op":"cn","data":"Lemon
[Eucalyptus"}]}"}] =>
)


However next code cut the data



$this->request->get['filters']


returned only part of data (see the end of 'filters' are removed)



{"_search":true,"nd":1542700897278,"rows":20,"page":1,"sidx":"date_modified","sord":"desc","filters":"
{"groupOp":"AND","rules":[{"field":"name","op":"cn","data":"Lemon


Is any workaround to get full data inside 'filters'?
Converting object to array is not help



UPDATE:
js console output



{_search: false, nd: 1542700894743, rows: 20, page: 1, sidx:    "date_modified", …}
filters: "{"groupOp":"AND","rules":[{"field":"name","op":"cn","data":"Lemon & Eucalyptus"}]}"
nd: 1542700897278
page: 1
rows: 20
sidx: "date_modified"
sord: "desc"
_search: true

Request URL: http://blablabla&filters={%22_search%22:true,%22nd%22:1542700897278,%22rows%22:20,%22page%22:1,%22sidx%22:%22date_modified%22,%22sord%22:%22desc%22,%22filters%22:%22{%22groupOp%22:%22AND%22,%22rules%22:[{%22field%22:%22name%22,%22op%22:%22cn%22,%22data%22:%22Lemon%20&%20Eucalyptus%22}]}%22}


Request Method: GET



Is it somehow related to ampersand?










share|improve this question















In my PHP application I use this code to get request



$this->request->get


this return all data



Array
(
[rt] => extension/dump
[type] => xls
[controller] => list/product
[s] => administration
[token] => s7KO9PkoPmgpQmZjPQOimTbdKMB85uGa
[filters] => {"_search":true,"nd":1542700897278,"rows":20,"page":1,"sidx":"date_modified","sord":"desc","filters":"{"groupOp":"AND","rules":[{"field":"name","op":"cn","data":"Lemon
[Eucalyptus"}]}"}] =>
)


However next code cut the data



$this->request->get['filters']


returned only part of data (see the end of 'filters' are removed)



{"_search":true,"nd":1542700897278,"rows":20,"page":1,"sidx":"date_modified","sord":"desc","filters":"
{"groupOp":"AND","rules":[{"field":"name","op":"cn","data":"Lemon


Is any workaround to get full data inside 'filters'?
Converting object to array is not help



UPDATE:
js console output



{_search: false, nd: 1542700894743, rows: 20, page: 1, sidx:    "date_modified", …}
filters: "{"groupOp":"AND","rules":[{"field":"name","op":"cn","data":"Lemon & Eucalyptus"}]}"
nd: 1542700897278
page: 1
rows: 20
sidx: "date_modified"
sord: "desc"
_search: true

Request URL: http://blablabla&filters={%22_search%22:true,%22nd%22:1542700897278,%22rows%22:20,%22page%22:1,%22sidx%22:%22date_modified%22,%22sord%22:%22desc%22,%22filters%22:%22{%22groupOp%22:%22AND%22,%22rules%22:[{%22field%22:%22name%22,%22op%22:%22cn%22,%22data%22:%22Lemon%20&%20Eucalyptus%22}]}%22}


Request Method: GET



Is it somehow related to ampersand?







php arrays json object request






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 1:43

























asked Nov 20 '18 at 8:24









S.M. Nat

617




617












  • Could you post the actual parameters copied and pasted from your browser's address bar please?
    – Scoots
    Nov 20 '18 at 8:32






  • 1




    Have you tried comparing $this->request->get and actual $_GET? Maybe it's your parser that fails?
    – Justinas
    Nov 20 '18 at 9:04










  • @Justinas , $_GET["filters"] return the same. Cut result to Lemon... last part is missing
    – S.M. Nat
    Nov 20 '18 at 9:15










  • Check your php.ini and tell if value of max_value_length does not exceeds your query string. Also note that query string starts with ? and not with &
    – Justinas
    Nov 20 '18 at 9:49






  • 1




    This really depends on how you're reading / displaying these results. It also seems very strange to have your request parameters HTML encoded. I suspect one or both of "you're viewing it incorrectly" and "something is manipulating the data in a bad way before you read it"
    – Phil
    Nov 21 '18 at 1:49


















  • Could you post the actual parameters copied and pasted from your browser's address bar please?
    – Scoots
    Nov 20 '18 at 8:32






  • 1




    Have you tried comparing $this->request->get and actual $_GET? Maybe it's your parser that fails?
    – Justinas
    Nov 20 '18 at 9:04










  • @Justinas , $_GET["filters"] return the same. Cut result to Lemon... last part is missing
    – S.M. Nat
    Nov 20 '18 at 9:15










  • Check your php.ini and tell if value of max_value_length does not exceeds your query string. Also note that query string starts with ? and not with &
    – Justinas
    Nov 20 '18 at 9:49






  • 1




    This really depends on how you're reading / displaying these results. It also seems very strange to have your request parameters HTML encoded. I suspect one or both of "you're viewing it incorrectly" and "something is manipulating the data in a bad way before you read it"
    – Phil
    Nov 21 '18 at 1:49
















Could you post the actual parameters copied and pasted from your browser's address bar please?
– Scoots
Nov 20 '18 at 8:32




Could you post the actual parameters copied and pasted from your browser's address bar please?
– Scoots
Nov 20 '18 at 8:32




1




1




Have you tried comparing $this->request->get and actual $_GET? Maybe it's your parser that fails?
– Justinas
Nov 20 '18 at 9:04




Have you tried comparing $this->request->get and actual $_GET? Maybe it's your parser that fails?
– Justinas
Nov 20 '18 at 9:04












@Justinas , $_GET["filters"] return the same. Cut result to Lemon... last part is missing
– S.M. Nat
Nov 20 '18 at 9:15




@Justinas , $_GET["filters"] return the same. Cut result to Lemon... last part is missing
– S.M. Nat
Nov 20 '18 at 9:15












Check your php.ini and tell if value of max_value_length does not exceeds your query string. Also note that query string starts with ? and not with &
– Justinas
Nov 20 '18 at 9:49




Check your php.ini and tell if value of max_value_length does not exceeds your query string. Also note that query string starts with ? and not with &
– Justinas
Nov 20 '18 at 9:49




1




1




This really depends on how you're reading / displaying these results. It also seems very strange to have your request parameters HTML encoded. I suspect one or both of "you're viewing it incorrectly" and "something is manipulating the data in a bad way before you read it"
– Phil
Nov 21 '18 at 1:49




This really depends on how you're reading / displaying these results. It also seems very strange to have your request parameters HTML encoded. I suspect one or both of "you're viewing it incorrectly" and "something is manipulating the data in a bad way before you read it"
– Phil
Nov 21 '18 at 1:49












1 Answer
1






active

oldest

votes


















1














Assuming you're creating the URL and query parameters in JS, you need to encode all parameters for use in a URL.



In your case...






const filters = {
"groupOp": "AND",
"rules": [
{
"field": "name",
"op": "cn",
"data": "Lemon & Eucalyptus"
}
]
}

const url = `http://blablabla?filters=${encodeURIComponent(JSON.stringify(filters))}`

document.write(`<pre>${url}</pre>`)





Notice the & in "Lemon & Eucalyptus" has become %26





An extra concern is that something is HTML-encoding your request parameters. You should not be doing that unless you are specifically displaying the information in an HTML document.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53388872%2fphp-cut-get-request-param%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Assuming you're creating the URL and query parameters in JS, you need to encode all parameters for use in a URL.



    In your case...






    const filters = {
    "groupOp": "AND",
    "rules": [
    {
    "field": "name",
    "op": "cn",
    "data": "Lemon & Eucalyptus"
    }
    ]
    }

    const url = `http://blablabla?filters=${encodeURIComponent(JSON.stringify(filters))}`

    document.write(`<pre>${url}</pre>`)





    Notice the & in "Lemon & Eucalyptus" has become %26





    An extra concern is that something is HTML-encoding your request parameters. You should not be doing that unless you are specifically displaying the information in an HTML document.






    share|improve this answer


























      1














      Assuming you're creating the URL and query parameters in JS, you need to encode all parameters for use in a URL.



      In your case...






      const filters = {
      "groupOp": "AND",
      "rules": [
      {
      "field": "name",
      "op": "cn",
      "data": "Lemon & Eucalyptus"
      }
      ]
      }

      const url = `http://blablabla?filters=${encodeURIComponent(JSON.stringify(filters))}`

      document.write(`<pre>${url}</pre>`)





      Notice the & in "Lemon & Eucalyptus" has become %26





      An extra concern is that something is HTML-encoding your request parameters. You should not be doing that unless you are specifically displaying the information in an HTML document.






      share|improve this answer
























        1












        1








        1






        Assuming you're creating the URL and query parameters in JS, you need to encode all parameters for use in a URL.



        In your case...






        const filters = {
        "groupOp": "AND",
        "rules": [
        {
        "field": "name",
        "op": "cn",
        "data": "Lemon & Eucalyptus"
        }
        ]
        }

        const url = `http://blablabla?filters=${encodeURIComponent(JSON.stringify(filters))}`

        document.write(`<pre>${url}</pre>`)





        Notice the & in "Lemon & Eucalyptus" has become %26





        An extra concern is that something is HTML-encoding your request parameters. You should not be doing that unless you are specifically displaying the information in an HTML document.






        share|improve this answer












        Assuming you're creating the URL and query parameters in JS, you need to encode all parameters for use in a URL.



        In your case...






        const filters = {
        "groupOp": "AND",
        "rules": [
        {
        "field": "name",
        "op": "cn",
        "data": "Lemon & Eucalyptus"
        }
        ]
        }

        const url = `http://blablabla?filters=${encodeURIComponent(JSON.stringify(filters))}`

        document.write(`<pre>${url}</pre>`)





        Notice the & in "Lemon & Eucalyptus" has become %26





        An extra concern is that something is HTML-encoding your request parameters. You should not be doing that unless you are specifically displaying the information in an HTML document.






        const filters = {
        "groupOp": "AND",
        "rules": [
        {
        "field": "name",
        "op": "cn",
        "data": "Lemon & Eucalyptus"
        }
        ]
        }

        const url = `http://blablabla?filters=${encodeURIComponent(JSON.stringify(filters))}`

        document.write(`<pre>${url}</pre>`)





        const filters = {
        "groupOp": "AND",
        "rules": [
        {
        "field": "name",
        "op": "cn",
        "data": "Lemon & Eucalyptus"
        }
        ]
        }

        const url = `http://blablabla?filters=${encodeURIComponent(JSON.stringify(filters))}`

        document.write(`<pre>${url}</pre>`)






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 21 '18 at 1:58









        Phil

        95.7k11136155




        95.7k11136155






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53388872%2fphp-cut-get-request-param%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

            Alcedinidae

            RAC Tourist Trophy