Doc #69026 [Opn]: conflict between documentation and behaviour on finally

From: Date: Thu, 19 Feb 2015 23:53:23 +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-11956@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 Updated by: aharvey@php.net 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: The manual was incorrect, which is my fault: I didn't update the exceptions page thoroughly enough for that case when I added documentation for finally. Fixed in SVN. Thanks for the report! Previous Comments: ------------------------------------------------------------------------ [2015-02-19 23:52:43] aharvey@php.net Automatic comment from SVN on behalf of aharvey Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=335965 Log: Clarify when a catch block is required in conjunction with finally. I've added entities for throw, try, catch and finally so that they can be more easily used and linked to the right sections. This has resulted in a considerable amount of code churn in exceptions.xml, as everything is now in a simplesect or sect1 (and the sect1 had to be moved ahead of the simplesects, which has no impact on formatting, but is required for the document to be well-formed). Fixes doc bug #69026 (conflict between documentation and behaviour on finally). ------------------------------------------------------------------------ [2015-02-15 12:31:38] nicolas dot sitbon at gmail dot com Thanks for your comment the specification is in WIP state so I don't know if the manual is incorrect or the specification. ------------------------------------------------------------------------ [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

« previous php.doc.bugs (#11956) next »