Bug #77880 [Opn->Fbk]: Incorrect tree for scope resolution operator specified before class declaration
| From: | nikic@php.net | Date: | Fri, 12 Apr 2019 07:38:08 +0000 |
| Subject: | Bug #77880 [Opn->Fbk]: Incorrect tree for scope resolution operator specified before class declaration | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-220411@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77880&edit=1
ID: 77880
Updated by: nikic@php.net
Reported by: sobisht at adobe dot com
Summary: Incorrect tree for scope resolution operator
specified before class declaration
-Status: Open
+Status: Feedback
Type: Bug
Package: Scripting Engine problem
Operating System: Win Mac
PHP Version: 7.1.28
Block user comment: N
Private report: N
New Comment:
Can you please provide the ASTs either in human readable format or rendered images?
Also, what is this "zend parser" you're talking about? PHP does not come with any
tooling to produce ASTs, so you must be using something else to do so.
Previous Comments:
------------------------------------------------------------------------
[2019-04-12 05:58:14] sobisht at adobe dot com
Description:
------------
When we specify a class name with scope resolution operator just before the class description. Then
the incorrect syntax tree is parsed by zend parser.
When a word is typed after the scope resolution operator, then zend parses correct syntax tree.
This issue starts occurring from zend parser for php-5.6 onwards.
This issue only occurs in the scenario when scope resolution operator is specified for same class
whose declaration has been specified in the next statement.
A digraph generated for the syntax tree has been specified in the expected result and actual result.
As you can see, when scope resolution operator is specified, the label "SMTP" related to
class name gets removed.
Test script:
---------------
<?php
SMTP::
class SMTP
{
const VERSION = '5.2.22';
}
?>
Expected result:
----------------
digraph dbg_AST {
rankdir=LR
node0 [shape=point, label="<notext>"]
node1 [shape=rect, label="SMTP"]
node0->node1
node2 [shape=octagon, label="SMTP"]
node0->node2
node3 [shape=point, label="<notext>"]
node2->node3
node4 [shape=point, label="<notext>"]
node2->node4
node5 [shape=point, label="<notext>"]
node4->node5
node6 [shape=hexagon, label="VERSION"]
node5->node6
node7 [shape=note, label="5.2.22"]
node6->node7
node8 [shape=rect, label="?>
¶"]
node0->node8
node9 [shape=rect, label="<internal>"]
node0->node9
node10 [shape=rect, label="
¶"]
node9->node10
}
Actual result:
--------------
digraph dbg_AST {
rankdir=LR
node0 [shape=point, label="<notext>"]
node1 [shape=point, label="<notext>"]
node0->node1
node2 [shape=note, label="5.2.22"]
node1->node2
node3 [shape=rect, label="?>
¶"]
node0->node3
node4 [shape=rect, label="<internal>"]
node0->node4
node5 [shape=rect, label="
¶"]
node4->node5
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77880&edit=1