ID:               38047
 Updated by:       [EMAIL PROTECTED]
 Reported By:      thuejk at gmail dot com
-Status:           Assigned
+Status:           Closed
 Bug Type:         Scripting Engine problem
 Operating System: *
 PHP Version:      5CVS-2006-07-27
 Assigned To:      dmitry
 New Comment:

Fixed in CVS HEAD and PHP_5_2.


Previous Comments:
------------------------------------------------------------------------

[2006-07-27 01:30:28] [EMAIL PROTECTED]

Verified. Dmitry, you have touched this code the last time, can you
take a look?

------------------------------------------------------------------------

[2006-07-09 13:11:00] thuejk at gmail dot com

Description:
------------
I generate a backtrace from inside my error handler. Among other things
I use the file and line numbers in the error handler.

In one case, inconsistent with behaviour for other types of errors,
file and line are not set in the frame for the error handler transition
in the backtrace.

I think (without bothering to check) that this error was introduced
after I upgraded from 5.0.4 to 5.1.4


Reproduce code:
---------------
<?php
error_reporting(E_ALL);
set_error_handler('kalus_error_handler');
ini_set("display_errors", "on");

class A {
  function A_ftk() {
  }
}

function kalus_error_handler($error_code, $error_string, $filename,
$line, $symbols) {
  get_error_context();
}

function get_error_context() {
  $backtrace = debug_backtrace();
  echo $backtrace[1]["line"];
  echo "<pre>";print_r($backtrace);
}

//If this is uncommented, the resulting code will have file and line
set for the call into the error handler.
#$a = $aa;

//This will not create file and line items for the call into the error
handler
$page["name"] = A::A_ftk();
?>







Expected result:
----------------
  $backtrace[1]["file"]
and
  $backtrace[1]["line"]
should be set.

Actual result:
--------------
Notice: Undefined index: line in
/home/tjk/kalus3_clean/trunk/src/web/include/setup.php on line 17

Array
(
    [0] => Array
        (
            [file] =>
/home/tjk/kalus3_clean/trunk/src/web/include/setup.php
            [line] => 12
            [function] => get_error_context
            [args] => Array
                (
                )

        )

    [1] => Array
        (
            [function] => kalus_error_handler
            [args] => Array
                (
                    [0] => 2048
                    [1] => Non-static method A::A_ftk() should not be
called statically
                    [2] =>
/home/tjk/kalus3_clean/trunk/src/web/include/setup.php
                    [3] => 25
                    [4] => Array
                        (
                            [GLOBALS] => Array
 *RECURSION*
                            [_POST] => Array
                                (
                                )

                            [_GET] => Array
                                (
                                )

                            [_COOKIE] => Array
                                (
                                    [__utma] =>
192968248.1592420362.1149610271.1149805566.1149849975.6
                                    [__utmz] =>
192968248.1149620260.3.2.utmccn=(referral)|utmcsr=mail.google.com|utmcct=/mail/|utmcmd=referral
                                    [PHPSESSID] =>
o194fe6r7m7fvgm4do1dspqnk0
                                )

                            [_FILES] => Array
                                (
                                )

                        )

                )

        )

    [2] => Array
        (
            [file] =>
/home/tjk/kalus3_clean/trunk/src/web/include/setup.php
            [line] => 25
            [function] => A_ftk
            [class] => A
            [type] => ::
            [args] => Array
                (
                )

        )

)



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=38047&edit=1

Reply via email to