Linty linty

I have spent the last few days down in the PHP Mines. Those fumes are really toxic. I'm pretty sure I've contracted pleurisy from inhaling Cheetos dust.

So DNA Lounge has an online store, which is an enormous, and ancient, and shitty, pile of PHP code. I have often characterized it as "it's a pile of shit, but it's our pile of shit."

Well, now that I'm opening a new nightclub, I need to make that code be able to function when installed on a domain whose name is not "dnalounge.com". As you can expect, this has been a process of discovering all kinds of hardcoded assumptions lurking in the bowels. It's like moving to a new house after you've been dug in for a decade: look at all this crap stuffed in the back of the closet that you didn't remember was there!

So there has been a lot of global search and replace, and a lot of variables being added and moved around, and that means destabilization, and that's bad, mmkay?

So I wrote a Perl program to do static analysis of PHP. And it parses PHP using regular expressions because fuck you that's why.

For your entertainment -- because I sincerely doubt that anyone who is not me will ever use this without lulz in their heart -- I give you jwz-php-lint.pl.

Tags: , , , , ,

18 Responses:

  1. Ryan Russell says:

    And now you have three problems?

  2. Don Hopkins says:

    Here's my entry in your Codeword logo contest:
    0 setgray clippath fill showpage
    That's right: The logo is a PostScript program that prints a black page! Not a black page itself -- that's just the effect of executing the logo, and would probably violate somebody else's copyright. I'll be looking forward to my black t-shirt with the logo printed in white, please.

  3. Ino says:

    I love PHP. It's so bad.

  4. Julian Calaby says:

    PHP is truly an argument in the "good programmers can write good code in any language" debate.

    On a more serious note, the variable tainting would be an awesome feature.

  5. Tom Boutell says:

    PHP's tokenizer is available to the developer. I am not a PHP fan (I decamped to nodejs years ago) but this is a decent feature:

    token-get-all

  6. Matt Sayler says:

    I like the fact that most jwz performance art involves Perl.

  7. Matt Sayler says:

    Alternative title: "I'm opening a new nightclub, [...so] I wrote a Perl program to do static analysis of PHP."

    • jwz says:

      When you put it like that, you make it sound like I'm a bad decision-maker in at least two ways.

      • Nathan Roberts says:

        Could be worse. Could have been "I'm opening a new nightclub, [...so] I wrote a PHP program to do static analysis of PHP."

        Yo dawg.

        Honestly though, the true hell is working with WordPress. Especially trying to shoehorn in things it wasn't meant to do. That was what made me glad to be a mere retail slave, instead of a full time web dev.

  8. Shane Knapp says:

    people still write perl? ;)

  9. Kyle Huff says:

    I don't think you can get pleurisy that way. You probably have lupus. Better call Dr. House.

  10. Jon says:

    This reminded me of the language Idris, which added a PHP backend, sort-of.
    https://github.com/edwinb/idris-php

    Prefixed with "Please, don't ever use this.".

  11. Ben says:

    My favorite PHP rant ever is titled PHP: a fractal of bad design. That covers it, really (and, yes, I totally understand why your working crap software is superior to some theoretically better software that isn't currently in place).