Doc #70929 [Opn->Csd]: create_function now throws ParseError
| From: | cmb@php.net | Date: | Thu, 17 Dec 2015 11:38:49 +0000 |
| Subject: | Doc #70929 [Opn->Csd]: create_function now throws ParseError | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-12946@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70929&edit=1
ID: 70929
Updated by: cmb@php.net
Reported by: bishop@php.net
Summary: create_function now throws ParseError
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: Documentation problem
PHP Version: 7.0Git-2015-11-17 (Git)
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation better.
Previous Comments:
------------------------------------------------------------------------
[2015-12-17 11:38:33] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=338282
Log: fixed #70929: create_function now throws ParseError
------------------------------------------------------------------------
[2015-11-17 19:10:10] bishop@php.net
This is mentioned indirectly in the RFC, while discussing eval:
https://wiki.php.net/rfc/engine_exceptions_for_php7#e_parse_compatibility
------------------------------------------------------------------------
[2015-11-17 19:01:49] bishop@php.net
As of PHP 7, create_function now throws an exception when there's an internal parse error:
try {
$result = create_function('', 'return (return 1);');
} catch (ParseError $ex) {
$result = $ex->getMessage();
}
https://3v4l.org/oCHLh#v700alpha2
The docs should be updated to reflect this.
---
Thanks @nikic, was just about to say that. :)
------------------------------------------------------------------------
[2015-11-17 18:54:22] nikic@php.net
You have to catch ParseError (or Error, or Throwable), not Exception: https://3v4l.org/4MOJt
------------------------------------------------------------------------
[2015-11-17 18:40:04] bishop@php.net
The following patch has been added/updated:
Patch Name: capture_parse_exceptions
Revision: 1447785604
URL: https://bugs.php.net/patch-display.php?bug=70929&patch=capture_parse_exceptions&revision=1447785604
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=70929
--
Edit this bug report at https://bugs.php.net/bug.php?id=70929&edit=1