|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59779 Support for unary minus
Submitted: 2011-05-22 08:31 UTC Modified: 2017-10-24 23:02 UTC
Avg. Score:1.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: Assigned:
Status: Suspended Package: operator (PECL)
PHP Version: Irrelevant OS:
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:
New email:
PHP Version: OS:


 [2011-05-22 08:31 UTC]
Negative values are not supported.

Reproduce code:
$x = -new foo(5);

Expected result:
Call of __minus() or similar method.

Actual result:
No method is called.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-07-18 02:51 UTC]
So... hrmmm... this is doable, sort of.

The parser translates `- expr` into `0 - expr`, so I could watch for the binary 
subtraction op where the lhs is int(0), but that feels like it'll lead to a weird 
inconsistency where actual `0 - expr` yields a call to __minus(), but `1 - expr` 
doesn't have any overloaded meaning.

I'm going to put my implementation of this on the shelf for now and give it some 
 [2017-04-01 21:02 UTC]
-Package: operator +Package: *General Issues
 [2017-04-01 21:03 UTC]
-Package: *General Issues +Package: operator
 [2017-04-01 21:03 UTC]
I got confused...
 [2017-10-24 23:02 UTC]
-Status: Open +Status: Suspended
 [2017-10-24 23:02 UTC]
The operator PECL package have not had a release for 4 years and development activity seems to have ceased, if a new maintainer picks up this package, then this report should be re-opened
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 27 19:01:34 2024 UTC