#47748 [NEW]: creating class variable outside class definition

From: Date: Sun, 22 Mar 2009 18:20:30 +0000
Subject: #47748 [NEW]: creating class variable outside class definition
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-134996@lists.php.net to get a copy of this message
From: tompotts at itsosbroadband dot co dot uk Operating system: W2k/Linux PHP version: 5.2.9 PHP Bug Type: Class/Object related Bug description: creating class variable outside class definition Description: ------------ Seem to be able to extend instances outside class definition Reproduce code: --------------- class one{ public $vars; } $inst=new one; $inst->newvar="should make error"; print $inst->newvar; Expected result: ---------------- An error where the class is modified externally to its definition. Actual result: -------------- allows instance to be extended willynilly. Not sure if this is language feature by design - doesnt feel right to my view of OO. -- Edit bug report at http://bugs.php.net/?id=47748&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47748&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47748&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47748&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=47748&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47748&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=47748&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=47748&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=47748&r=needscript Try newer version: http://bugs.php.net/fix.php?id=47748&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=47748&r=support Expected behavior: http://bugs.php.net/fix.php?id=47748&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=47748&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=47748&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=47748&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47748&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=47748&r=dst IIS Stability: http://bugs.php.net/fix.php?id=47748&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=47748&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=47748&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=47748&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=47748&r=mysqlcfg

« previous php.bugs (#134996) next »