Doc #69026 [Opn]: conflict between documentation and behaviour on finally
| From: | nicolas dot sitbon at gmail dot com | Date: | Sun, 15 Feb 2015 12:31:39 +0000 |
| Subject: | Doc #69026 [Opn]: conflict between documentation and behaviour on finally | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-11945@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
User updated by: nicolas dot sitbon at gmail dot com
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:
Thanks for your comment
the specification is in WIP state so I don't know if the manual is incorrect or the
specification.
Previous Comments:
------------------------------------------------------------------------
[2015-02-15 02:42:24] cmbecker69 at gmx dot de
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>
------------------------------------------------------------------------
[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