Re: PHP 4.0 Bug #9253: Class constructors can't return values
| From: | Alan van den Bosch | Date: | Sat, 17 Feb 2001 02:03:46 +0000 |
| Subject: | Re: PHP 4.0 Bug #9253: Class constructors can't return values | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-46724@lists.php.net to get a copy of this message | ||
If Nathan's suggestion is not just an unreliable side effect, maybe this
should be documented. (ie changed from Feature/Change request)
regards,
Alan.
----- Original Message -----
From: "Nathan Cassano" <nathan@cjhunter.com>
To: <stefan.p@noos.fr>; <php-dev@lists.php.net>
Sent: Thursday, February 15, 2001 11:11 AM
Subject: RE: [PHP-DEV] PHP 4.0 Bug #9253: Class constructors can't return
values
> You can return a value from a class constructor. It's just not that
obvious.
>
> class myclass {
>
> function myclass() {
>
> if($err){
> $this = $err;
> return;
> }
> }
>
> }
>
> -----Original Message-----
> From: stefan.p@noos.fr [mailto:stefan.p@noos.fr]
> Sent: Wednesday, February 14, 2001 2:23 AM
> To: php-dev@lists.php.net
> Subject: [PHP-DEV] PHP 4.0 Bug #9253: Class constructors can't return
> values
>
>
> From: stefan.p@noos.fr
> Operating system: All
> PHP version: 4.0.4pl1
> PHP Bug Type: Feature/Change Request
> Bug description: Class constructors can't return values
>
> Class constructors can't abort instance creation, for example by returning
> false...
> This leads to a lot of "if (! $newobj->status)" crap.
> Why is that ? I found a message on the PHP3 mailing list about this, but
> it's still not there.
>
>
> --
> Edit Bug report at: http://bugs.php.net/?id=9253&edit=1
>
>
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
> For additional commands, e-mail: php-dev-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>