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

--TEST--
Bug #38047 ("file" and "line" sometimes not set in backtrace from inside error handler)
--FILE--
<?php
error_reporting(E_ALL);
set_error_handler('kalus_error_handler');
ini_set("display_errors", "on");

class A {
  function A_ftk($a) {
  }
}

function kalus_error_handler($error_code, $error_string, $filename, $line, $symbols) {
  echo "$error_string\n";
  get_error_context();
}

function get_error_context() {
  $backtrace = debug_backtrace();
  $n = 1;
  foreach ($backtrace as $call) {
  	echo $n++." ";
  	if (isset($call["file"])) {
  		echo $call["file"];
  		if (isset($call["line"])) {
  			echo ":".$call["line"];
  		}
  	}
  	if (isset($call["function"])) {
  		echo " ".$call["function"]."()";
  	}
  	echo "\n";
  }
  echo "\n";
}

//This will not create file and line items for the call into the error handler
$page["name"] = A::A_ftk();
?>
--EXPECTF--
Non-static method A::A_ftk() should not be called statically
1 %sbug38047.php:13 get_error_context()
2 %sbug38047.php:36 kalus_error_handler()
3 %sbug38047.php:36 A_ftk()

Missing argument 1 for A::A_ftk(), called in %sbug38047.php on line 36 and defined
1 %sbug38047.php:13 get_error_context()
2 %sbug38047.php:7 kalus_error_handler()
3 %sbug38047.php:36 A_ftk()

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