Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #9189

Re: Undefined variable

From Christoph Becker <cmbecker69@gmx.de>
Newsgroups comp.lang.php
Subject Re: Undefined variable
Date 2013-04-24 12:20 +0200
Organization Aioe.org NNTP Server
Message-ID <kl8blr$89f$1@speranza.aioe.org> (permalink)
References <880c3296-ef42-486d-bb06-a69e527e1126@n4g2000yqj.googlegroups.com>

Show all headers | View raw


Question Boy wrote:
> For instance, I have a block of code, such as:
> 
>        if ($iBookedBy=="Other") {
>           echo '<option selected value="Other">Other</option>';
>         } else {
>           echo '<option value="Other">Other</option>';
>         }
> 
> which the log file reports as:
> 
> PHP Notice: Undefined variable: iBookedBy

You should investigate, why $iBookeyBy is undefined.  It is always
preferable to initialize a variable explicitely before you use it.  This
is particularly important for PHP due to the dangerous register_globals
option (which was fortunately removed since PHP 5.4).  If this is
enabled (what should never be), the code may be vulnerable.  Checking
for isset($iBookeyBy) won't help in this case.

-- 
Christoph M. Becker

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Undefined variable Question Boy <question.boy@hotmail.com> - 2013-04-23 19:16 -0700
  Re: Undefined variable Question Boy <question.boy@hotmail.com> - 2013-04-23 20:06 -0700
  Re: Undefined variable Richard Yates <richard@yatesguitar.com> - 2013-04-23 20:08 -0700
    Re: Undefined variable Question Boy <question.boy@hotmail.com> - 2013-04-23 20:27 -0700
      Re: Undefined variable Question Boy <question.boy@hotmail.com> - 2013-04-23 20:49 -0700
        Re: Undefined variable David Robley <me@home.invalid> - 2013-04-24 17:34 +0930
        Re: Undefined variable Jerry Stuckle <jstucklex@attglobal.net> - 2013-04-24 05:53 -0400
        Re: Undefined variable Chuck Anderson <cycletourist@invalid.invalid> - 2013-04-24 14:02 -0600
          Re: Undefined variable Jerry Stuckle <jstucklex@attglobal.net> - 2013-04-24 22:23 -0400
            Re: Undefined variable Jerry Stuckle <jstucklex@attglobal.net> - 2013-04-24 22:24 -0400
              Re: Undefined variable Tim Streater <timstreater@greenbee.net> - 2013-04-25 08:36 +0100
                Re: Undefined variable Jerry Stuckle <jstucklex@attglobal.net> - 2013-04-25 05:13 -0400
                Re: Undefined variable Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-25 14:04 +0200
                Re: Undefined variable The Natural Philosopher <tnp@invalid.invalid> - 2013-04-25 13:12 +0100
            Re: Undefined variable Chuck Anderson <cycletourist@invalid.invalid> - 2013-04-25 01:03 -0600
              Re: Undefined variable Jerry Stuckle <jstucklex@attglobal.net> - 2013-04-25 05:22 -0400
                Re: Undefined variable Chuck Anderson <cycletourist@invalid.invalid> - 2013-04-25 23:59 -0600
      Re: Undefined variable The Natural Philosopher <tnp@invalid.invalid> - 2013-04-24 10:24 +0100
        Re: Undefined variable Jerry Stuckle <jstucklex@attglobal.net> - 2013-04-24 05:55 -0400
  Re: Undefined variable Christoph Becker <cmbecker69@gmx.de> - 2013-04-24 12:20 +0200
    Re: Undefined variable Question Boy <question.boy@hotmail.com> - 2013-04-24 06:51 -0700
      Re: Undefined variable "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2013-04-25 10:10 +0200
        Re: Undefined variable Denis McMahon <denismfmcmahon@gmail.com> - 2013-04-25 18:23 +0000
          Re: Undefined variable "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2013-04-25 22:05 +0200
            Re: Undefined variable Denis McMahon <denismfmcmahon@gmail.com> - 2013-04-26 03:27 +0000
              Re: Undefined variable Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-26 21:30 +0200

csiph-web