Finding undefinied variables in script

Discussion in 'PHP' started by x0x, Jul 15, 2009.

  1. #1
    My script runs with register_globals ON and I'm trying to find all the undefined variables there are with error_reporting(E_ALL);

    That shows me undefined constants and a bunch of other stuff as well, would there be a way to ONLY show undefined variable messages?

    (Notice: Undefined variable: varrr in file.php line 3)
     
    x0x, Jul 15, 2009 IP
  2. jbrooksuk

    jbrooksuk Active Member

    Messages:
    127
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    81
    #2
    No sorry. E_ALL is as good as it gets I'm afraid.
     
    jbrooksuk, Jul 15, 2009 IP
  3. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #3
    You could check your error logs and do a search for Undefined variable.

    If you have access to the error log on the server, something like this should work:

    tail -n 1000 error_log | grep "Undefined variable"
     
    jestep, Jul 15, 2009 IP
  4. JefK

    JefK Member

    Messages:
    66
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    45
    #4
    How about isset() or empty()?
     
    JefK, Jul 18, 2009 IP
  5. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #5
    joebert, Jul 18, 2009 IP