File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / bug38047.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:52 2012 UTC (13 years, 1 month ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

    1: --TEST--
    2: Bug #38047 ("file" and "line" sometimes not set in backtrace from inside error handler)
    3: --FILE--
    4: <?php
    5: error_reporting(E_ALL);
    6: set_error_handler('kalus_error_handler');
    7: ini_set("display_errors", "on");
    8: 
    9: class A {
   10:   function A_ftk($a) {
   11:   }
   12: }
   13: 
   14: function kalus_error_handler($error_code, $error_string, $filename, $line, $symbols) {
   15:   echo "$error_string\n";
   16:   get_error_context();
   17: }
   18: 
   19: function get_error_context() {
   20:   $backtrace = debug_backtrace();
   21:   $n = 1;
   22:   foreach ($backtrace as $call) {
   23:   	echo $n++." ";
   24:   	if (isset($call["file"])) {
   25:   		echo $call["file"];
   26:   		if (isset($call["line"])) {
   27:   			echo ":".$call["line"];
   28:   		}
   29:   	}
   30:   	if (isset($call["function"])) {
   31:   		echo " ".$call["function"]."()";
   32:   	}
   33:   	echo "\n";
   34:   }
   35:   echo "\n";
   36: }
   37: 
   38: //This will not create file and line items for the call into the error handler
   39: $page["name"] = A::A_ftk();
   40: ?>
   41: --EXPECTF--
   42: Non-static method A::A_ftk() should not be called statically
   43: 1 %sbug38047.php:13 get_error_context()
   44: 2 %sbug38047.php:36 kalus_error_handler()
   45: 3 %sbug38047.php:36 A_ftk()
   46: 
   47: Missing argument 1 for A::A_ftk(), called in %sbug38047.php on line 36 and defined
   48: 1 %sbug38047.php:13 get_error_context()
   49: 2 %sbug38047.php:7 kalus_error_handler()
   50: 3 %sbug38047.php:36 A_ftk()

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>