php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35587 There appears to be an issue when using 'or die' in combination with 'return'
Submitted: 2005-12-07 18:42 UTC Modified: 2005-12-07 18:58 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: jte at dontsteel dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.1.1 OS: Windows XP
Private report: No CVE-ID: None
 [2005-12-07 18:42 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-07 18:58 UTC] iliaa@php.net
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; 
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Dec 15 23:00:01 2025 UTC