[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-doc-bugs
Subject:    [DOC-BUGS] Doc #69026 [Opn->Csd]: conflict between documentation and behaviour on finally
From:       aharvey () php ! net
Date:       2015-02-19 23:53:29
Message-ID: 201502192353.t1JNrT0p005895 () sgrv20 ! php ! net
[Download RAW message or body]

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
+Status:             Closed
 Type:               Documentation Problem
 Package:            Documentation problem
 Operating System:   all
 PHP Version:        Irrelevant
-Assigned To:        
+Assigned To:        aharvey
 Block user comment: N
 Private report:     N



Previous Comments:
------------------------------------------------------------------------
[2015-02-19 23:53:23] aharvey@php.net

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!

------------------------------------------------------------------------
[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&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

-- 
PHP Documentation Bugs Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic