PHP 4.0 Bug #2675 Updated: Misbehavior of object initializers

From: Date: Sat, 06 Nov 1999 16:47:46 +0000
Subject: PHP 4.0 Bug #2675 Updated: Misbehavior of object initializers
Groups: php.dev 
Request: Send a blank email to php-dev+get-12169@lists.php.net to get a copy of this message
ID: 2675 Updated by: andi Reported By: zerodiv@zerodivide.net Status: Closed Bug Type: Other Assigned To: Comments: This is not a bug. You are misusing constructors. What the new operator does is similar to C++. It first allocates memory for the object and then calls the objects constructor. The constructor does not have a return value and returning something from it is pointless. When you're calling new Bar(); you're telling PHP you want a new object of type Bar and not foo. Maybe what you want is inheritence? Full Bug description available at: http://bugs.php.net/version4/?id=2675

« previous php.dev (#12169) next »