ID: 43847 Updated by: [EMAIL PROTECTED] Reported By: timshaw at mail dot usa dot com -Status: Open +Status: Bogus Bug Type: Class/Object related Operating System: Win32 PHP Version: 5.2.5 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Previous Comments: ------------------------------------------------------------------------ [2008-01-15 02:24:55] timshaw at mail dot usa dot com Description: ------------ Shouldn't unset of a declared property still leave the property as a declared property, so that the set overload will not later be used on it? It is cool to unset things once their value becomes invalid to catch errors using the invalid value. However, I could understand that this overload problem is actually an undocumented feature if the person who implemented overloads decided that everybody should be able to overload everything, even declared properties, so this was put in to allow that.... Too bad that doesn't accomodate those of us who don't want to use overloads for everything, just some things. Reproduce code: --------------- <?php class c { public $x ; public function __set($nm, $val) { echo "overloaded __set($nm, $val) ;\n" ; } public function __isset($nm) { echo "overloaded __isset($nm) ;\n" ; } public function __unset($nm) { echo "overloaded __unset($nm) ;\n" ; } } $c = new c ; echo "Does not overload, just as expected and documented, because \$x is declared property\n" ; echo "\$c->x = ", $c->x = 5, "\n" ; echo "Does not overload, just as expected, because \$x is declared property\n" ; echo "isset(\$c->x) = ", isset($c->x)? 'True': 'False', "\n" ; echo "Does not use overload __unset, just as expected, because \$x is declared property\n" ; echo "unset(\$c->x)\n" ; unset($c->x) ; echo "Here's the problem- \$x is declared public property, but now it's using overloaded set!\n" ; echo "\$c->x = 5 ... " ; $c->x = 5 ; ?> Expected result: ---------------- The "overloaded ..." should not appear because only the declared property $x is used. Actual result: -------------- This does not call overload, just as expected and documented, because $x is declared property $c->x = 5 This does not call overload, just as expected, because $x is declared property isset($c->x) = True This does not go though __unset, just as expected, because $x is declared property unset($c->x) Here's the problem- $x is declared public property, but now it's using overloaded set! $c->x = 5 ... overloaded __set(x, 5) ; ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43847&edit=1
