Amazing facts about namespacing in PHP
Alexander Zhigalin
alexander at zhigalin.php
Tue Nov 24 14:32:34 UTC 2015
BUGHUNT MODE ON;
{0-noname.png}
There is a lazy class load system, so no includes, \Application\DB is used 3
times.
\Application\DB is not recognized(as every other classes in other namespaces,
as was stated here: https://bugs.kde.org/show_bug.cgi?id=280985 (btw, 3 year
with no fix...)), Application\DB is recognized but wrong.
I have made a supposion that the parser doesn't recognize the leading
backslash, but...
{1-require.png}
If we directly include the file /Application/DB.php the thing work.
Obliviously, including tons of files just to get duchain working is not an
option.
we_need_to_go_deeper.jpg :)
{2-nobackslash.png}
WTF? What kind of logic make it working then we leave just 1 backslash of 3?
Another two things:
1: Somewhere in duchain all the namespace names are being lowercased, while is
PHP namespaces aren't always lowercase, moreover they're case-sensitive and
"\Application" != "\application". I lurked inside the sources but I had no
success. Maybe someone will be able to suggest where is that mysteriuos place?
2: Sometimes in the completion the same namespace appears more times...
P.S. Using Kubuntu 14.04, Kdev 4.6 from repos and then 4.7.2 from sources, but
still the same bugs :(
--
Alexander Zhigalin - DevOps
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0-noname.png
Type: image/png
Size: 57565 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20151124/024a41cf/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1-require.png
Type: image/png
Size: 57891 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20151124/024a41cf/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2-nobackslash.png
Type: image/png
Size: 57989 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20151124/024a41cf/attachment-0005.png>
More information about the KDevelop-devel
mailing list