Bug 405719

Summary: php - constant array resusults in syntax error
Product: [Applications] kdevelop Reporter: Marijo <mustacmarijo>
Component: Language Support: PHPAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: 5.3.0   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 5.4.3
Sentry Crash Report:
Attachments: syntax errors

Description Marijo 2019-03-21 12:20:45 UTC
SUMMARY
With php7 we are now allowed to have arrays defined as constants.
See: https://www.w3schools.com/php7/php7_constants.asp
When I do so I get syntax errors reported.

STEPS TO REPRODUCE
1. Create new php file
2. Add example code
<?php

define('ELEMENTS', array('Earth', 'Fire', 'Water', 'Air'));
define('ELEMENT', 'Fire');

echo "My favorite element is ".ELEMENTS[1]."!";
echo "My favorite element is ".ELEMENT."!";

?>
3. See syntax errors

OBSERVED RESULT
Syntax check reports error (see attachement)

EXPECTED RESULT
No syntax error reported.

SOFTWARE/OS VERSIONS
Linux: 4.15.0-45-generic
KDE Plasma Version: 5.15.80
KDE Frameworks Version: 5.57.0
Qt Version: 5.12.0
KDevelop: 5.3.40
Comment 1 Marijo 2019-03-21 12:21:48 UTC
Created attachment 118958 [details]
syntax errors
Comment 2 Heinz Wiesinger 2019-10-07 11:05:07 UTC
Git commit cb71eff2153aeb8b3b9f09e0bb232807a523884d by Heinz Wiesinger.
Committed on 06/10/2019 at 18:40.
Pushed by wiesinger into branch '5.4'.

Fix expressions using array constants
FIXED-IN: 5.4.3

M  +23   -0    duchain/tests/duchain.cpp
M  +2    -0    duchain/tests/duchain.h
M  +1    -1    parser/php.g

https://commits.kde.org/kdev-php/cb71eff2153aeb8b3b9f09e0bb232807a523884d