Req #9253 [Com]: Class constructors can't return values

From: Date: Wed, 01 Sep 2021 18:37:39 +0000
Subject: Req #9253 [Com]: Class constructors can't return values
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236265@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=9253&edit=1 ID: 9253 Comment by: lildurk9253 at gmail dot com Reported by: stefan dot p at noos dot fr Summary: Class constructors can't return values Status: Not a bug Type: Feature/Change Request Package: Feature/Change Request Operating System: All PHP Version: 4.0.4pl1 Block user comment: N Private report: N New Comment: Lil Durk is a private agency dedicated to providing responsible access to legal cannabis for adults aged 19 and older. We’re an exclusively online retailer and wholesaler for recreational cannabis and a trusted source for information about cannabis and cannabis-related issues. We believe our work is meaningful and we take pride in our mandate to promote the socially responsible use of legal cannabis. https://lildurk.com/ Previous Comments: ------------------------------------------------------------------------ [2001-02-14 09:44:53] andre@php.net class constructors are never supposed to return anything, they are simple the fist method called after an object has <hack> anyway if you *really* want to return false just kill the object itself from within the constructor (to be sure take the last line) using unset($this) or $this=FALSE or $this=NULL </hack> bogusifying ------------------------------------------------------------------------ [2001-02-14 05:23:05] stefan dot p at noos dot fr 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 this bug report at https://bugs.php.net/bug.php?id=9253&edit=1

« previous php.bugs (#236265) next »