Doc #69026 [Com]: conflict between documentation and behaviour on finally
| From: | cmbecker69 at gmx dot de | Date: | Sun, 15 Feb 2015 02:42:25 +0000 |
| Subject: | Doc #69026 [Com]: conflict between documentation and behaviour on finally | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-11944@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69026&edit=1
ID: 69026
Comment by: cmbecker69 at gmx dot de
Reported by: nicolas dot sitbon at gmail dot com
Summary: conflict between documentation and behaviour on
finally
Status: Open
Type: Documentation Problem
Package: Documentation problem
Operating System: all
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
According to the language specification[1]:
| try-statement:
| try compound-statement catch-clauses
| try compound-statement finally-clause
| try compound-statement catch-clauses finally-clause
[1] <https://github.com/php/php-langspec/blob/master/spec/11-statements.md#the-try-statement>
Previous Comments:
------------------------------------------------------------------------
[2015-02-11 09:41:16] nicolas dot sitbon at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/language.exceptions
---
Quoting the manual:
- "Each try must have at least one corresponding catch block"
- "a finally block may also be specified after the catch blocks"
so the manual states that each try block must have at least one catch block.
But the implementation currently allows the omission of the catch block if there is a finally block.
<?php
try {
echo 'in try';
} finally {
echo 'in finally';
}
is perfectly valid on all versions of PHP > 5.5 and on HHVM.
Can we rely on this behaviour or we should trust the manual ?
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69026&edit=1