Req #63713 [NEW]: Need an "UNDEFINED" type
| From: | liquid_nitrogen_4ever at yahoo dot com | Date: | Thu, 06 Dec 2012 17:42:43 +0000 |
| Subject: | Req #63713 [NEW]: Need an "UNDEFINED" type | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-175169@lists.php.net to get a copy of this message | ||
From: liquid_nitrogen_4ever at yahoo dot com
Operating system:
PHP version: Irrelevant
Package: Variables related
Bug Type: Feature/Change Request
Bug description:Need an "UNDEFINED" type
Description:
------------
Consider the following scenario currently in PHP:
var_dump($notExistentVariable);
-> NOTICE: Undefined variable notHere on line 1
NULL
isset($notExistentVariable);
-> FALSE
$foo = null;
var_dump($foo);
-> NULL
isset($foo);
-> FALSE
If there were an UNDEFINED "type" (in the same sense that there is a NULL),
the
above scenarios would change to:
var_dump($notExistentVariable);
-> UNDEFINED
isset($notExistentVariable);
-> FALSE
$foo = null;
var_dump($foo);
-> NULL
isset($foo);
-> TRUE
However, unlike NULL, you would NOT be allowed to explicitly initialize
something to UNDEFINED.
$x=UNDEFINED;//error: if you want it to be undefined, don't declare it.
However, having just:
$x;
makes sense (to me at least) as shortcut to:
$x=NULL;
In other words, if a variable is declared but not explicitly initialized,
it
will implicitly be set to NULL (which is
essentially what you are already doing, but one can't really differentiate
between declared and undeclared variables).
--
Edit bug report at https://bugs.php.net/bug.php?id=63713&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63713&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63713&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63713&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=63713&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=63713&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=63713&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=63713&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=63713&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=63713&r=support
Expected behavior: https://bugs.php.net/fix.php?id=63713&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=63713&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=63713&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=63713&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63713&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=63713&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=63713&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=63713&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63713&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=63713&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=63713&r=mysqlcfg