|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-12-30 15:45 UTC] krakjoe@php.net
-Status: Open
+Status: Not a bug
[2012-12-30 15:45 UTC] krakjoe@php.net
[2012-12-31 01:41 UTC] paxcoder+phpnet at gmail dot com
[2013-01-02 11:13 UTC] krakjoe@php.net
[2013-01-04 13:52 UTC] paxcoder+phpnet at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 09:00:01 2025 UTC |
Description: ------------ As-is, returning values in the constructor has no effect, and the class instance is returned instead. Either allow for explicitly returned values to supersede the object, or warn about trying to return a value from a constructor. Test script: --------------- <?php error_reporting(E_ALL|E_STRICT); class C { function __construct() { return NULL; } } $c = new C; print_r($c); ?> Expected result: ---------------- Either a warning at line 10, or $c set to NULL Actual result: -------------- No warning, and $c set to a C Object