|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #72563 @unset() return error
Submitted: 2016-07-08 05:50 UTC Modified: 2016-07-13 01:39 UTC
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: security at nsa dot gov Assigned:
Status: Open Package: Scripting Engine problem
PHP Version: 7.0.8 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: security at nsa dot gov
New email:
PHP Version: OS:


 [2016-07-08 05:50 UTC] security at nsa dot gov
If I use @ to supress error, PHP failed to parse @unset.

Test script:

Expected result:
No error

Actual result:
Erros parsing


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-07-08 07:29 UTC]
-Package: PHP Language Specification +Package: Scripting Engine problem
 [2016-07-08 07:29 UTC]
@ is only allowed with expressions and unset is considered a statement, like control structures and return.

It is possible for unset(expr) to raise an error <>, and it looks like @ is implemented as a begin/execute/end sequence rather than a "silence the next expression" operation, so maybe @ could be promoted to support statements too? Code like
  @foreach ($array as $var) {
looks a bit odd, but I can't think of any reason why it should specifically not be supported. (Putting aside the general "don't use the error suppression operator" advice, that is.)
 [2016-07-08 07:30 UTC]
-Type: Bug +Type: Feature/Change Request
 [2016-07-13 01:39 UTC]
@requinix I agree that we should perhaps allow the silence operator to operate on language constructs, or at least allow line 16 of your example (unset(@$...)), since we already allow to silence individual variables or calls like:

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 08:01:32 2024 UTC