[Vtigercrm-developers] Static analysis for vtiger 7.4

Sukhdev Mohan s.mohan at myti.it
Sun Aug 1 21:16:13 GMT 2021


Hi all,

I’ve done a static analysis for the new release. The idea is to highlight are of interventions, defining a starting point to decrease the technical debt this project has piled up.

I’ve tried to run the project (clean install) with php7.4 and mysql 8 + docker, install started unfortunately I had 504 during the installation but I’m working on it, when it’s finished I’ll be sharing my GitHub repo with a working docker file with LEMP. I’ve tried PHP8 too just out of curiosity. As expected it doesn’t even launch the wizard: a lot of fatal errors. For the moment I can tell these 2:
1. PearDatabase: use of curly braces instead of []
2. AntlrLexer: them Ian class seems to be extending a base class but it’s following the definition in the base class for matchAny and Re. I couldn’t find the php version for this project, so if you guys wrote it, look at it.

Now coming back to static Analysis, I’ve done it with PHPInsights for the modules folder (launch this command from cam root folder - after install through composer - : php -d memory_limit=4000M ./vendor/bin/phpinsights analyse modules ), you can find it zipped as a json file, the tool did truncated some but since it’s easy to launch please do relaunch it. - although it will take a bit… the generated file is about 85MB...

Some thoughts:
As expected there is no proper implementation of  OOP (No visibility keywords, no namespaces), there is extensive use of global variables and super global variables such as $_REQUEST - which is needless to say harmful. Other than this there are too many nested loops (in some part nested loop level is 7 whereas recommended is 2 or 3, this has huge implications on performance!), many declared and unused variables.

It’s safe to say that if PHP7.4 is still letting some of the old practices go on, PHP8 will break the code badly, since most of the code is legacy. I was hoping that at least there would be composer but that’s for the next release, hopefully.

What are your thoughts? How can we start to approach?

Sukhdev Mohan
Developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20210801/08e4e38b/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtiger7.4-modules-stan.json.zip
Type: application/octet-stream
Size: 4497193 bytes
Desc: not available
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20210801/08e4e38b/attachment-0001.obj>


More information about the vtigercrm-developers mailing list