#35587 [Opn->Bgs]: There appears to be an issue when using 'or die' in combination with 'return'

From: Date: Wed, 07 Dec 2005 17:58:04 +0000
Subject: #35587 [Opn->Bgs]: There appears to be an issue when using 'or die' in combination with 'return'
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-89908@lists.php.net to get a copy of this message
ID: 35587 Updated by: iliaa@php.net Reported By: jte at dontsteel dot com -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Windows XP PHP Version: 5.1.1 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php You cannot do return $c or die; Previous Comments: ------------------------------------------------------------------------ [2005-12-07 18:42:00] jte at dontsteel dot com Description: ------------ It appears that when 'or die' is used in combination with a return statement the return will always be 1, instead of returning the proper value and dying when not able to return the value. This appears to happen with any data type being returned. Reproduce code: --------------- function Sum($a, $b) { $c = $a + $b; return $c or die; } echo Sum(1,1); Expected result: ---------------- 6 Actual result: -------------- 1 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=35587&edit=1

« previous php.bugs (#89908) next »