|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14296 Undeclared variables and isset()
Submitted: 2001-11-30 04:15 UTC Modified: 2001-11-30 15:26 UTC
From: v dot puttrich at digitalliquid dot de Assigned:
Status: Not a bug Package: Variables related
PHP Version: 4.0.6 OS: Win2k
Private report: No CVE-ID: None
 [2001-11-30 04:15 UTC] v dot puttrich at digitalliquid dot de
I use PHP 4.0.6 on Win2k pro with Apache 1.3.22 win
Loaded modules don't seem to make a difference for the described behaviour.

Let's say we have a PHP script, the retrieves some variables via HTTP post or get. And the variables, passed to the script, have different names each time.
Usually we would use "isset($variable)" to check if it exists. In most cases we need to check the content of the variable too. So it would be nice to do that in one step.

The script of the following examples retrieved $var1 or $var or both of them via HTTP.

// This would be the usual way i guess

// This has been possible with PHP 3.xx - 4.0.5
// without previously checking for existence 
// of $var1/$var2
if($var1 == "something"){
if($var2 == "anything"){

// With PHP 4.0.6 we would have to do this:
if(!isset($var1)){ // is NOT declared?
  $var1 = "";
if(!isset($var2)){ // is NOT declared?
  $var2 = "";
// first we had to declare them, now we can use them
if($var1 == "something"){
if($var2 == "anything"){

I wonder if this new behaviour is a bug or a feature?
Or why can't I find info about it in the changes list if it's a feature?

Please send your answer to:

Thank you!

Volker Puttrich


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-30 04:36 UTC]
looks like you have set error_reporting to E_ALL
while you had E_ALL & ~E_NOTICE before?

maybe by using php.ini-recommended as template
for php.ini with 4.0.6 while using php.ini-dist
for the former versions?
 [2001-11-30 12:28 UTC]
Not a bug.

 [2001-11-30 15:26 UTC] v dot puttrich at digitalliquid dot de
What was the default in "php.ini-dist" for version 4.0.5?

I always leave the error_reporting in the ini file as it is.
The reason for that is, I want the same behaviour of PHP on all servers I use.
I didn't know that i can't rely on the default setting.

my error_reporting is set to E_ALL.

Thanks for the hint

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jul 13 08:01:29 2024 UTC