php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #30248 Ternary operator nesting is wrong
Submitted: 2004-09-27 03:02 UTC Modified: 2004-09-27 04:01 UTC
From: RAbbott at CalStateLA dot edu Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.3.7 OS: Windows 2000
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: RAbbott at CalStateLA dot edu
New email:
PHP Version: OS:

 

 [2004-09-27 03:02 UTC] RAbbott at CalStateLA dot edu
Description:
------------
The ternary expression operators '?' and ':' nest improperly.

The issue was reported by abodeman@yahoo as a comment on the Operators page: http://us2.php.net/language.operators.

He reports it as a nuisance.  It's more than that. It is a either an implementation error or an error in the specification of the language.

Here is an example.

<pre>
X = A ? B :
    C ? D :
        E;

parses as if it were written as follows.

X = (A ? B :
    C) ? D :
         E;

It should parse as if it is written like this.

X = A ? B :
    (C ? D :
         E);
</pre>




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-27 04:01 UTC] amt@php.net
This is a known issue, but it's not going to change 
because it will break backwards compatibility. Sorry.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 10:01:32 2024 UTC