Req #62404 [Opn->Csd]: Add checked exceptions, please

From: Date: Mon, 24 Aug 2015 13:56:55 +0000
Subject: Req #62404 [Opn->Csd]: Add checked exceptions, please
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195475@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=62404&edit=1 ID: 62404 Updated by: cmb@php.net Reported by: normandiggs at gmail dot com Summary: Add checked exceptions, please -Status: Open +Status: Closed Type: Feature/Change Request Package: Class/Object related PHP Version: 5.4.4 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Closed on OP's request. Previous Comments: ------------------------------------------------------------------------ [2012-06-25 17:12:58] normandiggs at gmail dot com I think one my wish should not be the reason of performance slowdown in all scripts, which use try-catch. Thanks for your time and explanation. Close this ticket please. ------------------------------------------------------------------------ [2012-06-25 09:50:08] laruence@php.net I have discussed with ekneuss about this FR for a bit. thanks to ekneuss, we found there are some limits, 1. since PHP is a dynamic language, then for $obj->function, we can not determine what $obj is, so if we want to implement this FR, we have to do the check at run-time. 2. there is another question while for following codes: function bar($i) { if ($i == 42) { $obj->someFuncThrowException(); } } so, should we trigger WARNING all the times? 3. unlesss ZEND_CATCH is executed, we have no idea what type of exception will be caught by catch, so, if we implement a whole exception type check, we will need: exception autoload, and catch statements analyse , which will bring a obvious performance slow down.. anyway, I can do more research later , thanks :) ------------------------------------------------------------------------ [2012-06-24 19:23:39] normandiggs at gmail dot com Description: ------------ Please, add Checked Exceptions to PHP (from Java). Test script: --------------- <?php Class Example { public function SomeFunction() throws \PDOException, \Some\Interface { //... } } Class Check { protected function CheckItWrong() { $Example = new Example; // please, generate "warning" here, because "try-catch" // with necessary types wasn't declared around call. $Example->SomeFunction(); } } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=62404&edit=1

« previous php.bugs (#195475) next »