7
Flarp
1y

MMMM

Why the actual FUCK does PHP not throw errors for undefined variables.

FUCK

I've spent more time going through code (mine and others) to find mispelled variables than actually fucking writing code. One poor bastard had a delete statement, and a where clause in another variable, which he mistyped. Oops.

CRASH DAMMIT, LET ME KNOW.

aAAAaAaaaaaAAAA

Comments
  • 3
    Use phpstorm
  • 9
    a) who the fuck deletes variables in php? 😂
    b) use error_reporting(E_ALL);
    Thank me later
  • 1
    Graduate to a better-designed language.
  • 1
    @Ashkin This is an existing codebase

    @scroach If this works you're a god
  • 0
    @scroach is right. Read php.ini config file
  • 1
    @Flarp well it definitely works - accessing an undefined variable is only a notice but you will notice - hah those puns... better go to bed now :(
    Oh and if you don't see anything should turn on display errors too on your dev machine. Else you might need to check log files
  • 1
    @Flarp PHPStorm can tell you the following stuff :
    - unused variable has a grey color
    - unreachable variable is highlighted in a soft yellow (variable created in a if or a foreach)
    - undefined but still used variable is underlined in red
  • 0
    What @scroach said.
    You keep 2 different configs, one for development and another for production in your app.
    You can even detect your environment so you don't accidentally deploy a highly verbose version.
  • 0
    Are there linters for PHP?
  • 0
    @Hedgepig look for 'php code sniffer', tried it and it does it job. Wouldn't recommend for a project around a CMS though
  • 0
    @Drillan767 ah fair, I was mainly curious, don't really have a need for PHP
  • 1
    @itzyzex Using concrete, a CMS with its own built-in editor. Can't directly edit files.
Your Job Suck?
Get a Better Job
Add Comment