phpbandaid 1.0: A PHP Extension to Reduce PHP's Suckage

** What is it?

    phpbandaid is a lightweight extension module for PHP that provides some
    basic debugging facilities that the developers of PHP have neglected to
    provide. Other solutions are often bulky and require a separate debugger
    client. phpbandaid also provides an API that allows PHP applications to
    examine the callstack or generate a backtrace.


** How does it work?

   When a runtime error occurs, phpbandaid generates and dumps a stacktrace
   after the error message.

   Sample: Source Output


** Where do I get it?

   Download phpbandaid 1.0


** Quick install instructions for UNIX-like OSes (I hope):

    1. Make sure you have PHP 4 or higher installed.
       I only tested it with PHP 4.3 under Linux.

    2. Run these commands:

            phpize
            ./configure
            make

    3. If everything worked right, you now have a modules/bandaid.so. Copy
       this file to your PHP modules directory. On my machine this was
       /usr/lib/php/extensions/no-debug-non-zts-20020429/

    4. Add the following line to your php.ini:
       
            extension = bandaid.so

    5. Test it using the included test script, the output should be similar
       to test.html in the distribution.


** phpbandaid API
   
   bandaid_print_traceback()
        Prints out a regular phpbandaid traceback identical to the tracebacks
        generated when a runtime error is encountered.

   bandaid_get_callstack()
        Returns the callstack as an array of arrays of the form:

            (function_name, filename, linenum)

        The first element in the array is the first function called, i.e. the
        deepest on the call stack. See test.php and its output for an example.

    bandaid_get_calldepth()
        Returns an integer representing the current call depth.

    bandaid_get_stacksize()
        Returns an integer representing the maximum call depth phpbandaid was
        configured to track.


** Author's Information

   phpbandaid was developed in a fit of rage by Jey Kottalam
   <phpbandaid # kottalam ! net> one day in December 2003.