Search code examples
phpnotice

php: "notice" warnings on different machine


i've set up all my php stuff on a new machine and i'm getting really lots of notices warnings.

my code is working properly without errors on my old machine.

eg. the following line (which should get a recordset value) will cause a notice: $ID = $rs[id];

the reason is the missing quotes for the id fields, but also things like calling $_GET on a non-existing value will cause notices.

anyone knows what's the reason for this? i'd love keeping the "simple" way of coding like on my old machine without having to hassle with quotes on recordsets or tons of isset() - any ideas?

thanks


Solution

  • The PHP installation in the new machine has a more robust configuration that shows notices, and not only errors. That's good. I would never write or accept in my server a PHP script that fires some notice.

    This kind of "lazy" coding (forgive me, I want to help you!) brings to future issues (code is hard to read and to debug) and, indirectly, security concerns ("lazy" code is often flawed). Fix everything that fires up a notice. :)

    And, if you can, learn some more advanced PHP: go for object-oriented programming, encapsulation, information hiding, etc... This is how things are done nowadays and they work better than before. Old PHP scripts, built around notice suppression and register_globals, were somewhat dump.