FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Undefined variable
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Undefined variable [message #181251 is a reply to message #181245] Thu, 25 April 2013 08:10 Go to previous messageGo to previous message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma:
Senior Member
Am 24.04.2013 15:51, schrieb Question Boy:
> On Apr 24, 6:20 am, Christoph Becker <cmbecke...@gmx.de> wrote:
>> 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
>
> Thank you all for all the information! I have a lot of work ahead of
> me to clean thing up.
>

I propose a new reading of "PHP Notice: undefined variable...", it goes:

Hey, you are using a variable that is not defined. I will put a null into it.
Because I will make it easy for you.
If you don't care I won't either.
Maybe you expected the variable to contain something,
and your app logic will be screwed up.
It will be _a_lot_of_ work to find the error, but that's your problem.


/Str.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Rejecting Certain Non-ASCII Characters
Next Topic: determine a mysqli_result object
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 20:25:11 GMT 2024

Total time taken to generate the page: 0.04671 seconds