Source code Bug or Feature?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bruce A. Julseth

    Source code Bug or Feature?

    I have just inherited someone elses PHP code and there is something strange
    in it, at least to me. I'm wondering if I inherited a source code bug or is
    it a PHP feature that I don't know about. This code is in "index.htm" and
    the first few lines of the file look like:

    <?
    if($parm) {
    more code
    }
    ?>

    Now, the error I am getting is that "$parm" is not defined. I would expect
    that. Or is there some "hidden" way $parm can be defined and I just haven't
    found the code that does it, or don't how to do it.

    Thanks...


  • Andy Hassall

    #2
    Re: Source code Bug or Feature?

    On Tue, 18 Oct 2005 14:53:08 -0400, "Bruce A. Julseth"
    <bruceajNoSpam@ attglobal.net> wrote:
    [color=blue]
    >I have just inherited someone elses PHP code and there is something strange
    >in it, at least to me. I'm wondering if I inherited a source code bug or is
    >it a PHP feature that I don't know about. This code is in "index.htm" and
    >the first few lines of the file look like:
    >
    ><?
    >if($parm) {
    > more code
    >}
    >?>
    >
    >Now, the error I am getting is that "$parm" is not defined. I would expect
    >that. Or is there some "hidden" way $parm can be defined and I just haven't
    >found the code that does it, or don't how to do it.[/color]

    Search for "register_globa ls", then correct the script to use $_GET or $_POST
    and never think about register_global s being on again :-)
    --
    Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
    http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

    Comment

    • Ewoud Dronkert

      #3
      Re: Source code Bug or Feature?

      Andy Hassall wrote:[color=blue][color=green]
      >> <?
      >> if($parm) {
      >> more code
      >> }
      >> ?>[/color]
      >
      > Search for "register_globa ls", then correct the script to use $_GET or $_POST
      > and never think about register_global s being on again :-)[/color]

      And use long opening tags: <?php
      or you'll get in trouble with different configs or x(ht)ml docs.

      --
      E. Dronkert

      Comment

      • Bruce A. Julseth

        #4
        Re: Source code Bug or Feature?


        "Andy Hassall" <andy@andyh.co. uk> wrote in message
        news:acial1lnn2 kdmr5sdl1grgr58 6vf8piubd@4ax.c om...[color=blue]
        > On Tue, 18 Oct 2005 14:53:08 -0400, "Bruce A. Julseth"
        > <bruceajNoSpam@ attglobal.net> wrote:
        >[color=green]
        >>I have just inherited someone elses PHP code and there is something
        >>strange
        >>in it, at least to me. I'm wondering if I inherited a source code bug or
        >>is
        >>it a PHP feature that I don't know about. This code is in "index.htm" and
        >>the first few lines of the file look like:
        >>
        >><?
        >>if($parm) {
        >> more code
        >>}
        >>?>
        >>
        >>Now, the error I am getting is that "$parm" is not defined. I would expect
        >>that. Or is there some "hidden" way $parm can be defined and I just
        >>haven't
        >>found the code that does it, or don't how to do it.[/color]
        >
        > Search for "register_globa ls", then correct the script to use $_GET or
        > $_POST
        > and never think about register_global s being on again :-)
        > --
        > Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
        > http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool[/color]

        RE: register_global s. I assume if I don't find any "register_globa ls"
        defined, this is a bug in the code. Right?

        Thanks...


        Comment

        • Bruce A. Julseth

          #5
          Re: Source code Bug or Feature?


          "Ewoud Dronkert" <firstname@last name.net.invali d> wrote in message
          news:0mial1l8nf io097v04pefpri1 ihk9edh6d@4ax.c om...[color=blue]
          > Andy Hassall wrote:[color=green][color=darkred]
          >>> <?
          >>> if($parm) {
          >>> more code
          >>> }
          >>> ?>[/color]
          >>
          >> Search for "register_globa ls", then correct the script to use $_GET or
          >> $_POST
          >> and never think about register_global s being on again :-)[/color]
          >
          > And use long opening tags: <?php
          > or you'll get in trouble with different configs or x(ht)ml docs.
          >
          > --
          > E. Dronkert[/color]

          Thanks for the tip.

          Bruce


          Comment

          • Malcolm Dew-Jones

            #6
            Re: Source code Bug or Feature?

            Bruce A. Julseth (bruceajNoSpam@ attglobal.net) wrote:

            : "Andy Hassall" <andy@andyh.co. uk> wrote in message
            : news:acial1lnn2 kdmr5sdl1grgr58 6vf8piubd@4ax.c om...
            : > On Tue, 18 Oct 2005 14:53:08 -0400, "Bruce A. Julseth"
            : > <bruceajNoSpam@ attglobal.net> wrote:
            : >
            : >>I have just inherited someone elses PHP code and there is something
            : >>strange
            : >>in it, at least to me. I'm wondering if I inherited a source code bug or
            : >>is
            : >>it a PHP feature that I don't know about. This code is in "index.htm" and
            : >>the first few lines of the file look like:
            : >>
            : >><?
            : >>if($parm) {
            : >> more code
            : >>}
            : >>?>
            : >>
            : >>Now, the error I am getting is that "$parm" is not defined. I would expect
            : >>that. Or is there some "hidden" way $parm can be defined and I just
            : >>haven't
            : >>found the code that does it, or don't how to do it.
            : >
            : > Search for "register_globa ls", then correct the script to use $_GET or
            : > $_POST
            : > and never think about register_global s being on again :-)
            : > --
            : > Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
            : > http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

            : RE: register_global s. I assume if I don't find any "register_globa ls"
            : defined, this is a bug in the code. Right?

            It's a config setting in php.ini which is used by the server to control
            how php works.

            google: register_global s php_

            Various entries, 'fraid you'll need to read a few to learn everything you
            want to know.

            --

            This programmer available for rent.

            Comment

            Working...