Announcement

Collapse
No announcement yet.

ini_set(), anyone else have problems

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ini_set(), anyone else have problems

    Whenever I use ini_set() in a script, it doesn't affect the script.

    For example, I use ini_set("magic_quotes_gpc", 0), it doesn't strip the slashes from anything.

  • #2
    Re: ini_set(), anyone else have problems

    Originally posted by GSHelpBoy
    Whenever I use ini_set() in a script, it doesn't affect the script.

    For example, I use ini_set("magic_quotes_gpc", 0), it doesn't strip the slashes from anything.
    Changing the magic_quotes_gpc setting inside a script doesn't really help... you will need to strip the slashes yourself, I'm afraid, or change magic_quotes_gpc in php.ini or using an .htaccess file.
    You can set_magic_quotes_runtime(), however, so PHP won't add slashes to data that is created inside the script.
    Chen Avinadav
    Better to remain silent and be thought a fool than to speak out and remove all doubt.

    גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

    Comment


    • #3
      What's up with this? I'm just testing out ini_set with register_globals:

      PHP Code:
      <?php

      ini_set
      ("register_globals"1);
      $b ini_get("register_globals");

      print 
      $a;
      print 
      $b;
      ?>
      When I do test.php?a=asdkasdk it outputs:

      1

      Which is $b.

      Comment


      • #4
        Originally posted by agentd
        What's up with this? I'm just testing out ini_set with register_globals:

        PHP Code:
        <?php

        ini_set
        ("register_globals"1);
        $b ini_get("register_globals");

        print 
        $a;
        print 
        $b;
        ?>
        When I do test.php?a=asdkasdk it outputs:

        1

        Which is $b.
        You also can't set register_globals in runtime... variables are registered in the global namespace before the script starts.

        ini_set() can't be used on all settings, just some of them. You can blame PHP until next week...
        Chen Avinadav
        Better to remain silent and be thought a fool than to speak out and remove all doubt.

        גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

        Comment


        • #5
          Originally posted by FireFly

          You also can't set register_globals in runtime... variables are registered in the global namespace before the script starts.

          ini_set() can't be used on all settings, just some of them. You can blame PHP until next week...
          Then why would PHP.net list it as a variable you can use ini_set() for?

          Comment


          • #6
            Originally posted by agentd

            Then why would PHP.net list it as a variable you can use ini_set() for?
            Because you CAN set it with ini_set(), it just doesn't have any bearing on the script.
            Chen Avinadav
            Better to remain silent and be thought a fool than to speak out and remove all doubt.

            גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

            Comment


            • #7
              Then what purpose does it serve?

              Comment


              • #8
                is there any other way to turn off register_globals, I can't exactly get into my host's php.ini file...

                Comment


                • #9
                  Dan: Create an .htaccess file in the script's directory with this in it:
                  Code:
                  php_flag register_globals Off
                  (only for Apache web servers)

                  GSHelpBoy: It's useful to set other options... there are more settings in php.ini more than register_globals and magic_quotes_gpc. I for example use it at vB.org for the code highlighting colors.
                  Chen Avinadav
                  Better to remain silent and be thought a fool than to speak out and remove all doubt.

                  גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

                  Comment


                  • #10
                    Originally posted by FireFly

                    Because you CAN set it with ini_set(), it just doesn't have any bearing on the script.
                    that does change the register_globals on the local value, but funny how it doesn't go by the local like it should for a particular script.

                    if PHP won't let you change it then why does it have it in there? I mean the register_globals for the ini_set().

                    this never made sense to me. they let you change it but it doesn't do any good.

                    Comment


                    • #11
                      Originally posted by FireFly
                      Dan: Create an .htaccess file in the script's directory with this in it:
                      Code:
                      php_flag register_globals Off
                      (only for Apache web servers)
                      Thanks!

                      Comment

                      Loading...
                      Working...
                      X