Rather than a Follow Friday I thought I would do a Nasty PHP Friday instead.

This is the median length of files in a legacy Yii1 project I am working on. One of over three hundred such files. That in itself wouldn't be a big problem if it weren't for the fact this was written in the time of PHP 5.1 with zero namespaces. The way Yii1 loads files (it does its own autoloading) means there are a number of classes with conflicting names all in the base namespace. Hurrah! :elephpant: πŸš€

This one is actually an outlier at nearly 7,000 LOC it's one of the biggest files in the project but could easily be split into 100 or so class's as it contains all the logic for report generation and is not very DRY.

:elephpant: πŸš€

Show thread

The fun side of dealing with legacy PHP codebases is finding ini_set thrown around like a condiment.

This example is made more entertaining by the fact it now actually reduces the resource available as the server is set up to provide 3GB RAM and max execution of five minutes for report generation. :elephpant: πŸš€

Show thread

Just saying, it isn't that php is nasty, but more that it php developers are.

@yisraeldov the people who wrote this at the time probably where.

Although I know for a fact that this code has gone through at least twelve developers with next to zero hand over between and each being given just six weeks to pack in 14 weeks worth of work. Under those circumstances most code bases look the same.

@carbontwelve OK, but my point was more that PHP is just as nasty as any other language, it just has lots of users that don't know what they are doing.

Sign in to participate in the conversation
PHP Community on Mastodon

Open source. Open community. We are dedicated to building and enriching the PHP community.