Doc #55164 [NEW]: Unclear/incorrect description of "casting to null"

From: Date: Sat, 09 Jul 2011 01:18:01 +0000
Subject: Doc #55164 [NEW]: Unclear/incorrect description of "casting to null"
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-6849@lists.php.net to get a copy of this message
From: Operating system: PHP version: Irrelevant Package: Documentation problem Bug Type: Documentation Problem Bug description:Unclear/incorrect description of "casting to null" Description: ------------ The documentation at http://www.php.net/manual/en/language.types.null.php states: "Casting a variable to null will remove the variable and unset its value." This seems incorrect and/or misleading. "Casting" to null is not possible as such through the cast syntax (null). Setting the type of a variable using settype($foo, 'null') or assigning null to any variable will not "remove" the variable. The variable continues to exist with the value null. Test script: --------------- // the documentation suggests something like this: $foo = 'bar'; settype($foo, 'null'); echo $foo; // PHP Notice: Undefined variable: foo // actual behavior: $foo = 'bar'; settype($foo, 'null'); echo $foo; // empty output, no warning -- Edit bug report at https://bugs.php.net/bug.php?id=55164&edit=1 -- Try a snapshot (PHP 5.2): https://bugs.php.net/fix.php?id=55164&r=trysnapshot52 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55164&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55164&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=55164&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55164&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=55164&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=55164&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=55164&r=needscript Try newer version: https://bugs.php.net/fix.php?id=55164&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=55164&r=support Expected behavior: https://bugs.php.net/fix.php?id=55164&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=55164&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=55164&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=55164&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55164&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=55164&r=dst IIS Stability: https://bugs.php.net/fix.php?id=55164&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=55164&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=55164&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=55164&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=55164&r=mysqlcfg Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55164&r=trysnapshot54

« previous php.doc.bugs (#6849) next »