Bug #52401 [Opn->Bgs]: throw construct invalid within conditional
| From: | aharvey@php.net | Date: | Fri, 23 Jul 2010 09:37:23 +0000 |
| Subject: | Bug #52401 [Opn->Bgs]: throw construct invalid within conditional | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-152658@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52401&edit=1
ID: 52401
Updated by: aharvey@php.net
Reported by: andrew at ajohnstone dot com
Summary: throw construct invalid within conditional
-Status: Open
+Status: Bogus
Type: Bug
Package: Scripting Engine problem
PHP Version: 5.3.2
New Comment:
By design; you can only use an expression in that context, not a
statement or control structure. Note that return wouldn't work there
either.
Previous Comments:
------------------------------------------------------------------------
[2010-07-22 12:17:47] andrew at ajohnstone dot com
Description:
------------
The following is a valid:
(!array_key_exists($class, $this->_data)) AND new
InvalidArgumentException("Class does not exist");
However the following is not:
(!array_key_exists($class, $this->_data)) AND throw new
InvalidArgumentException("Class does not exist");
Test script:
---------------
(!array_key_exists($class, $this->_data)) AND throw new
InvalidArgumentException("Class does not exist");
Expected result:
----------------
No syntax error
Actual result:
--------------
Parse error: syntax error, unexpected
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52401&edit=1