#28240 [NEW]: class member assigment without declaration defines new member

From: Date: Fri, 30 Apr 2004 20:30:10 +0000
Subject: #28240 [NEW]: class member assigment without declaration defines new member
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-59080@lists.php.net to get a copy of this message
From: php at jort dot net Operating system: Win2000 Pro PHP version: 5.0.0RC2 PHP Bug Type: Class/Object related Bug description: class member assigment without declaration defines new member Description: ------------ When you assign a value to a class member that was not declared the system defines a new class member. I'm not sure this is a feature or a bug. I would expect an error or at least a notice or a warning. Reproduce code: --------------- <?php class foo { function __construct() { $this->foo = "test"; } } $bar = new foo(); print $bar->foo; ?> Expected result: ---------------- Notice/Warning/Error Actual result: -------------- test -- Edit bug report at http://bugs.php.net/?id=28240&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28240&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28240&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=28240&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=28240&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=28240&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=28240&r=needscript Try newer version: http://bugs.php.net/fix.php?id=28240&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=28240&r=support Expected behavior: http://bugs.php.net/fix.php?id=28240&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=28240&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=28240&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=28240&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28240&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=28240&r=dst IIS Stability: http://bugs.php.net/fix.php?id=28240&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=28240&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=28240&r=float

« previous php.bugs (#59080) next »