Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74263 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31237 invoked from network); 16 May 2014 14:44:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 May 2014 14:44:14 -0000 Authentication-Results: pb1.pair.com smtp.mail=addw@phcomp.co.uk; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=addw@phcomp.co.uk; sender-id=permerror Received-SPF: pass (pb1.pair.com: domain phcomp.co.uk designates 78.32.209.33 as permitted sender) X-PHP-List-Original-Sender: addw@phcomp.co.uk X-Host-Fingerprint: 78.32.209.33 freshmint.phcomp.co.uk Received: from [78.32.209.33] ([78.32.209.33:54466] helo=mint.phcomp.co.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CB/4B-58167-B3426735 for ; Fri, 16 May 2014 10:44:12 -0400 Received: from addw by mint.phcomp.co.uk with local (Exim 4.72) (envelope-from ) id 1WlJMm-0002Vi-Ii for internals@lists.php.net; Fri, 16 May 2014 15:44:08 +0100 Date: Fri, 16 May 2014 15:44:08 +0100 To: internals Message-ID: <20140516144408.GW14095@phcomp.co.uk> Mail-Followup-To: internals MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Organization: Parliament Hill Computers Ltd User-Agent: Mutt/1.5.20 (2009-12-10) Subject: Cannot use const within try block From: addw@phcomp.co.uk (Alain Williams) The code below gives me: PHP Parse error: syntax error, unexpected T_CONST in ... try { const XXX = 12; echo "XXX = " . XXX . "\n"; }catch (ErrorException $e) { echo "error {$e->getMessage()}\n"; } It works if I put the 'cost' before/outside the 'try'. It also works if I replace the const line by: define('XXX', 'twelve'); or include "testdef.php"; where testdef.php contains: const XXX = 12; I cannot find this behaviour documented. a) If there is no good reason for this restriction - can it be removed. or b) If there is good reason for it can this be documented. Regards -- Alain Williams Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 http://www.phcomp.co.uk/ Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php #include