Reporting undefined variables

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • D. Alvarado

    Reporting undefined variables

    Hello, Ia m running PHP 4 on Fedora Linus Apache 1.27. Since I have a
    dev box, I would like warnings to appear in the event of undefined
    variables or constants. But although I specified this setting in the
    php.ini file,

    ;error_reportin g = E_COMPILE_ERROR |E_ERROR|E_CORE _ERROR
    ;
    ; - Show all errors except for notices
    ;
    error_reporting = E_ALL

    ; Print out errors (as a part of the output). For production web
    sites,
    ; you're strongly encouraged to turn this feature off, and use error
    logging
    ; instead (see below). Keeping display_errors enabled on a production
    web site
    ; may reveal security information to end users, such as file paths on
    your Web
    ; server, your database schema or other information.
    display_errors = On


    warnings are not displayed. I stopped and restarted Apache. How can
    I verify at runtime the error reporting level? Is there some kind of
    PHP printable command?

    DOes anyone have any other suggestions for how I may display undefined
    variable warnings?

    Much thanks, - Dave
  • Ian.H

    #2
    Re: Reporting undefined variables

    On Thu, 29 Jul 2004 20:41:44 -0700, D. Alvarado wrote:
    [color=blue]
    > Hello, Ia m running PHP 4 on Fedora Linus Apache 1.27. Since I have a
    > dev box, I would like warnings to appear in the event of undefined
    > variables or constants. But although I specified this setting in the
    > php.ini file,
    >
    > ;error_reportin g = E_COMPILE_ERROR |E_ERROR|E_CORE _ERROR
    > ;
    > ; - Show all errors except for notices
    > ;
    > error_reporting = E_ALL
    >[/color]


    [ snip ]

    [color=blue]
    > warnings are not displayed. I stopped and restarted Apache. How can
    > I verify at runtime the error reporting level? Is there some kind of
    > PHP printable command?
    >
    > DOes anyone have any other suggestions for how I may display undefined
    > variable warnings?
    >
    > Much thanks, - Dave[/color]


    Dave, try:


    error_reporting = E_ALL & E_NOTICE


    Note: Enabling E_NOTICE during development has some benefits. For
    debugging purposes: NOTICE messages will warn you about possible bugs in
    your code. For example, use of unassigned values is warned. It is
    extremely useful to find typos and to save time for debugging. NOTICE
    messages will warn you about bad style. For example, $arr[item] is better
    to be written as $arr['item'] since PHP tries to treat "item" as constant.
    If it is not a constant, PHP assumes it is a string index for the array.

    Sounds about right if I understand you correctly =)


    HTH.



    Regards,

    Ian

    --
    Ian.H
    digiServ Network
    London, UK


    Comment

    Working...