get name of function within function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lawpoop@gmail.com

    get name of function within function

    Is there a way to find out the name of the function within the
    function?

    I'm doing troubleshooting of a page in which I call a lot of
    functions. I had a simple error message pop up, which was okay back
    when the page way simple. Now that the page has grown, it's a PITA to
    find out where exactly the error message is being triggered. It would
    be very helpful if I could find out which function I'm "in" when the
    error message gets called.
  • ZeldorBlat

    #2
    Re: get name of function within function

    On Apr 17, 11:56 am, lawp...@gmail.c om wrote:
    Is there a way to find out the name of the function within the
    function?
    >
    I'm doing troubleshooting of a page in which I call a lot of
    functions. I had a simple error message pop up, which was okay back
    when the page way simple. Now that the page has grown, it's a PITA to
    find out where exactly the error message is being triggered. It would
    be very helpful if I could find out which function I'm "in" when the
    error message gets called.
    <http://www.php.net/manual/en/language.consta nts.predefined. php>

    Comment

    • Rik Wasmus

      #3
      Re: get name of function within function

      On Thu, 17 Apr 2008 18:03:51 +0200, ZeldorBlat <zeldorblat@gma il.com>
      wrote:
      On Apr 17, 11:56 am, lawp...@gmail.c om wrote:
      >Is there a way to find out the name of the function within the
      >function?
      >>
      >I'm doing troubleshooting of a page in which I call a lot of
      >functions. I had a simple error message pop up, which was okay back
      >when the page way simple. Now that the page has grown, it's a PITA to
      >find out where exactly the error message is being triggered. It would
      >be very helpful if I could find out which function I'm "in" when the
      >error message gets called.
      >
      <http://www.php.net/manual/en/language.consta nts.predefined. php>
      Or alternatively, do a debug_print_bac ktrace();, very nice when
      troubleshooting .
      --
      Rik Wasmus

      Comment

      • =?ISO-8859-1?Q?=22=C1lvaro_G=2E_Vicario=22?=

        #4
        Re: get name of function within function

        lawpoop@gmail.c om escribió:
        I'm doing troubleshooting of a page in which I call a lot of
        functions. I had a simple error message pop up, which was okay back
        when the page way simple. Now that the page has grown, it's a PITA to
        find out where exactly the error message is being triggered. It would
        be very helpful if I could find out which function I'm "in" when the
        error message gets called.
        You have a magic constant called __FUNCTION__ but what really want is a
        backtrace:



        You can call it from your own error handling function:





        --
        -- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
        -- Mi sitio sobre programación web: http://bits.demogracia.com
        -- Mi web de humor al baño María: http://www.demogracia.com
        --

        Comment

        • Peter H. Coffin

          #5
          Re: get name of function within function

          On Thu, 17 Apr 2008 18:19:10 +0200, Rik Wasmus wrote:
          On Thu, 17 Apr 2008 18:03:51 +0200, ZeldorBlat <zeldorblat@gma il.com>
          wrote:
          >
          >On Apr 17, 11:56 am, lawp...@gmail.c om wrote:
          >>Is there a way to find out the name of the function within the
          >>function?
          >>>
          >>I'm doing troubleshooting of a page in which I call a lot of
          >>functions. I had a simple error message pop up, which was okay back
          >>when the page way simple. Now that the page has grown, it's a PITA to
          >>find out where exactly the error message is being triggered. It would
          >>be very helpful if I could find out which function I'm "in" when the
          >>error message gets called.
          >>
          ><http://www.php.net/manual/en/language.consta nts.predefined. php>
          >
          Or alternatively, do a debug_print_bac ktrace();, very nice when
          troubleshooting .
          Best option for programmers, definately. For users, sometimes a
          completely bizzare error message that doesn't mean ANYTHING gets better
          reporting. "lock timeout" gets much less attention from users than "Why
          did it just say it was out of tuna?", and since *I* know where the tuna
          error message is, even though the message is actually "fainted from loss
          of tuna", I can still find exactly where the failure was, and know what
          to look for in logs.

          --
          Cunningham's Second Law:
          It's always more complex than you expect, even when you take
          Cunningham's Second Law into account.

          Comment

          Working...