Req #79679 [NEW]: non-void return in __construct should generate at least warning

From: Date: Sat, 06 Jun 2020 14:38:02 +0000
Subject: Req #79679 [NEW]: non-void return in __construct should generate at least warning
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227339@lists.php.net to get a copy of this message
From: michael dot vorisek at email dot cz Operating system: any PHP version: 7.4.6 Package: Scripting Engine problem Bug Type: Feature/Change Request Bug description:non-void return in __construct should generate at least warning Description: ------------ __construct is special methods and it should be not allowed to return any value Test script: --------------- class A { public function __construct() { return 5; } } class B extends A { public function __construct() { var_dump(parent::__construct()); } } $b = new B(); Expected result: ---------------- PHP warning Actual result: -------------- int(5) -- Edit bug report at https://bugs.php.net/bug.php?id=79679&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79679&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79679&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79679&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79679&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79679&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79679&r=support Expected behavior: https://bugs.php.net/fix.php?id=79679&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79679&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79679&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79679&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79679&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79679&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79679&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79679&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79679&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79679&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79679&r=mysqlcfg

« previous php.bugs (#227339) next »