Bug #81123 [NEW]: Setting a variable in a class to NULL does nothing
From: jplevene at gmail dot com
Operating system: Linux & Windows
PHP version: 8.0.7
Package: Unknown/Other Function
Bug Type: Bug
Bug description:Setting a variable in a class to NULL does nothing
Description:
------------
A declared variable in a class can't be set to NULL or unset
Test script:
---------------
class myClass {
private $var = null;
function __construct() {
$this->var = "Hello";
}
public function func()
{
$this->var = null; // Does nothing, still "Hello"
unset($this->var); // Does nothing, still "Hello"
$this->var = false; // Works
}
}
Expected result:
----------------
Variable should be null
Actual result:
--------------
Variable stays as "Hello"
--
Edit bug report at https://bugs.php.net/bug.php?id=81123&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81123&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81123&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81123&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81123&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81123&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81123&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81123&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81123&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81123&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81123&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81123&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81123&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81123&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81123&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81123&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81123&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81123&r=mysqlcfg
Thread (10 messages)
- jplevene at gmail dot com