Bug #72563 [Opn]: @unset() return error

From: Date: Fri, 08 Jul 2016 07:29:46 +0000
Subject: Bug #72563 [Opn]: @unset() return error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-202127@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72563&edit=1

 ID:                 72563
 Updated by:         requinix@php.net
 Reported by:        security at nsa dot gov
 Summary:            @unset() return error
 Status:             Open
 Type:               Bug
-Package:            PHP Language Specification
+Package:            Scripting Engine problem
 Operating System:   Windows
 PHP Version:        7.0.8
 Block user comment: N
 Private report:     N

 New Comment:

@ 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 <https://3v4l.org/idvWY>, 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.)


Previous Comments:
------------------------------------------------------------------------
[2016-07-08 05:50:17] security at nsa dot gov

Description:
------------
If I use @ to supress error, PHP failed to parse @unset.

Test script:
---------------
<?php
$a='aaa';
@unset($a);
?>

Expected result:
----------------
No error

Actual result:
--------------
Erros parsing


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=72563&edit=1


Thread (1 message)

  • requinix@php.net
  • Unknown Message
    • requinix@php.net
« previous php.bugs (#202127) next »