Bug 281668

Summary: PHP (?) : Highlighter confuses code parts to highlight.
Product: [Applications] kdevelop Reporter: jay <jay>
Component: Language Support: PHPAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: minor    
Priority: HI    
Version: git master   
Target Milestone: 4.2.3   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Highlighting 1
Highlighting 2
Function with highlight error

Description jay 2011-09-09 08:37:35 UTC
Version:           git master (using KDE 4.6.2) 
OS:                Linux

Sorry,
I don't know how to describe it.
I'll attach 2 images.
Important id the last "foreach" - variable $sDate, and the line "$aDateProdBal = Array();" above it.
Highlighter thinks that "y();" and "$sDate" are the same variable.


This happens in unpredictable situations (seen it many times).
If I copy/paste this code into another file or function, error disappears.

Reproducible: Always

Steps to Reproduce:
I'm unable to create a reproducible code chunk.
Error appears at random, but stays there even after restart of kdev (or reopening the file).


Expected Results:  
(correct highlighting :) )

OS: Linux (x86_64) release 2.6.35-30-generic
Compiler: cc
Comment 1 jay 2011-09-09 08:38:17 UTC
Created attachment 63523 [details]
Highlighting 1
Comment 2 jay 2011-09-09 08:38:55 UTC
Created attachment 63524 [details]
Highlighting 2
Comment 3 Milian Wolff 2011-09-09 10:22:32 UTC
sigh yeah we've had similar errors before and they are a royal pita to debug and fix. without a way to reproduce it, I won't be able to help much I'm afraid :(

if you spot it the next time, try to remember what you just wrote and repeat it. the error most likely stems from inserting/removing lines and our code not updating stuff properly
Comment 4 jay 2012-01-23 14:22:33 UTC
Created attachment 68113 [details]
Function with highlight error

I found a small enough part of code, which has a repeatable bug appearance.

Steps to repeat this bug:
1. cursor on beginning of line 9 (     $aBt = null;)
2. Shift+Down (selects line 9)
3. delete (removes selected line 9)

After that "fore" in "foreach" gets the same color as was the color of $aBt.



Right now I'm using ~2 months old kdevelop, and a can not upgrade now, so I hope this will be helpful.
Comment 5 Milian Wolff 2012-02-09 14:34:48 UTC
indeed nice test - I'll investigate.
Comment 6 Milian Wolff 2012-02-11 17:01:37 UTC
Git commit a6024bbc52b40c3d481959d390dba5ccf0ed671d by Milian Wolff.
Committed on 11/02/2012 at 17:59.
Pushed by mwolff into branch '1.3'.

properly update ranges of declarations we reuse (i.e. encounter)

M  +1    -1    duchain/builders/contextbuilder.cpp
M  +1    -1    duchain/builders/contextbuilder.h
M  +8    -2    duchain/builders/declarationbuilder.cpp
M  +43   -0    duchain/tests/duchain_multiplefiles.cpp
M  +1    -1    duchain/tests/duchain_multiplefiles.h

http://commits.kde.org/kdev-php/a6024bbc52b40c3d481959d390dba5ccf0ed671d